A method to solve the data skew reported by IoT devices based on hotspot discovery

By introducing caching and hotspot weight statistical mechanisms into IoT devices and dynamically adjusting partition processing, the problem of device message data skew and disorder is solved, the balance and orderliness of data processing are achieved, and the throughput capacity of the IoT system is improved. .

CN116095170BActive Publication Date: 2024-10-08CHONGQING CLOUD KERNEL INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310079095.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2024-10-08
Estimated Expiration
2043-02-08

Smart Images

  • Figure CN116095170B_ABST
    Figure CN116095170B_ABST
Patent Text Reader

Abstract

The present application relates to a method for solving the problem of data skew reported by IoT devices based on hotspot discovery. The method introduces a cache as a tool for storing the instance rate, partition rate and device hotspot of IoT devices at the device message production and consumption ends, and uses the expiration time characteristics of the cache to realize the sticky partitioning of IoT devices. The dynamic decision partitioning mechanism based on sticky partitioning and hotspot weights can be used for the partitioning processing of device reported data in the field of IoT, improving processing efficiency while ensuring the orderliness and uniformity of data processing. In the IoT scenario, the problem is solved that when device data is reported to the server for processing, how can the server relatively evenly slice and process the reported data while maintaining the orderliness of the data and avoiding the problem of data skew? The method of using hotspot discovery to solve the problem of data skew reported by IoT devices realizes load balancing and stickiness maintenance of device data based on message queue partitions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of Internet of Things devices, and in particular to a method, device and control system for solving the problem of data skew reported by Internet of Things devices based on hotspot discovery. Background Art

[0002] In the IoT cluster scenario, in order to improve system throughput, after the device data is collected by the data collection end, multiple message consumers need to consume it at the same time. As a bridge connecting device message consumers and device message producers, the message queue will also divide different partitions within the queue for use by different consumer instances and producer instances in this scenario. However, in actual scenarios, different devices often report messages at different frequencies. If partitions are assigned according to devices, there will be a situation where hot data is tilted to certain partitions. In this case, some partitions will be overloaded, and even data will accumulate, reducing the overall system throughput.

[0003] In the prior art, the solution to solve the hotspot data skew is mainly to randomly assign partitions, that is, no partition is specified for each device message, and the message queue randomly selects partitions for assignment. However, the random selection of partitions by the message queue has the following technical problems:

[0004] The solution of randomly selecting and allocating partitions can solve the problem of data skew. At the same time, due to random allocation, the data of a device will be allocated to different partitions. Since different consumer instances process devices in parallel at different speeds, it is very easy to cause device messages to be out of order, resulting in a deviation between the device state and the actual state. This result is unacceptable in the IoT scenario, so it needs to be improved. Summary of the invention

[0005] In order to solve the above problems, the present application proposes a method, device and control system for solving the skew of data reported by IoT devices based on hotspot discovery.

[0006] On the one hand, the present application proposes a method for solving the data skew reported by IoT devices based on hotspot discovery, comprising the following steps:

[0007] Introduce cache as a tool to store the instance rate, partition rate and device hotspot of IoT devices at the device message production and consumption ends, and use the expiration time feature of cache to achieve sticky partitioning of IoT devices;

[0008] Configure the device stickiness time. If the IoT device does not report data within a stickiness time, it means that the stickiness fails and the device reselects a partition.

[0009] Configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to the preset conditions;

[0010] Device message partitions are performed based on the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and the device message partitions are sent to the message queue.

[0011] As an optional implementation scheme of the present application, optionally, the device hotspot weight reflects the weight of the device data relative to the average rate of the device in the entire system in the historical period, and its calculation process includes:

[0012] Device hotspot statistics start;

[0013] The device message consumer preloads and manages the basic device data in the cache;

[0014] When a device message is consumed, the device ID in the device message is compared with the device basic data in the cache to obtain the device consumption quantity;

[0015] Accumulate the device consumption quantity to obtain the device consumption quantity corresponding to all devices;

[0016] The device obtained from the cache and its device consumption quantity V i Substitute the number of devices n into the following formula to calculate the device hotspot weight W i :

[0017]

[0018] Calculate the statistical results of the device hotspot weights, and save the devices and their corresponding device hotspot weights to the cache;

[0019] Device hotspot statistics are complete.

[0020] As an optional implementation scheme of the present application, optionally, when the device and its corresponding device hotspot weight are saved to the cache, the saved device and its corresponding device hotspot weight are the highest values ​​in the current hotspot statistical period;

[0021] If there is a weight value in the next hotspot statistical period that is greater than the highest value in the current hotspot statistical period, the device hotspot weight in the cache is updated according to the weight value.

[0022] As an optional implementation scheme of the present application, optionally, the partition hotspot weight reflects the consumption pressure between different partitions and instances, and its calculation process includes:

[0023] Partition hotspot statistics start, and partition data is counted;

[0024] Count the consumption data volume of the partition in the hotspot statistics period and calculate the partition rate;

[0025] Count the consumption data volume of the instance in the hotspot statistics period and calculate the instance rate;

[0026] Store partition rate and instance rate in cache;

[0027] The partition hotspot statistics are completed.

[0028] As an optional implementation scheme of the present application, optionally, device message partitioning is performed according to the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and the device message partitions are sent to the message queue, including:

[0029] Device message partitioning starts, querying device stickiness data;

[0030] Based on the device stickiness data, determine whether there is a sticky partition:

[0031] If yes, the sticky partition ID is obtained from the cache, the sticky time is updated, and it is sent to the message queue partition, and the device message partition ends;

[0032] Otherwise, perform partition hotspot weight query.

[0033] As an optional implementation scheme of the present application, optionally, performing a partition hotspot weight query includes:

[0034] Query the partition rate to determine whether there is the latest partition rate data:

[0035] If yes, query the consumer instance rate and select the partition with the lowest consumption rate among the consumer instances with the lowest consumption instance rate;

[0036] The device ID and the corresponding partition ID corresponding to the selected lowest consumption rate partition are stored in the cache, the expiration time is set to the device stickiness time, and sent to the message queue partition, and the device message partition ends.

[0037] As an optional implementation scheme of the present application, optionally, performing a partition hotspot weight query also includes:

[0038] If the latest partition rate data does not exist, query the device hotspot weight;

[0039] Allocate partitions based on device hotspot weights;

[0040] The allocated device ID and the corresponding partition ID are stored in the cache, the expiration time is set to the device stickiness time, and sent to the message queue partition, and the device message partition ends.

[0041] On the other hand, the present application provides a device for implementing the method for solving the data skew reported by IoT devices based on hotspot discovery, including:

[0042] The sticky partition module is used to introduce cache as a tool for storing the instance rate, partition rate and device hotspot of IoT devices at the device message production and consumption ends, and to implement sticky partitioning of IoT devices by using the expiration time feature of the cache.

[0043] The device stickiness time configuration module is used to configure the device stickiness time. When the IoT device has no data to report within a stickiness time, it means that the stickiness fails and the device reselects a partition.

[0044] The hotspot statistics cycle configuration module is used to configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to preset conditions;

[0045] The device message partitioning module is used to partition the device messages according to the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and send the device message partitions to the message queue.

[0046] In another aspect, the present application further provides a control system, comprising:

[0047] processor;

[0048] a memory for storing processor-executable instructions;

[0049] Among them, the processor is configured to implement the method of solving the skew of data reported by Internet of Things devices based on hotspot discovery when executing the executable instructions.

[0050] Technical effects of the present invention:

[0051] This application introduces cache as a tool for storing the instance rate, partition rate and device hotspot of IoT devices at the device message production and consumption ends, and uses the expiration time characteristics of the cache to realize the sticky partition of IoT devices; configure the device stickiness time. When the IoT device has no data reported within a stickiness time, it means that the stickiness fails and the device reselects the partition; configure the hotspot statistical period, and set the period for the message consumer to perform partition hotspot weight and device hotspot weight statistics according to preset conditions; perform device message partitions based on the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and send the device message partitions to the message queue. The dynamic decision partitioning mechanism based on sticky partitions and hotspot weights can be used for device reported data partition processing in the field of IoT to improve processing efficiency while ensuring the orderliness and uniformity of data processing.

[0052] This application can solve the problem of how the server can maintain the order of data and perform relatively balanced sharding of reported data while avoiding data skew when the device data is reported to the server for processing in the IoT scenario. The method of using hotspot discovery to solve the skew of reported data of IoT devices is adopted to realize load balancing and stickiness maintenance of device data based on message queue partitions.

[0053] This application will periodically calculate the hotspot weight and partition rate of the device when consuming data. When the device data is reported, the partition decision mechanism is dynamically adjusted according to the hotspot weight and partition rate under the premise of ensuring the stickiness of the device data partition, to achieve fine-grained control of the device message partition, optimize the device data partition processing pressure, solve the data skew while ensuring the order of the device data, and improve the overall throughput of the IoT scenario.

[0054] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0056] Figure 1 A schematic diagram of an application framework for introducing a cache into the Internet of Things system of the present invention is shown;

[0057] Figure 2 It is a schematic diagram of the hotspot weight calculation process of the device of the present invention;

[0058] Figure 3 It is a schematic diagram of the partition hotspot weight calculation process of the present invention;

[0059] Figure 4 A schematic diagram of the process of device message partitioning according to the present invention is shown. DETAILED DESCRIPTION

[0060] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0061] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0062] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0063] The present invention periodically calculates the hotspot weight and partition rate of the device when consuming data. When the device data is reported, the partition decision mechanism is dynamically adjusted according to the hotspot weight and partition rate under the premise of ensuring the stickiness of the device data partition, so as to achieve fine-grained control of the device message partition, optimize the device data partition processing pressure, solve the data skew while ensuring the order of the device data, and improve the overall throughput of the Internet of Things scenario.

[0064] Example 1

[0065] On the one hand, the present application proposes a method for solving the data skew reported by IoT devices based on hotspot discovery, comprising the following steps:

[0066] 1. Introduce cache as a tool to store the instance rate, partition rate and device hotspots of IoT devices at the device message production and consumption ends, and use the expiration time feature of the cache to achieve sticky partitioning of IoT devices;

[0067] like Figure 1 The figure shows the architecture diagram of the IoT application system of this application. In the IoT message scenario with multiple consumers and multiple partitions, the cache is introduced as a tool for storing device message consumer instance rate, partition rate, and device hotspots at the device message production and consumption ends, and the expiration time characteristics of the cache are used to realize the sticky partitioning of the device.

[0068] The expiration time feature of the cache, that is, when the device stickiness time is reached, the cached data expires. By using the expiration time feature of the cache, the cache remains sticky while it exists and continues to be sent to the sticky partition. After the expiration, the cache no longer remains sticky and a new partition is selected for sending.

[0069] 2. Configure the device stickiness time. If the IoT device does not report data within a stickiness time, it means that the stickiness fails and the device reselects the partition.

[0070] Device stickiness time: the time that a device is fixed to the same partition. If a device does not report data within a stickiness time, it means that the stickiness fails and the device can reselect a partition. The stickiness cycle time should be at least greater than the device processing time.

[0071] In this embodiment, the device stickiness time is specifically determined by the user and is not limited in this embodiment.

[0072] 3. Configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to the preset conditions;

[0073] In this embodiment, the hotspot statistics period is the period for the message consumer to perform statistics on the partition hotspot weights and device hotspot weights. It can be set according to the actual scenario and is not limited in this embodiment.

[0074] 4. Device message partitions are performed based on the partition hotspot weights and device hotspot weights counted during the hotspot statistical period, and the device message partitions are sent to the message queue.

[0075] The present invention is based on dynamic balancing of hotspot weights and sticky partitioning, wherein hotspot balancing needs to rely on the advance calculation of device hotspot weights and partition hotspot weights for dynamic balancing.

[0076] Therefore, it is necessary to periodically calculate the hotspot weight and partition rate of the device when consuming data. When the device data is reported, the partition decision mechanism is dynamically adjusted according to the hotspot weight and partition rate under the premise of ensuring the stickiness of the device data partition, to achieve fine-grained control of the device message partition, optimize the device data partition processing pressure, solve the data skew while ensuring the order of the device data, and improve the overall throughput of the IoT scenario.

[0077] The following will describe in detail the advance calculation mechanism of the device hotspot weight and the partition hotspot weight.

[0078] like Figure 2 As shown, as an optional implementation scheme of the present application, optionally, the device hotspot weight reflects the weight of the device data relative to the average rate of the device in the entire system in the historical period, and its calculation process includes:

[0079] Device hotspot statistics start;

[0080] The device message consumer preloads and manages the basic device data in the cache;

[0081] When a device message is consumed, the device ID in the device message is compared with the device basic data in the cache to obtain the device consumption quantity;

[0082] Accumulate the device consumption quantity to obtain the device consumption quantity corresponding to all devices;

[0083] The device obtained from the cache and its device consumption quantity V i Substitute the number of devices n into the following formula to calculate the device hotspot weight W i :

[0084]

[0085] Calculate the statistical results of the device hotspot weights, and save the devices and their corresponding device hotspot weights to the cache;

[0086] Device hotspot statistics are complete.

[0087] The consumer will load and manage the basic device data in the cache in advance. When consuming a device message, it will compare the device identifier in the message with the data in the cache, and accumulate the device consumption quantity to obtain the corresponding consumption quantity of all devices. The statistical data is shown in Table 1:

[0088] Equipment identification Equipment consumption quantity Device A 100 Device B 200 Device C 300 Equipment D 100 Equipment E 200 Equipment F 300

[0089] Table 1---Statistics of equipment identification and equipment consumption quantity

[0090] Then the device obtained in the cache and the number of device data consumption V i Substitute the number of devices n into the formula to get the device hotspot weight W i :

[0091]

[0092] The calculated device hotspot weight statistics are saved in the cache, as shown in Table 2:

[0093] Equipment identification Device hotspot weight Device A 1 Device B 2 Device C 3 Equipment D 1 Equipment E 2 Equipment F 3

[0094] Table 2 --- Statistics of device identification and device hotspot weights

[0095] In this embodiment, the device hotspot weight is the highest value in the historical statistical period. If there is a higher weight value in the next period, the device hotspot weight value in the cache will be updated. The device hotspot weight has no expiration time and is always valid.

[0096] As an optional implementation scheme of the present application, optionally, when the device and its corresponding device hotspot weight are saved to the cache, the saved device and its corresponding device hotspot weight are the highest values ​​in the current hotspot statistical period;

[0097] If there is a weight value in the next hotspot statistical period that is greater than the highest value in the current hotspot statistical period, the device hotspot weight in the cache is updated according to the weight value.

[0098] In the current hotspot statistics cycle, after calculating the device hotspot weights of each device, find the device hotspot weight with the maximum value and use it as the device hotspot weight value in the cache of this cycle.

[0099] If in the next hotspot statistical cycle, a weight value greater than the device hotspot weight value in the cache of the current hotspot statistical cycle appears, the device hotspot weight value in the cache is replaced and updated.

[0100] like Figure 3 As shown, as an optional implementation scheme of the present application, optionally, the partition hotspot weight reflects the consumption pressure between different partitions and instances, and its calculation process includes:

[0101] Partition hotspot statistics start, and partition data is counted;

[0102] Count the consumption data volume N of partition i in the hotspot statistical period T i , substitute into calculate the partition rate P i :

[0103]

[0104] Count the consumption data volume M of instance i in the hotspot statistical period T i , substitute into the calculation instance rate I i :

[0105]

[0106] Store partition rate and instance rate in cache;

[0107] The partition hotspot statistics are completed.

[0108] The partition hotspot weight reflects the consumption pressure between different partitions and instances.

[0109] The partition hotspot weight is divided into partition rate and instance rate. The partition rate counts the consumption data volume of the partition during the hotspot statistical period, and the instance rate counts the consumption data volume of the instance during the hotspot statistical period, as shown in Table 3:

[0110]

[0111]

[0112] Table 3 - Statistics of instance rate and partition (consumption) rate

[0113] The partition hotspot weight statistics are saved to the cache. The partition hotspot weight information only saves the most recent cycle data.

[0114] like Figure 4 As shown, in the device message partitioning stage, the device message partitioning depends on the device hotspot weight data and partition hotspot weight data calculated in the periodic calculation stage.

[0115] As an optional implementation scheme of the present application, optionally, device message partitioning is performed according to the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and the device message partitions are sent to the message queue, including:

[0116] The device message partition starts, and the device stickiness data is queried, that is, the device's stickiness partition and stickiness time;

[0117] Determine whether the device has a sticky partition based on whether the sticky partition has been specified in the device sticky data:

[0118] If yes, the sticky partition ID is obtained from the cache, the sticky time is updated, and it is sent to the message queue partition, and the device message partition ends;

[0119] Otherwise, perform partition hotspot weight query.

[0120] Sticky partitions rely on the cache mechanism to be implemented. When the producer needs to send device data, it will query whether there is device sticky partition data in the cache, that is, whether the device has sticky partitions and sticky time, as shown in Table 4:

[0121]

[0122]

[0123] Table 4 - Sticky partition data statistics

[0124] If there is sticky partition data, the corresponding device is directly sent to the corresponding partition; if there is no sticky partition data, the partition selection is performed according to the hotspot partition strategy. Processing according to the sticky partition rules can ensure that within the sticky period, the device data of the same device can be processed in only one partition, thereby ensuring the order of device data consumption.

[0125] As an optional implementation scheme of the present application, optionally, performing a partition hotspot weight query includes:

[0126] Query the partition rate to determine whether there is the latest partition rate data:

[0127] If yes, query the consumer instance rate and select the partition with the lowest consumption rate among the consumer instances with the lowest consumption instance rate;

[0128] The device ID and the corresponding partition ID corresponding to the selected lowest consumption rate partition are stored in the cache, the expiration time is set to the device stickiness time, and sent to the message queue partition, and the device message partition ends.

[0129] like Figure 4 As shown in the figure, if there is no sticky partition data, the dynamic partition adjustment decision mechanism will be run. The dynamic partition decision will first query whether there is partition hotspot weight data in the cache. If not, it indicates that the system is in the startup phase or the message interruption phase. The system needs to re-plan data pre-allocation dynamically according to the device hotspot weight to minimize the sum difference of the pre-allocated weights of each partition.

[0130] The device weight data in Table 2 is taken out from the cache and dynamically allocated as shown in Table 5:

[0131]

[0132]

[0133] Table 5---Partition dynamic allocation mechanism table

[0134] As an optional implementation scheme of the present application, optionally, performing a partition hotspot weight query also includes:

[0135] If the latest partition rate data does not exist, query the device hotspot weight;

[0136] Allocate partitions based on device hotspot weights;

[0137] The allocated device ID and the corresponding partition ID are stored in the cache, the expiration time is set to the device stickiness time, and sent to the message queue partition, and the device message partition ends.

[0138] If there is no partition hotspot weight data, that is, there is no latest partition rate data, it indicates that the system is in the startup phase or message interruption phase. The system needs to re-plan data pre-allocation dynamically according to the device hotspot weight to minimize the sum difference of the pre-allocated weights of each partition.

[0139] If partition hotspot weight data exists, the lowest partition rate partition under the lowest instance partition rate is selected:

[0140] That is, from Table 3, partition A of instance A is selected as the distribution partition.

[0141] After allocation, the device and the corresponding partition information are stored in the cache as sticky partition data. The timeout period is the device stickiness time in the system parameters.

[0142] Therefore, this application improves processing efficiency while ensuring the orderliness and uniformity of data processing by applying a dynamic decision partitioning mechanism based on sticky partitioning and hotspot weights to the partitioning processing of device reported data in the field of the Internet of Things.

[0143] It should be noted that although the above-mentioned dynamic partitioning mechanism is introduced by taking the above-mentioned several devices as examples, those skilled in the art will understand that the present disclosure should not be limited thereto. In fact, the user can flexibly set the number of devices for periodic statistics according to the actual application scenario, as long as the technical functions of the present application can be realized according to the above-mentioned technical method.

[0144] Obviously, those skilled in the art should understand that the implementation of all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. Those skilled in the art can understand that the implementation of all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated as: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0145] Example 2

[0146] Based on the implementation principle of Example 1, on the other hand, the present application provides a device for implementing the method for solving the data skew reported by IoT devices based on hotspot discovery, including:

[0147] The sticky partition module is used to introduce cache as a tool for storing the instance rate, partition rate and device hotspot of IoT devices at the device message production and consumption ends, and to implement sticky partitioning of IoT devices by using the expiration time feature of the cache.

[0148] The device stickiness time configuration module is used to configure the device stickiness time. When the IoT device has no data to report within a stickiness time, it means that the stickiness fails and the device reselects a partition.

[0149] The hotspot statistics cycle configuration module is used to configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to preset conditions;

[0150] The device message partitioning module is used to partition the device messages according to the partition hotspot weights and device hotspot weights counted in the hotspot statistical period, and send the device message partitions to the message queue.

[0151] The functions of the above modules and the application interaction principles are described in detail in Example 1, and will not be repeated in this example.

[0152] The modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0153] Example 3

[0154] Furthermore, in another aspect, the present application also provides a control system, comprising:

[0155] processor;

[0156] a memory for storing processor-executable instructions;

[0157] Among them, the processor is configured to implement the method of solving the skew of data reported by Internet of Things devices based on hotspot discovery when executing the executable instructions.

[0158] The control system of the disclosed embodiment includes a processor and a memory for storing processor executable instructions. The processor is configured to implement any of the above-mentioned methods for solving the data skew reported by IoT devices based on hotspot discovery when executing the executable instructions.

[0159] Here, it should be noted that the number of processors can be one or more. At the same time, in the control system of the embodiment of the present disclosure, an input device and an output device may also be included. Among them, the processor, memory, input device and output device may be connected through a bus or in other ways, which are not specifically limited here.

[0160] As a computer-readable storage medium, the memory can be used to store software programs, computer executable programs and various modules, such as: the program or module corresponding to the method for solving the data skew reported by IoT devices based on hotspot discovery in the embodiment of the present disclosure. The processor executes various functional applications and data processing of the control system by running the software programs or modules stored in the memory.

[0161] The input device can be used to receive input numbers or signals. The signal can be a key signal related to user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.

[0162] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for solving the data skew reported by IoT devices based on hotspot discovery, characterized in that: The steps include: Introduce cache as a tool to store the instance rate, partition rate and device hotspot weight of IoT devices at the device message production and consumption ends, and use the cache expiration time feature to implement sticky partitioning of IoT devices; Configure the device stickiness time. If the IoT device does not report data within a stickiness time, it means that the stickiness fails and the device reselects a partition. Configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to the preset conditions; Sticky partitions are implemented by relying on a cache mechanism. When the production end needs to send a device message, it will query whether there is device sticky partition data in the cache, that is, whether the device has a sticky partition and sticky time; If sticky partition data exists, the sticky partition ID is obtained from the cache, the sticky time is updated, and the device message is sent to the message queue partition, and the device message partition ends; If there is no sticky partition data, the device message partition is performed according to the partition hotspot weight and device hotspot weight counted in the hotspot statistical period, and the device message is sent to the message queue partition.

2. According to the method of claim 1, which is based on hotspot discovery to solve the data skew reported by IoT devices, it is characterized in that: The device hotspot weight reflects the weight of the device data in the historical period relative to the average rate of the devices in the entire system. The calculation process includes: Device hotspot statistics start; The device message consumer preloads and manages the basic device data in the cache; When a device message is consumed, the device ID in the device message is compared with the device basic data in the cache to obtain the device consumption quantity; Accumulate the device consumption quantity to obtain the device consumption quantity corresponding to all devices; The device obtained from the cache and its device consumption quantity V i Substitute the number of devices n into the following formula to calculate the device hotspot weight W i : Calculate the statistical results of the device hotspot weights, and save the devices and their corresponding device hotspot weights to the cache; Device hotspot statistics are complete.

3. According to claim 2, a method for solving the skew of data reported by IoT devices based on hotspot discovery is characterized in that: When the device and its corresponding device hotspot weight are saved in the cache, the saved device and its corresponding device hotspot weight are the highest values ​​in the current hotspot statistical period; If there is a weight value in the next hotspot statistical period that is greater than the highest value in the current hotspot statistical period, the device hotspot weight in the cache is updated according to the weight value.

4. According to the method of claim 1, which is based on hotspot discovery to solve the data skew reported by IoT devices, it is characterized in that: The partition hotspot weight reflects the consumption pressure between different partitions and instances. The calculation process includes: Partition hotspot statistics start, and partition data is counted; Count the consumption data volume of the partition in the hotspot statistics period and calculate the partition rate; Count the consumption data volume of the instance in the hotspot statistics period and calculate the instance rate; Store partition rate and instance rate in cache; The partition hotspot statistics are completed.

5. According to the method of claim 1, which is based on hotspot discovery to solve the data skew reported by IoT devices, it is characterized in that: Device message partitions are performed based on the partition hotspot weights and device hotspot weights counted in the hotspot statistics period, and device messages are sent to the message queue partitions, including: First, query the partition hotspot weight: Query the partition rate to determine whether the latest partition rate data exists, including: If the latest partition rate data exists, query the consumer instance rate and select the partition with the lowest consumption rate among the consumer instances with the lowest consumption instance rate; The device ID and the corresponding partition ID corresponding to the selected lowest consumption rate partition are stored in the cache, the expiration time is set to the device stickiness time, and the device message is sent to the message queue partition, and the device message partition ends.

6. According to the method of claim 5, which is characterized in that: Query the partition rate to determine whether there is the latest partition rate data, including: If the latest partition rate data does not exist, query the device hotspot weight; Allocate partitions based on device hotspot weights; The allocated device ID and the corresponding partition ID are stored in the cache, the expiration time is set to the device stickiness time, and sent to the message queue partition, and the device message partition ends.

7. A device for implementing the method for solving the skew of data reported by IoT devices based on hotspot discovery as described in any one of claims 1 to 6, characterized in that: include: The sticky partition module is used to introduce cache as a tool for storing the instance rate, partition rate and device hotspot weight of IoT devices at the device message production and consumption ends, and use the expiration time feature of the cache to implement the sticky partition of IoT devices; sticky partition relies on the cache mechanism for implementation. When the production end needs to send a device message, it will query whether there is device sticky partition data in the cache, that is, whether the device has a sticky partition and sticky time; if there is sticky partition data, the sticky partition ID is obtained from the cache, the sticky time is updated, and the device message is sent to the message queue partition, and the device message partition ends; The device stickiness time configuration module is used to configure the device stickiness time. If the IoT device has no data to report within a stickiness time, it means that the stickiness fails and the device reselects a partition. The hotspot statistics cycle configuration module is used to configure the hotspot statistics cycle and set the period for the message consumer to perform statistics on the partition hotspot weight and device hotspot weight according to preset conditions; The device message partitioning module is used to partition the device messages according to the partition hotspot weights and device hotspot weights counted in the hotspot statistical period if there is no sticky partition data, and send the device messages to the message queue partition.

8. A control system, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement a method for solving the skew of data reported by IoT devices based on hotspot discovery as described in any one of claims 1 to 6 when executing the executable instructions.