Data processing method and device, equipment, storage medium and program product
By electing a master device from among the terminal devices to aggregate and report data, the problem of excessive computing pressure on the server side was solved, thus reducing operating costs.
Patent Information
- Application Number
- CN202410241399.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2044-03-04
AI Technical Summary
In existing technologies, the indicator data of terminal devices need to be aggregated by the server, which leads to excessive computing pressure on the server and increased operating costs.
By electing a master device in a group of terminal devices, the master device aggregates and reports the metric data of the following devices, reducing the number of data requests to the server and the need for data aggregation.
This reduces the server's memory and processor requirements, decreases the number of requests from terminal devices to the server, and lowers operating costs.
Smart Images

Figure CN118803014B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computing network technology, and in particular relates to a data processing method, apparatus, device, storage medium and program product. Background Technology
[0002] Nowadays, with the increasing number of terminal devices such as computers and mobile phones, the management of these devices is generally achieved by the devices directly reporting to the server via specific communication protocols. The terminal devices need to report all information to the server, including data usage and latency, and the server then aggregates the data.
[0003] Since all data needs to be aggregated and summarized on the server side, the server side is under great computational pressure. As the number of terminal devices continues to increase, the amount of information reported increases, and the accuracy of reporting improves, the access volume to the server side gradually increases, which means that the demand for computing power such as server memory and processors increases, leading to a sharp increase in server operating costs. Summary of the Invention
[0004] This application provides a data processing method, apparatus, device, storage medium, and program product that can solve the problem of excessively high computing power requirements for servers.
[0005] In a first aspect, embodiments of this application provide a data processing method, the method comprising:
[0006] The first master device receives indicator data from N first follower devices, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, where N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices.
[0007] When N is greater than or equal to the first quantity threshold, the first master device summarizes the indicator data of the N first follower devices and the indicator data of the first master device to obtain the summary data.
[0008] The aggregated data is sent to the server via the first master device.
[0009] In some embodiments, before receiving the indicator data from N first follower devices via the first master device, the method further includes:
[0010] Obtain the actual timeout interval of each first device in the first device group;
[0011] If the second device does not generate a heartbeat signal or receive a heartbeat signal sent by the first master device within a first time period threshold after the first moment, the second device is determined as a candidate device, wherein the second device is any one of the first devices in the first device group, the first moment is the moment when the heartbeat signal was most recently generated or received, and the first time period threshold is any time period in the actual timeout interval of the second device;
[0012] The first master device is determined from among the candidate devices based on the actual timeout interval of each candidate device in the first device group.
[0013] In some embodiments, obtaining the actual timeout interval of each first device in the first device group includes:
[0014] Obtain a preset original timeout interval, which includes the minimum value and the maximum value of the original timeout interval;
[0015] Obtain the device score of a third device, wherein the third device is any one of the multiple first devices in the first device group;
[0016] The actual maximum timeout interval of the third device is determined based on the device score and the original maximum timeout interval.
[0017] The actual timeout interval of the third device is generated based on the minimum value of the original timeout interval and the maximum value of the actual timeout interval.
[0018] In some embodiments, obtaining the device score of the third device includes:
[0019] Obtain multiple device parameters of the third device, as well as the weight coefficients corresponding to each device parameter. The device parameters include online duration, available memory, available storage space, and number of available processor cores within a first time range.
[0020] The sum of the products of each of the device parameters and the corresponding weight coefficients is determined as the device score of the third device.
[0021] In some embodiments, sending the aggregated data to the server via the first master device includes:
[0022] When strong data consistency is required in the first device group, the aggregated data is written to the log file of the first master device;
[0023] The aggregated data is sent to each of the first following devices in the first device group;
[0024] If the number of response messages received by the first master device exceeds the second quantity threshold, the aggregated data is sent to the server. The response message is used to respond to the receipt of the aggregated data sent by the first master device.
[0025] In some embodiments, before receiving the indicator data from N first follower devices via the first master device, the method further includes:
[0026] The fourth device sends its network identifier, group status, and device score to the server. The fourth device can be any device terminal that is connected to the server.
[0027] When the grouping status of the fourth device is ungrouped, the server receives the grouping information generated based on the network identifier and the device score.
[0028] Based on the grouping information, the device group to which the fourth device belongs is determined, and the device group includes the first device group.
[0029] Secondly, embodiments of this application provide a data processing apparatus, the apparatus comprising:
[0030] The receiving module is configured to receive indicator data from N first follower devices through a first master device, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, where N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices;
[0031] The aggregation module is used to aggregate the indicator data of the N first follower devices and the indicator data of the first master device when N is greater than or equal to a first quantity threshold, and obtain aggregated data.
[0032] The sending module is used to send the aggregated data to the server via the first master device.
[0033] Thirdly, embodiments of this application provide a data processing device, the device including: a processor and a memory storing computer program instructions;
[0034] The processor implements the above data processing method when executing computer program instructions.
[0035] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the data processing method described above.
[0036] Fifthly, embodiments of this application provide a computer program product, the computer program product including computer program instructions, which, when executed by a processor, implement the data processing method described above.
[0037] In this application, a master device in a device group collects metric data from each following device in the group, summarizes the metric data to obtain aggregated data, and then the master device reports the aggregated data to the server. In this way, compared with existing technologies, a device group only needs to make one data reporting request to the server, and the server does not need to aggregate the collected metric data. This not only reduces the number of requests from terminal devices to the server, but also reduces the server's memory and processor requirements, thus lowering the server's computing power requirements. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a schematic flowchart of a data processing method provided in an embodiment of this application;
[0040] Figure 2 This is a schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application;
[0041] Figure 3 This is a schematic diagram of the hardware structure of a data processing device provided in an embodiment of this application. Detailed Implementation
[0042] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples of this application.
[0043] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0044] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.
[0045] Specifically, in order to solve the problems of the prior art, embodiments of this application provide a data processing method, apparatus, device, storage medium, and program product. The data processing method provided in the embodiments of this application will be described first below.
[0046] Figure 1 A flowchart illustrating a data processing method according to an embodiment of this application is shown. The method is applied to a first group of devices and includes the following steps:
[0047] S110, receive indicator data from N first follower devices through the first master device, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, wherein N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices.
[0048] In this embodiment, to achieve unified status and resource management of terminal devices, the terminal devices need to maintain a communication connection with the server and report their own indicator data to the server. This indicator data is used to characterize the terminal device's operating status and other information, such as data usage and latency.
[0049] Before the terminal devices report their own indicator data, multiple terminal devices that have communication connections with the same server can be divided into different device groups according to the pre-set grouping rules. Each device group includes at least two terminal devices, and each device group is autonomous in a decentralized manner.
[0050] Specifically, taking the first device group as an example, the first device group includes multiple first devices, and each first device can include a first master device and P first follower devices. The first master device can play a leading role in the device group. Before the first device group reports data, N of the P first follower devices will send their own indicator data to the first master device, thus the first master device can receive N sets of indicator data.
[0051] S120, when N is greater than or equal to the first quantity threshold, the first master device summarizes the indicator data of the N first follower devices and the indicator data of the first master device to obtain the summary data.
[0052] In this embodiment, after receiving N sets of indicator data from N first follower devices, the first master device compares the number N of received indicator data with a pre-set first quantity threshold. If N is less than the first quantity threshold, it can be considered that the amount of data received by the first master device is too small, and the N sets of received indicator data are discarded. If N is greater than or equal to the first quantity threshold, it can be considered that the amount of data received by the first master device has reached the reporting standard, and the N sets of indicator data and the first master device's own indicator data can be aggregated to obtain summary data.
[0053] S130, the aggregated data is sent to the server through the first master device.
[0054] In this embodiment, after summarizing the N+1 sets of indicator data, the first master device can report the indicator data in the first device group to the server in the form of summarized data.
[0055] Taking device traffic as an example, with N = 4, the total number of data points is 5. The 5 data points before aggregation are shown in Table 1:
[0056]
[0057] Table 1: Summary data of the data reported by each of the first devices is shown in Table 2:
[0058]
[0059] Table 2: Summary Data
[0060] In this way, the amount of data after aggregation is greatly reduced, thus significantly reducing the amount of data that needs to be reported in the first device group.
[0061] In this application, a master device in a device group collects metric data from each following device in the group, summarizes the metric data to obtain aggregated data, and then the master device reports the aggregated data to the server. In this way, compared with existing technologies, a device group only needs to make one data reporting request to the server, and the server does not need to aggregate the collected metric data. This not only reduces the number of requests from terminal devices to the server, but also reduces the server's memory and processor requirements, thus lowering the server's computing power demands.
[0062] As an optional embodiment, before receiving the indicator data from N first follower devices via the first master device, the method further includes:
[0063] Obtain the actual timeout interval of each first device in the first device group;
[0064] If the second device does not generate a heartbeat signal or receive a heartbeat signal sent by the first master device within a first time period threshold after the first moment, the second device is determined as a candidate device, wherein the second device is any one of the first devices in the first device group, the first moment is the moment when the heartbeat signal was most recently generated or received, and the first time period threshold is any time period in the actual timeout interval of the second device;
[0065] The first master device is determined from among the candidate devices based on the actual timeout interval of each candidate device in the first device group.
[0066] In this embodiment, if a first master device exists in the first device group, the first master device will generate a heartbeat signal at regular intervals and send the heartbeat signal to each first follower device in the first device group. The heartbeat signal can be used to characterize the state of the first master device and maintain the dominant position of the first master device in the first device group.
[0067] If no heartbeat signal is generated or received in the second device within the first duration threshold after the first moment, it can be considered that the first master device in the first device group to which the second device belongs has failed or is unavailable, and it is necessary to re-elect the first master device among multiple first devices.
[0068] Specifically, the Raft distributed consensus algorithm can be used to elect the first master device. Before the election, each terminal device is assigned a device score, which can be based on the device's performance, reliability, or other relevant factors. The actual timeout interval for each first device can be determined based on the device score. If the second device does not generate or receive a heartbeat signal, the second device may initiate an election at any time point within the actual timeout interval, that is, change its state to a candidate state and become a candidate device.
[0069] Then, one of the multiple candidate devices in the first device group can be selected to become the new first master device. For example, the candidate device that initiates the election earliest among the multiple candidate devices can be determined as the first master device.
[0070] In this way, the first device with a higher device score is more likely to trigger the election process earlier and thus has a greater chance of becoming the new first master device.
[0071] As an optional embodiment, obtaining the actual timeout interval of each first device in the first device group includes:
[0072] Obtain a preset original timeout interval, which includes the minimum value and the maximum value of the original timeout interval;
[0073] Obtain the device score of a third device, wherein the third device is any one of the multiple first devices in the first device group;
[0074] The actual maximum timeout interval of the third device is determined based on the device score and the original maximum timeout interval.
[0075] The actual timeout interval of the third device is generated based on the minimum value of the original timeout interval and the maximum value of the actual timeout interval.
[0076] In this embodiment, a uniform original timeout interval [left1, right1] can be set for each first device in the first device group, with the minimum value of the original timeout interval being left1 and the maximum value being right1.
[0077] Then, taking the third device as an example, its device score is determined based on factors such as the current performance and reliability of the third device. Based on the device score of the third device and the maximum value of the original timeout interval, the maximum value of the actual timeout interval right2 is further calculated. Then, based on the minimum value of the original timeout interval left1 and the maximum value of the actual timeout interval right2, the actual timeout interval [left1, right2] of the third device is generated.
[0078] For example, the actual maximum timeout interval (right2) can be further calculated based on the device score of the third device and the original maximum timeout interval using the first calculation formula.
[0079] The first calculation formula is:
[0080] right2=right1-(right1-left1)X score / 100
[0081] Where right2 is the maximum value of the actual timeout interval, right1 is the maximum value of the original timeout interval, left1 is the minimum value of the original timeout interval, and score is the device score.
[0082] By using the above method to determine the actual timeout interval, terminal devices with higher equipment scores are more likely to be elected as the new primary master device, thereby enabling terminal devices with better performance to become the master devices and improving the stability of data aggregation and data reporting.
[0083] As an optional embodiment, obtaining the device score of the third device includes:
[0084] Obtain multiple device parameters of the third device, as well as the weight coefficients corresponding to each device parameter. The device parameters include online duration, available memory, available storage space, and number of available processor cores within a first time range.
[0085] The sum of the products of each of the device parameters and the corresponding weight coefficients is determined as the device score of the third device.
[0086] In this embodiment, the device score of a terminal device can be calculated using its device parameters and the corresponding weighting coefficients. Device parameters may include online duration, available memory, available storage space, and the number of available processor cores within a first time frame.
[0087] For example, the first time frame can be one week prior to the current moment. Within this first time frame, the weighting coefficient for online duration can be 0.5, the weighting coefficient for available memory can be 0.2, the weighting coefficient for available storage space can be 0.1, and the weighting coefficient for the number of available processor cores can be 0.2. 168 hours (7 days) of online time is the maximum score, as are 1GB of available memory, 1 available CPU core, and 1GB of available storage. The maximum score is set to 100 points.
[0088] If the third device has an online duration of 84 hours within the first time frame, 1GB of available memory, 1 available CPU core, and 1GB of available storage, then the device score for the third device is 75 points.
[0089] The device score obtained through the above calculation method can accurately represent the current performance and available computing power of the terminal device.
[0090] As an optional embodiment, sending the aggregated data to the server via the first master device includes:
[0091] When strong data consistency is required in the first device group, the aggregated data is written to the log file of the first master device;
[0092] The aggregated data is sent to each of the first following devices in the first device group;
[0093] If the number of response messages received by the first master device exceeds the second quantity threshold, the aggregated data is sent to the server. The response message is used to respond to the receipt of the aggregated data sent by the first master device.
[0094] In this embodiment, when the data of multiple first devices in the first device group requires strong consistency, it means that it is necessary to ensure that at any given time, the data on most devices in the first device group is the same and consistent.
[0095] If strong consistency is required for the data in the first device group, after the first master device completes the aggregation of indicator data and generates the aggregated data, the first master device can generate its own sequence number and term of office, and write the sequence number, term of office, and aggregated data together into the first master device's log file. The sequence number indicates which master device in the first target group it is, and the term of office indicates the duration of each master device's tenure.
[0096] In addition, to ensure strong data consistency, the first master device can also send the summary data to the first follower device with which it is connected. If the first follower device receives the summary data, it will write the summary data to its log file and send a response message back to the first master device. This response message is used to notify the first master device of its receipt of the summary data.
[0097] Therefore, each time the first master device receives a response message, it means that a first follower device has synchronized a summary data. Consequently, the first master device can compare the number of received response messages with a pre-set second threshold.
[0098] If the number of response messages exceeds the second threshold, it can be assumed that most of the first following devices have completed data synchronization with the first master device, and the first device group meets the strong consistency requirement. In this case, the first master device can send the summary data to the server. If the number of response messages is less than or equal to the second threshold, it can be assumed that the first device group does not meet the strong consistency requirement, and the first master device will not send the summary data to the server.
[0099] Furthermore, after data synchronization is complete and the first master device reports its data, it can submit the aggregated data locally and record the latest aggregated data in its own status file. Then, the first master device notifies all first follower devices to submit their data, and all first follower devices can also record the latest aggregated data in their own status files.
[0100] The above methods can ensure data consistency within the device group.
[0101] As an optional embodiment, before receiving the indicator data from N first follower devices via the first master device, the method further includes:
[0102] The fourth device sends its network identifier, group status, and device score to the server. The fourth device can be any device terminal that is connected to the server.
[0103] When the grouping status of the fourth device is ungrouped, the server receives the grouping information generated based on the network identifier and the device score.
[0104] Based on the grouping information, the device group to which the fourth device belongs is determined, and the device group includes the first device group.
[0105] In this embodiment, the service terminal communicating with the same server needs to send its network identifier, packet status, and device score to the server. The network identifier may include the fourth device's own IP address (Internet Protocol Address), port number, and NAT (Network Address Translation) type. The packet status indicates whether the fourth device is in a packet state.
[0106] After the fourth device sends the network identifier, group status, and device score to the server, the server can group all terminal devices with an ungrouped status based on the received information and pre-set grouping rules. Then, it generates group information based on the grouping results and pushes the group information to each terminal device. After each terminal device receives the group information from the server, it can determine its group according to the group information.
[0107] For example, the grouping rules can be that the number of terminal devices included in each device group is an odd number greater than 3, and the physical distance between any two terminal devices in the same device group must be less than a preset distance threshold. In addition, more than a certain proportion of terminal devices in each device group must have a device score greater than a score threshold.
[0108] This method allows for relatively quick grouping of devices.
[0109] Based on the data processing method provided in the above embodiments, this application also provides specific implementations of a data processing apparatus. Please refer to the following embodiments.
[0110] First see Figure 2 The data processing apparatus 200 provided in this application embodiment includes the following modules:
[0111] The receiving module 201 is used to receive indicator data of N first follower devices through the first master device, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, wherein N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices;
[0112] The aggregation module 202 is used to aggregate the indicator data of the N first follower devices and the indicator data of the first master device through the first master device when N is greater than or equal to a first quantity threshold, to obtain aggregated data;
[0113] The sending module 203 is used to send the aggregated data to the server through the first master device.
[0114] The device can collect metric data from each following device in the device group through the master device in the device group, summarize the metric data to obtain summary data, and then the master device reports the summary data to the server. In this way, compared with the existing technology, a device group only needs to make a data reporting request to the server once, and the server does not need to aggregate the collected metric data. This not only reduces the number of requests from terminal devices to the server, but also reduces the memory and processor requirements of the server, thus reducing the computing power requirements of the server.
[0115] As one implementation of this application, the data processing apparatus 200 may further include:
[0116] The acquisition module is used to acquire the actual timeout interval of each first device in the first device group;
[0117] The candidate module is used to determine the second device as a candidate device when the second device does not generate a heartbeat signal or receive a heartbeat signal sent by the first master device within a first time period threshold after the first moment. The second device is any one of the first devices in the first device group, the first moment is the moment when the heartbeat signal was most recently generated or received, and the first time period threshold is any time period in the actual timeout interval of the second device.
[0118] An election module is used to determine the first master device from among a plurality of candidate devices based on the actual timeout interval of each candidate device in the first device group.
[0119] As one implementation of this application, the above-mentioned acquisition module may further include:
[0120] The first acquisition unit is used to acquire a preset original timeout interval, wherein the original timeout interval includes the minimum value of the original timeout interval and the maximum value of the original timeout interval;
[0121] The second acquisition unit is used to acquire the device score of the third device, wherein the third device is any one of the multiple first devices in the first device group;
[0122] The first determining unit is configured to determine the actual maximum timeout interval of the third device based on the device score and the original maximum timeout interval.
[0123] A generation unit is used to generate the actual timeout interval of the third device based on the minimum value of the original timeout interval and the maximum value of the actual timeout interval.
[0124] As one implementation of this application, the second acquisition unit may further include:
[0125] The acquisition subunit is used to acquire multiple device parameters of the third device and the weight coefficients corresponding to each device parameter. The device parameters include online duration, available memory, available storage space and number of available processor cores within a first time range.
[0126] The scoring subunit is used to determine the equipment score of the third device by summing the products of each of the device parameters and the corresponding weight coefficients.
[0127] As one implementation of this application, the sending module 203 may further include:
[0128] The writing unit is used to write the aggregated data into the log file of the first master device when strong data consistency is required in the first device group.
[0129] The first sending unit is used to send the aggregated data to each of the first following devices in the first device group;
[0130] The second sending unit is configured to send the aggregated data to the server when the number of response messages received by the first master device exceeds a second quantity threshold. The response messages are used to respond to the receipt of the aggregated data sent by the first master device.
[0131] As one implementation of this application, the data processing apparatus 200 described above can also be used for:
[0132] The fourth device sends its network identifier, group status, and device score to the server. The fourth device can be any device terminal that is connected to the server.
[0133] When the grouping status of the fourth device is ungrouped, the server receives the grouping information generated based on the network identifier and the device score.
[0134] Based on the grouping information, the device group to which the fourth device belongs is determined, and the device group includes the first device group.
[0135] The data processing apparatus provided in this embodiment of the invention can implement the steps in the above method embodiments, and will not be repeated here to avoid repetition.
[0136] Figure 3 A schematic diagram of the hardware structure of the data processing device provided in an embodiment of this application is shown.
[0137] The data processing device may include a processor 301 and a memory 302 storing computer program instructions.
[0138] Specifically, the processor 301 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0139] Memory 302 may include mass storage for data or instructions. For example, and not limitingly, memory 302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 302 may include removable or non-removable (or fixed) media. Where appropriate, memory 302 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 302 is non-volatile solid-state memory.
[0140] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.
[0141] The processor 301 implements any of the data processing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 302.
[0142] In one example, the data processing device may further include a communication interface 303 and a bus 310. Wherein, as... Figure 3 As shown, the processor 301, memory 302, and communication interface 303 are connected through bus 310 and complete communication with each other.
[0143] The communication interface 303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0144] Bus 310 includes hardware, software, or both, that couples components of a data processing device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 310 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0145] The data processing device can be based on the above embodiments to realize the combination of the above data processing method and apparatus.
[0146] Furthermore, in conjunction with the data processing methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the data processing methods in the above embodiments and achieve the same technical effect. To avoid repetition, further details are omitted here. The aforementioned computer-readable storage medium may include non-transitory computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, etc., and is not limited thereto.
[0147] In addition, this application also provides a computer program product, including computer program instructions, which, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.
[0148] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0149] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0150] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0151] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0152] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A data processing method, characterized in that, The method is applied to a first group of devices, and the method includes: Obtain the actual timeout interval of each first device in the first device group; If the second device does not receive a heartbeat signal from the first master device within a first time threshold after the first moment, an election is initiated at any time node within the actual timeout interval. The second device that changes its state to a candidate state becomes a candidate device. The second device is any one of the first devices in the first device group. The first moment is the moment when the heartbeat signal was last received. The first time threshold is any time within the actual timeout interval of the second device. The candidate device that initiates the election earliest will be designated as the first master device; The first master device receives indicator data from N first follower devices, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, where N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices. When N is greater than or equal to the first quantity threshold, the first master device summarizes the indicator data of the N first follower devices and the indicator data of the first master device to obtain the summary data. The aggregated data is sent to the server via the first master device; The step of obtaining the actual timeout interval of each first device in the first device group includes: Obtain a preset original timeout interval, which includes the minimum value and the maximum value of the original timeout interval; Obtain the device score of a third device, wherein the third device is any one of the multiple first devices in the first device group; The actual maximum timeout interval of the third device is determined based on the device score and the original maximum timeout interval. The actual timeout interval of the third device is generated based on the minimum value of the original timeout interval and the maximum value of the actual timeout interval. The maximum actual timeout interval of the third device is calculated using the following formula: right2=right1-(right1-left1)Xscore / 100 Where right2 is the maximum value of the actual timeout interval, right1 is the maximum value of the original timeout interval, left1 is the minimum value of the original timeout interval, and score is the device score.
2. The data processing method according to claim 1, characterized in that, The process of obtaining the device score of the third device includes: Obtain multiple device parameters of the third device, as well as the weight coefficients corresponding to each device parameter. The device parameters include online duration, available memory, available storage space, and number of available processor cores within a first time range. The sum of the products of each of the device parameters and the corresponding weight coefficients is determined as the device score of the third device.
3. The data processing method according to claim 1, characterized in that, The step of sending the aggregated data to the server via the first master device includes: When strong data consistency is required in the first device group, the aggregated data is written to the log file of the first master device; The aggregated data is sent to each of the first following devices in the first device group; If the number of response messages received by the first master device exceeds the second quantity threshold, the aggregated data is sent to the server. The response message is used to respond to the receipt of the aggregated data sent by the first master device.
4. The data processing method according to claim 1, characterized in that, Before receiving the indicator data from N first follower devices via the first master device, the method further includes: The fourth device sends its network identifier, group status, and device score to the server. The fourth device can be any device terminal that is connected to the server. When the grouping status of the fourth device is ungrouped, the server receives the grouping information generated based on the network identifier and the device score. Based on the grouping information, the device group to which the fourth device belongs is determined, and the device group includes the first device group.
5. A data processing apparatus, characterized in that, The device is applied to a first group of devices, the device comprising: The acquisition module is used to acquire the actual timeout interval of each first device in the first device group; The candidate module is used to initiate an election at any time point within the actual timeout interval if the second device does not receive a heartbeat signal from the first master device within a first timeout threshold after the first moment. The second device that changes its state to the candidate state becomes the candidate device. The second device is any one of the first devices in the first device group, the first moment is the moment when the heartbeat signal was last received, and the first timeout threshold is any time within the actual timeout interval of the second device. The election module is used to determine the candidate device that initiates the election earliest as the first master device; The receiving module is configured to receive indicator data from N first follower devices through a first master device, wherein the first device group includes multiple first devices, the first device includes the first master device and P first follower devices, where N is a positive integer, P is a positive integer greater than or equal to N, and the P first follower devices include the N first follower devices; The aggregation module is used to aggregate the indicator data of the N first follower devices and the indicator data of the first master device when N is greater than or equal to a first quantity threshold, and obtain aggregated data. The sending module is used to send the aggregated data to the server via the first master device; The acquisition module includes: The first acquisition unit is used to acquire a preset original timeout interval, wherein the original timeout interval includes the minimum value of the original timeout interval and the maximum value of the original timeout interval; The second acquisition unit is used to acquire the device score of the third device, wherein the third device is any one of the multiple first devices in the first device group; The first determining unit is configured to determine the actual maximum timeout interval of the third device based on the device score and the original maximum timeout interval. The generation unit is used to generate the actual timeout interval of the third device based on the minimum value of the original timeout interval and the maximum value of the actual timeout interval; The maximum actual timeout interval of the third device is calculated using the following formula: right2=right1-(right1-left1)Xscore / 100 Where right2 is the maximum value of the actual timeout interval, right1 is the maximum value of the original timeout interval, left1 is the minimum value of the original timeout interval, and score is the device score.
6. A data processing device, characterized in that, The data processing device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the data processing method as described in any one of claims 1-4.
7. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the data processing method as described in any one of claims 1-4.
8. A computer program product, characterized in that, The computer program product includes computer program instructions, which, when executed by a processor, implement the data processing method according to any one of claims 1-4.
Citation Information
Patent Citations
Consistency verification method and system for real-time data aggregation
CN115190036A
Energy block parallel communication method and device
CN115664932A