Massive rule processing method and system based on internet of things platform, and storage medium

By calculating rule hash values ​​and performing striped partitioning in the IoT platform, only a portion of the rules are loaded into memory. Combined with message dispatching services for information distribution, the memory limitation problem of processing massive rules in the IoT platform is solved, and the processing efficiency is improved.

CN116303418BActive Publication Date: 2026-01-16E SURFING IOT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211644686.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2026-01-16
Estimated Expiration
2042-12-20

AI Technical Summary

Technical Problem

When processing massive amounts of rules, the limited server memory capacity of IoT platforms leads to reduced rule processing efficiency.

Method used

The rule distribution management service calculates the rule hash value and performs striping partitioning, loading only a portion of the rules into memory. Combined with the message dispatch service, information is distributed according to the user identifier, avoiding the loading of all rules.

Benefits of technology

It improves the processing efficiency of massive numbers of rules, reduces memory usage, and enhances the performance of the rule processing service.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116303418B_ABST
    Figure CN116303418B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a mass rule processing method and system based on an Internet of Things platform and a storage medium. The method belongs to the technical field of the Internet of Things and comprises the following steps: a rule distribution management service calculates rule hash values of each rule according to an obtained user identifier and saves the rule hash values to a database rule table; the rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service in a striping manner according to a preset hash partition rule, saves obtained rule configuration information, sends the rule configuration information to a corresponding rule processing service, and sends full-amount rule configuration information to a message dispatch service; the rule processing service loads rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information; and the message dispatch service distributes received reported information according to the full-amount rule configuration information and a user identifier in the reported information. The embodiment of the application can improve the processing efficiency of mass rules.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet of Things, and in particular to a mass rule processing method and system based on an Internet of Things platform and a storage medium. BACKGROUND

[0002] An Internet of Things platform generally has general basic capabilities such as terminal access, terminal management, message pushing, and a rule engine. After an Internet of Things terminal accesses the Internet of Things platform, a message pushing module pushes the message reported by the terminal to an Internet of Things application according to a user message pushing rule; or a rule engine module processes rules based on user customization to clean, filter, and process the information reported by the terminal.

[0003] The message pushing module and the rule engine module of the Internet of Things platform generally load the rules configured by the user into the memory to improve the rule calculation and processing efficiency. With the large-scale development of the Internet of Things, the number of terminals and applications accessing the Internet of Things platform is growing, and the messages reported by the terminal, the message pushing rules customized by the user, and the rules processed by the rule engine are increasing. The rule processing service is deployed in a cluster mode, and generally, the reported message is randomly sent to a rule processing service for processing. In order to ensure normal business, the rule processing service needs to load all rules into the memory, and the mass rule memory loading will limit the server memory capacity and reduce the rule processing efficiency. SUMMARY

[0004] Embodiments of the present application provide a mass rule processing method and system based on an Internet of Things platform and a storage medium, aiming to improve the processing efficiency of mass rules in the existing Internet of Things platform.

[0005] In a first aspect, embodiments of the present application provide a mass rule processing method based on an Internet of Things platform, which includes:

[0006] The rule distribution management service obtains a user identifier from a database rule table, calculates a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and saves the rule hash value to the database rule table;

[0007] The rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service in a striping manner according to the preset hash partition rule, and saves it to obtain rule configuration information;

[0008] The rule distribution management service sends the rule configuration information to the corresponding rule processing service, and sends the full rule configuration information to the message dispatch service;

[0009] The rule processing service loads the rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information.

[0010] The message dispatching service, if receiving the report information, dispatches the report information according to the full-amount rule configuration information and the user identifier in the report information.

[0011] In a second aspect, the embodiments of the present application further provide a mass rule processing system based on an Internet of Things platform, which comprises an acquisition computing unit and a first sending unit configured in a rule distribution management service, a first acquisition loading unit configured in a rule processing service, and a dispatching unit configured in a message dispatching service, wherein,

[0012] The acquisition computing unit is configured to acquire user identifiers from a database rule table by the rule distribution management service, and calculate rule hash values of each rule according to the user identifiers and a preset rule hash upper limit value, and save the rule hash values to the database rule table.

[0013] The generation saving unit is configured to generate rule hash partition lists required to be loaded by each rule processing service in a striping manner according to the preset hash partition rule by the rule distribution management service, and save the rule hash partition lists to obtain rule configuration information.

[0014] The first sending unit is configured to send the rule configuration information to the corresponding rule processing service by the rule distribution management service, and send full-amount rule configuration information to the message dispatching service.

[0015] The first acquisition loading unit is configured to acquire and load rules corresponding to the rule hash partition lists from the database rule table according to the rule configuration information by the rule processing service.

[0016] The dispatching unit is configured to dispatch the report information according to the full-amount rule configuration information and the user identifier in the report information by the message dispatching service if the message dispatching service receives the report information.

[0017] In a third aspect, the embodiments of the present application further provide a mass rule processing system based on an Internet of Things platform, which comprises a rule distribution management service, a rule processing service, and a message dispatching service, wherein the rule distribution management service, the rule processing service, and the message dispatching service each comprise a memory and a processor, the memory stores a computer program, and the processor of the rule distribution management service, the rule processing service, and the message dispatching service implements the above method when executing the computer program.

[0018] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program can implement the above method when executed by a processor.

[0019] The embodiment of the present application provides a mass rule processing method and system based on an Internet of Things platform and a storage medium. The method comprises the following steps: a rule distribution management service obtains a user identifier from a database rule table, calculates a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and saves the rule hash value to the database rule table; the rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service in a striping manner according to a preset hash partition rule, and saves the rule hash partition list to obtain rule configuration information; the rule distribution management service sends the rule configuration information to the corresponding rule processing service, and sends full-amount rule configuration information to a message dispatch service; the rule processing service loads rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information; and the message dispatch service distributes reported information according to the full-amount rule configuration information and the user identifier in the reported information if the reported information is received. According to the technical scheme of the embodiment of the present application, the rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service according to a preset rule hash upper limit value, and saves the rule hash partition list to obtain rule configuration information, so that each rule processing service only needs to load a part of rules to the memory, and does not need to load full-amount rules; when the message dispatch service receives reported information, the reported information is distributed according to the full-amount rule configuration information and the user identifier in the reported information, so that only the rule processing service with the user identifier processes the reported information, and therefore the processing efficiency of mass rules can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical scheme in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.

[0021] Figure 1 A timing diagram of a mass rule processing method based on an Internet of Things platform is provided for the embodiment of the present application.

[0022] Figure 2 A flowchart of a mass rule processing method based on an Internet of Things platform is provided for the embodiment of the present application.

[0023] Figure 3 A flowchart of a mass rule processing method based on an Internet of Things platform is provided for another embodiment of the present application.

[0024] Figure 4 A schematic block diagram of a mass rule processing system based on an Internet of Things platform is provided for the embodiment of the present application.

[0025] Figure 5 A schematic block diagram of a computer device according to an embodiment of the present application is provided. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of the present application.

[0027] It should be understood that the terms "comprise" and "include" as used in the specification and the appended claims indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0028] It should also be understood that the terms used in the present application specification are only for the purpose of describing particular embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, unless otherwise clearly indicated by the context, the singular forms "a", "an" and "the" are intended to include the plural forms as well.

[0029] It should be further understood that the term "and / or" as used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0030] As used in the present application specification and the appended claims, the term "if" can be interpreted as meaning "when" or "upon" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrases "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon detecting [a described condition or event]" or "in response to detecting [a described condition or event]" depending on the context.

[0031] Please refer to Figure 1 , Figure 1is a timing diagram of a mass rule processing method based on an Internet of Things platform provided by an embodiment of the present application. The mass rule processing system based on the Internet of Things platform comprises a rule distribution management service 10, a rule processing service 20 and a message dispatching service 30. The rule distribution management service 10 communicates with the rule processing service 30 to distribute rule configuration information to the rule processing service 20. The rule distribution management service 10 communicates with the message dispatching service 30 to send full-amount rule configuration information to the message dispatching service 30. The rule processing service 20 communicates with the message dispatching service 30 to receive the reporting information distributed by the message dispatching service 30.

[0032] Figure 2 is a flowchart of a mass rule processing method based on an Internet of Things platform provided by an embodiment of the present application. The mass rule processing method based on the Internet of Things platform of the embodiment of the present application can be applied to a rule processing system. For example, the mass rule processing method based on the Internet of Things platform can be realized by a software program configured on the rule processing system to improve the efficiency of rule processing. As shown in Figure 2 the method comprises the following steps S110-S150.

[0033] S110, the rule distribution management service obtains a user identifier from a database rule table, calculates a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and saves the rule hash value to the database rule table.

[0034] In the embodiment of the present application, a database rule table is created in a database service, mainly including a serial number, a user identifier, rule information, an update time, a hashTag and the like, wherein the hashTag is used to save a hashValue value corresponding to the rule, and the hashValue value is calculated based on the user identifier. Specifically, the rule distribution management service obtains the user identifier from the database rule table, and calculates a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value. More specifically, the user identifier is obtained, a first hash value is obtained by performing hash calculation on the user identifier through a hash algorithm; a second hash value is obtained by performing modulo calculation on the preset rule hash upper limit value after taking an absolute value of the first hash value, and the second hash value is taken as the rule hash value. For the convenience of understanding, it is assumed that the maximum number of rule processing service instances is SNmax; the preset rule hash upper limit value is hashMax, in order to improve the subsequent rule distribution balance rate, the preset rule hash upper limit value is set to be not less than 10 times of the rule processing service, that is, hashMax>=10*SNmax, the user identifier is uId, the rule hash value of each rule is hashValue, and hashValue=|hashCode(uId)|%hashMax, wherein the value space of hashValue is [0, hashMax), hashCode(uId) is the first hash value, and |hashCode(uId)| is the first hash value after taking an absolute value. After the rule hash value is calculated, the rule hash value is saved to the hashTag field in the database rule table. It should be noted that in the embodiment, the rule information field in the database rule table stores the rules corresponding to the hashValue value. Understandably, in the embodiment, the hashValue value needs to be calculated in order to facilitate subsequent partitioning of the hashValue value.

[0035] In S120, the rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service in a striping manner according to the preset hash fragmentation rule, and saves the rule hash partition list to obtain rule configuration information.

[0036] In the embodiment of the present application, the rule distribution management service identifies n rule processing services, and divides the range of the preset rule hash upper limit value into M rule hash partition lists, wherein m> n; the m rule hash partition lists are configured to the n rule processing services in a striping manner; for each rule processing service, the correspondence between the rule processing service and the rule hash partition list is saved to obtain rule configuration information. For the convenience of understanding, the steps of generating the rule hash partition list will be specifically introduced as follows:

[0037] (a) identifying the rule processing services, assuming that there are n rule processing services, each rule processing service is identified as S0, S1, S2,..., Sn, respectively, wherein n <= SNmax, and SNmax is the maximum number of rule processing service instances;

[0038] (b) dividing the hashValue value space [0, hashMax) into M hashRange, wherein M >= SNmax, hashMax is the preset rule hash upper limit value, and hashRange is the rule hash partition list. Understandably,

[0039] hashRange[0] = [0, hashMax / M];

[0040] hashRange[1] = [hashMax / M+1, 2*hashMax / M]; and so on until hashRange[M].

[0041] (c) configuring the M hashRange to the n rule processing services in a striping manner, that is, hashRange[0] is allocated to S0, hashRange[1] is allocated to S1, hashRange[n] is allocated to Sn, hashRange[n+1] is cyclically allocated to S1, and so on until the configuration of hashRange[M] is completed. Each rule processing service will be allocated at least one hashRange list.

[0042] (d) saving the relationship between each rule processing service and its hashRange list as rule configuration information.

[0043] It should be noted that in the present embodiment, the rule processing service list is provided in the rule distribution management service, the n rule processing services are managed by identifying the rule processing service list, and the subsequent expansion of the rule processing service is facilitated. M hashRange are obtained by dividing and fragmenting the rules, and the corresponding hashRange of each processing service is distributed, so that each rule processing service only needs to load a part of the rules into the memory, without loading the full amount of rules, thereby avoiding the memory capacity limitation of the rule processing service when processing a large amount of rules.

[0044] S130, the rule distribution management service sends the rule configuration information to the corresponding rule processing service, and sends the full amount of rule configuration information to the message dispatch service.

[0045] In the embodiment of the present application, after the rule distribution management service calculates the rule configuration information of each rule processing service, the rule distribution management service sends the rule configuration information to the corresponding rule processing service and sends the full rule configuration information to the message dispatch service. Understandably, the full rule configuration information is the sum of the rule configuration information.

[0046] In the embodiment of the present application, the rule processing service loads the rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information. Specifically, the rule processing service obtains the rule hash partition list from the rule configuration information, and obtains the rules corresponding to the rule hash partition list from the preset field of the database rule table for loading, wherein the preset field is hashTag. Understandably, the rule hash partition list contains multiple hashValue values, and the rule processing service can obtain multiple rules for loading from the multiple hashValue values.

[0047] In the embodiment of the present application, the rule processing service loads the rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information. Specifically, the rule processing service obtains the rule hash partition list from the rule configuration information, and obtains the rules corresponding to the rule hash partition list from the preset field of the database rule table for loading, wherein the preset field is hashTag. Understandably, the rule hash partition list contains multiple hashValue values, and the rule processing service can obtain multiple rules for loading from the multiple hashValue values.

[0048] In the embodiment of the present application, the message dispatch service distributes the report information according to the full rule configuration information and the user identifier in the report information if the message dispatch service receives the report information.

[0049] In the embodiment of the present application, if the message dispatch service receives the report information sent by the Internet of Things terminal, the message dispatch service obtains the user identifier from the report information, and obtains the rule hash value by performing hash calculation on the user identifier through a hash algorithm; the message dispatch service compares the rule hash value with the rule hash partition list in the full rule configuration information one by one to determine the rule hash partition list in which the rule hash value is located; and the message dispatch service distributes the report information to the rule processing service corresponding to the rule hash partition list. Specifically, the message dispatch service distributes the report information as follows:

[0050] (a) obtaining the user identifier uId from the report information;

[0051] (b) hashValue = | hashCode (uId) | % hashMax;

[0052] (c) comparing the hashRange list of each rule processing service through the rule configuration information in the rule service, and querying the rule processing service Sa whose hashRange range contains the hashValue;

[0053] (d) the message dispatching service sends the message to the rule processing service Sa for processing.

[0054] Figure 3 A flowchart of a massive rule processing method based on an Internet of Things platform according to another embodiment of the present application is shown in FIG. 6. In this embodiment, the method comprises steps S110-S190. That is, in this embodiment, the method further comprises steps S160-S190 after step S150 of the above embodiment. Figure 3

[0055] S160, the rule distribution management service scales the rule processing service to obtain a list of changed rule configuration information;

[0056] S170, the rule distribution management service sends the changed rule configuration information in the list of changed rule configuration information to the corresponding rule processing service, and sends the changed full-amount rule configuration information to the message dispatching service;

[0057] S180, the rule processing service loads the rule corresponding to the rule hash value from the database rule table according to the changed rule configuration information;

[0058] S190, the message dispatching service updates the full-amount rule configuration information according to the content in the changed full-amount rule configuration information.

[0059] ​In the embodiment of the present application, if a rule processing service is added, the rule distribution management service obtains the changed rule configuration information list by expanding the rule processing service, specifically, the rule distribution management service identifies the added rule processing service, and calculates the average number of rule hash partition lists that the added rule processing service can carry; the rule processing services are sorted from large to small according to the number of rule hash partition lists in each rule processing service to obtain a rule processing service sorting list; the rule distribution management service migrates the rule hash partition list on the rule processing service sorting list that meets the preset condition to the added rule processing service according to the average number of rule hash partition lists, until the number of rule hash partition lists on the added rule processing service is not less than the average number of rule hash partition lists, wherein the preset condition is that the number of rule hash partition lists on the rule processing service is greater than the average number of rule hash partition lists; the rule distribution management service saves the rule configuration information corresponding to the rule processing service to which the rule hash partition list is migrated to obtain the changed rule configuration information list. The rule distribution management service sends the changed rule configuration information in the changed rule configuration information list to the corresponding rule processing service, and sends the changed full-amount rule configuration information to the message dispatching service; the rule processing service loads the rule corresponding to the rule hash value from the database rule table according to the changed rule configuration information; the message dispatching service updates the full-amount rule configuration information according to the content in the changed full-amount rule configuration information. For the convenience of understanding, the steps of the expansion method are specifically introduced as follows by taking the addition of one rule processing service as an example:

[0060] (a) identify the added rule processing service as Sx, x is the total number of current rule processing services plus 1;

[0061] (b) add the newly added rule processing service Sx in the rule processing service list of the rule distribution management service;

[0062] (c) calculate the average number of rule hash partition lists carried by the added rule processing services S1, S2, …, Sx, wherein avgHashRange=M / total number of rule processing services, and M is the number of hash Range;

[0063] (d) sort the rule processing services from large to small according to the number of hashRange carried by each rule processing service to obtain a rule processing service sorting list listS;

[0064] (e) from the first rule processing service in the rule processing service ordering list listS, looply migrate hashRange on it to Sx one by one until the condition fx is met: the number of hashRange on Sx >= avgHashRange or the number of hashRange on the rule processing service <= avgHashRange;

[0065] (f) if the condition fx cannot be met, continue to select the next rule processing service from the rule processing service ordering list listS to perform the processing step in e) until fx is met or there is no rule processing service in listS;

[0066] (g) identify the rule processing service whose hashRange number has changed to the list listSc and the changed rule processing configuration information;

[0067] (h) send the rule processing configuration information of each rule processing service in listSc to the corresponding rule processing service one by one, and send all rule processing configuration information in listSc to the message dispatching service;

[0068] (i) the rule processing service receiving the rule configuration information loads and updates the rule according to the received rule configuration information, and the message dispatching service updates the full rule configuration information according to the rule content in listSc.

[0069] It should be noted that in the embodiment, the rule processing service can be expanded by the above expansion method, and the efficiency of rule processing can be further improved. It should be noted that in the embodiment, the database service, the rule distribution management service, the message dispatching service and each rule processing service are deployed on different virtual machines.

[0070] Figure 4 is a schematic block diagram of a mass rule processing system 200 based on an Internet of Things platform provided by an embodiment of the application. As shown in Figure 4 corresponding to the above mass rule processing method based on an Internet of Things platform applied to the rule distribution management service 10, the rule processing service 20 and the message dispatching service 30, the mass rule processing system 200 based on an Internet of Things platform includes units for executing the above mass rule processing method based on an Internet of Things platform. Specifically, please refer to Figure 4 , the mass rule processing system 200 based on an Internet of Things platform includes an acquisition calculation unit 101, a generation and saving unit 102 and a first sending unit 103 configured in the rule distribution management service 10, a first acquisition and loading unit 201 configured in the rule processing service 20 and a distribution unit 301 configured in the message dispatching service 30.

[0071] The obtaining and calculating unit 101 is configured to obtain a user identifier from a database rule table by a rule distribution management service, calculate a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and save the rule hash value to the database rule table; the generating and saving unit 102 is configured to generate a rule hash partition list required to be loaded by each rule processing service in a striping manner according to a preset hash partition rule by the rule distribution management service, and save the rule hash partition list to obtain rule configuration information; the first sending unit 103 is configured to send the rule configuration information to the corresponding rule processing service by the rule distribution management service, and send full-amount rule configuration information to a message dispatch service; the first obtaining and loading unit 201 is configured to obtain and load rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information by the rule processing service; and the distribution unit 301 is configured to distribute the reported information according to the full-amount rule configuration information and the user identifier in the reported information by the message dispatch service if the reported information is received.

[0072] In some embodiments, for example in the present embodiment, the obtaining and calculating unit 101 comprises a first calculating unit and a second calculating unit.

[0073] The first calculating unit is configured to obtain a user identifier, and calculate a first hash value by hashing the user identifier by a hash algorithm; and the second calculating unit is configured to calculate a second hash value by taking the remainder of the absolute value of the first hash value with respect to a preset rule hash upper limit value, and take the second hash value as a rule hash value.

[0074] In some embodiments, for example in the present embodiment, the generating and saving unit 102 comprises an identifying unit, a configuring unit and a first saving unit.

[0075] The identifying unit is configured to identify n rule processing services by the rule distribution management service, and divide a range of the preset rule hash upper limit value into M rule hash partition lists, where m≥n; the configuring unit is configured to configure m rule hash partition lists to n rule processing services in a striping manner; and the first saving unit is configured to save a correspondence between each rule processing service and the rule hash partition list to obtain rule configuration information.

[0076] In some embodiments, for example in the present embodiment, the first obtaining and loading unit 201 comprises an obtaining unit and a loading unit.

[0077] The obtaining unit is configured to obtain, by the rule processing service, the rule hash partition list from the rule configuration information.

[0078] In some embodiments, such as the present embodiment, the distribution unit 301 comprises a third calculation unit, a comparison unit and a distribution subunit.

[0079] The third calculation unit is configured to obtain the user identifier from the reporting information and obtain the rule hash value by performing hash calculation on the user identifier through a hash algorithm. The comparison unit is configured to compare the rule hash value with the rule hash partition list in the full-amount rule configuration information one by one to determine the rule hash partition list in which the rule hash value is located. The distribution subunit is configured to distribute the reporting information to the rule processing service corresponding to the rule hash partition list.

[0080] Another embodiment of the mass rule processing system 200 based on the Internet of Things platform comprises an expansion unit 104 and a second sending unit 105 configured in the rule distribution management service 10, a second obtaining and loading unit 202 configured in the rule processing service 20 and an updating unit 302 configured in the message dispatch service.

[0081] The expansion unit 104 is configured to expand the rule processing service by the rule distribution management service to obtain a list of changed rule configuration information. The second sending unit 105 is configured to send the changed rule configuration information in the list of changed rule configuration information to the corresponding rule processing service and send the changed full-amount rule configuration information to the message dispatch service. The second obtaining and loading unit 202 is configured to obtain and load the rule corresponding to the rule hash value from the database rule table according to the changed rule configuration information by the rule processing service. The updating unit 302 is configured to update the full-amount rule configuration information according to the content in the changed full-amount rule configuration information by the message dispatch service.

[0082] In some embodiments, such as the present embodiment, the expansion unit 104 comprises an identifier calculation unit, a sorting unit, a migration unit and a second saving unit.

[0083] The identification calculation unit is configured to identify the newly added rule processing service by the rule distribution management service, and calculate an average rule hash partition list number that can be carried by the newly added rule processing service; the sorting unit is configured to sort the rule processing services in descending order according to the rule hash partition list numbers in the rule processing services to obtain a rule processing service sorting list; the migration unit is configured to migrate, by the rule distribution management service, the rule hash partition list on the rule processing service sorting list that meets a preset condition to the newly added rule processing service according to the average rule hash partition list number, until the rule hash partition list on the newly added rule processing service is not less than the average rule hash partition list number; and the second saving unit is configured to save the rule configuration information corresponding to the rule processing service to which the rule hash partition list is migrated by the rule distribution management service to obtain a changed rule configuration information list.

[0084] It should be noted that the specific implementation process of the above-mentioned massive rule processing system based on the Internet of Things platform 200 and each unit can be clearly understood by those skilled in the art, which can be referred to the corresponding description in the foregoing method embodiments. For the convenience and brevity of description, it will not be repeated here.

[0085] The above-mentioned massive rule processing system based on the Internet of Things platform can be implemented in the form of a computer program, which can run on a computer device as shown in the accompanying drawings. Figure 5 The computer device can be a computer device 900 as shown in the accompanying drawings.

[0086] Please refer to Figure 5 , Figure 5 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 900 is a device on which a rule distribution management service, a rule processing service and a message dispatching service are built.

[0087] Referring to Figure 5 , the computer device 900 includes a processor 902, a memory and an interface 907 connected through a system bus 901, wherein the memory can include a storage medium 903 and an internal memory 904.

[0088] The storage medium 903 can store an operating system 9031 and a computer program 9032. When the computer program 9032 is executed, the processor 902 can execute a massive rule processing method based on an Internet of Things platform.

[0089] The processor 902 is configured to provide computing and control capabilities to support the operation of the entire computer device 900.

[0090] The memory 904 provides an environment for the running of the computer program 9032 in the storage medium 903, and the computer program 9032 is executed by the processor 902 to enable the processor 902 to perform the method for processing massive rules based on an Internet of Things platform.

[0091] The interface 905 is configured to communicate with other devices. Those skilled in the art can understand that the interface 905 can be implemented in various ways, for example, a wired interface or a wireless interface, which will not be described in detail herein. Figure 5 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device 900 to which the scheme of the present application is applied. Specifically, the computer device 900 can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0092] The processor 902 of each of the rule distribution management service, the rule processing service and the message dispatch service is configured to run the computer program 9032 stored in the memory to implement the flow steps of the embodiments of the method.

[0093] It should be understood that, in the embodiments of the present application, the processor 902 can be a central processing unit (CPU), and the processor 902 can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0094] Those of ordinary skill in the art can understand that all or part of the flow of the method described above can be completed by a computer program instructing related hardware. The computer program can be stored in a storage medium, which is a computer readable storage medium. The computer program is executed by at least one processor in the wireless communication system to implement the flow steps of the embodiments of the method.

[0095] Therefore, the present application also provides a storage medium. The storage medium can be a computer readable storage medium. The storage medium stores a computer program. The computer program is executed by the processor to enable the processor to perform any embodiment of the method for processing massive rules based on an Internet of Things platform.

[0096] The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various computer readable storage media that can store program codes.

[0097] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware, wireless communication software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in the above description in a general manner. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0098] In several embodiments provided by the present application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of each unit is only a logical functional division, and actual implementation can have another division. For example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not executed.

[0099] The steps in the method embodiments of the present application can be adjusted, combined and deleted in sequence according to actual needs. The units in the system embodiments of the present application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0100] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The wireless communication software product stored in a storage medium includes a plurality of instructions for causing a computer device (which can be a personal wireless communication terminal, a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application.

[0101] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0102] It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application cover modifications and variations of this application provided they come within the scope of the appended claims and their equivalents.

[0103] The above descriptions are only the specific embodiments of the application, but the protection scope of the application is not limited to this. Any skilled person in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the application, and these modifications or replacements should be covered in the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.

Claims

1. A mass rule processing method based on an Internet of Things platform, characterized in that, The method comprises the following steps: A rule distribution management service obtains a user identifier from a database rule table, calculates a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and saves the rule hash value to the database rule table; The rule distribution management service generates a rule hash partition list required to be loaded by each rule processing service in a striping manner according to a preset hash partition rule, and saves the rule hash partition list to obtain rule configuration information; The rule distribution management service sends the rule configuration information to the corresponding rule processing service, and sends full-amount rule configuration information to a message dispatching service; The rule processing service loads rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information; If the message dispatching service receives report information, the message dispatching service distributes the report information according to the full-amount rule configuration information and the user identifier in the report information; The step of distributing the report information according to the full-amount rule configuration information and the user identifier in the report information comprises the following steps: Obtaining the user identifier from the report information, and calculating the rule hash value by hashing the user identifier by using a hash algorithm; Comparing the rule hash value with the rule hash partition list in the full-amount rule configuration information one by one to determine the rule hash partition list where the rule hash value is located; Distributing the report information to the rule processing service corresponding to the rule hash partition list. 2.The method of claim 1, wherein, The step of calculating the rule hash value according to the user identifier and the preset rule hash upper limit value comprises the following steps: Obtaining the user identifier, and calculating a first hash value by hashing the user identifier by using a hash algorithm; Calculating a second hash value by taking the remainder of the absolute value of the first hash value with respect to the preset rule hash upper limit value, and taking the second hash value as the rule hash value. 3.The method of claim 1, wherein, The step of generating the rule hash partition list required to be loaded by each rule processing service in a striping manner according to the preset hash partition rule, and saving the rule hash partition list to obtain rule configuration information comprises the following steps: The rule distribution management service identifies n rule processing services, and divides the range of the preset rule hash upper limit value into M rule hash partition lists, wherein m≥n; The m rule hash partition lists are configured to the n rule processing services in a striping manner; For each rule processing service, the rule processing service and the corresponding relationship of the rule hash partition list are saved to obtain rule configuration information. 4.The method of claim 1, wherein, The step of loading rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information comprises the following steps: The rule processing service obtains the rule hash partition list from the rule configuration information; The rule processing service loads rules corresponding to the rule hash partition list from a preset field of the database rule table. 5.The method of claim 1, wherein, The method further comprises the following steps: The rule distribution management service obtains changed rule configuration information lists by scaling the rule processing services; The rule distribution management service sends the changed rule configuration information in the changed rule configuration information list to the corresponding rule processing service, and sends changed full-amount rule configuration information to the message dispatching service; The rule processing service loads rules corresponding to the rule hash value from the database rule table according to the changed rule configuration information; The message dispatching service updates the full-amount rule configuration information according to the content in the changed full-amount rule configuration information. 6.The method of claim 5, wherein, The rule distribution management service obtains changed rule configuration information lists by scaling the rule processing services, including: The rule distribution management service identifies the newly added rule processing services and calculates the average number of rule hash partition lists that the newly added rule processing services can carry; The rule processing services are sorted in descending order according to the number of rule hash partition lists in each rule processing service to obtain a rule processing service sorting list; The rule distribution management service migrates the rule hash partition lists on the rule processing service sorting list that meet the preset condition to the newly added rule processing services according to the average number of rule hash partition lists until the number of rule hash partition lists on the newly added rule processing services is not less than the average number of rule hash partition lists; The rule distribution management service saves the rule configuration information of the rule processing services that have migrated the rule hash partition lists to obtain changed rule configuration information lists.

7. A mass rule processing system based on an Internet of Things platform, characterized by, It includes: An acquisition calculation unit, a generation and saving unit, and a first sending unit configured in the rule distribution management service, a first acquisition and loading unit configured in the rule processing service, and an allocation unit configured in the message dispatching service, wherein The acquisition calculation unit is used for the rule distribution management service to acquire a user identifier from a database rule table, and to calculate a rule hash value of each rule according to the user identifier and a preset rule hash upper limit value, and to save the rule hash value to the database rule table; The generation and saving unit is used for the rule distribution management service to generate rule hash partition lists required to be loaded by each rule processing service in a striping manner according to a preset hash fragmentation rule, and to save to obtain rule configuration information; The first sending unit is used for the rule distribution management service to send the rule configuration information to the corresponding rule processing service, and to send full-amount rule configuration information to the message dispatching service; The first acquisition and loading unit is used for the rule processing service to load rules corresponding to the rule hash partition list from the database rule table according to the rule configuration information; The allocation unit is used for the message dispatching service to distribute the reported information according to the user identifier in the full-amount rule configuration information and the reported information if the reported information is received; The allocation unit includes: A third computing unit is configured to obtain the user identifier from the report information and perform hash calculation on the user identifier by using a hash algorithm to obtain the rule hash value; A comparison unit is configured to compare the rule hash value with rule hash partition lists in the full-amount rule configuration information one by one to determine the rule hash partition list where the rule hash value is located; An allocation subunit is configured to allocate the report information to the rule processing service corresponding to the rule hash partition list.

8. A mass rule processing system based on an Internet of Things platform, characterized by, The rule distribution management service, the rule processing service and the message dispatch service each include a memory and a processor, the memory stores a computer program, and the processor of the rule distribution management service, the rule processing service and the message dispatch service implements the method in any one of claims 1-6 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program can implement the method in any one of claims 1-6 when executed by the processor.

Citation Information

Patent Citations

  • Method for querying resolution server in Hash network and index server

    CN102427427A

  • Request processing method, device and system, storage medium and electronic equipment

    CN112988385A