Message processing method and device, electronic equipment and storage medium
By introducing a layered architecture for message connection clusters and processing clusters, and filtering and routing messages according to their importance and reliability requirements, the performance bottleneck caused by a single cluster in IoT systems is solved, and efficient message forwarding is achieved.
Patent Information
- Application Number
- CN202511065264.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-07
AI Technical Summary
In existing IoT systems, as the number of devices and business demands increase, a single cluster can easily become a performance bottleneck in message forwarding and processing, leading to message transmission delays and loss.
A layered architecture of message connection clusters and message processing clusters is introduced. The message connection clusters distribute business request messages to different message queues and servers, and filter and distribute messages according to their importance and reliability requirements, and process them using multiple clusters.
It effectively avoids the bottleneck of a single cluster under high load, reduces the risk of message delay and loss, and optimizes message forwarding in IoT systems.
Smart Images

Figure CN120915754A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of request processing, and in particular to a message processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] In an Internet of Things system, as the number of devices and services accessing the Internet of Things system increases, the amount of messages also increases. In the message forwarding process, a single cluster is generally used in existing solutions to process a large number of messages. This solution can work normally in a low-load situation, but as the number of devices increases and the complexity of service requirements increases, the single cluster is likely to become a performance bottleneck, resulting in delays in message transmission, and even problems such as message loss or system crashes. Therefore, how to optimize message forwarding in an Internet of Things system has become a problem to be solved. SUMMARY
[0003] The main purpose of the embodiments of the present application is to provide a message processing method and device, electronic equipment and storage medium, which aims to optimize message forwarding in an Internet of Things system.
[0004] To achieve the above purpose, a first aspect of the embodiments of the present application provides a message processing method, which comprises:
[0005] In response to a service request message, the service request message is sent to a message connection cluster;
[0006] The service request message is distributed to a message processing cluster through the message connection cluster;
[0007] The service request message is sent to a service server through the message processing cluster;
[0008] The service request message is processed by the service server.
[0009] In some embodiments, the message processing cluster includes a first message queue and a second message queue, the first message queue corresponds to a first receiving level, and the second message queue corresponds to a second receiving level; the service request message is distributed to the message processing cluster through the message connection cluster, which comprises:
[0010] The message delivery level of the service request message is obtained;
[0011] The first message queue and the second message queue are screened according to the message delivery level, the first receiving level and the second receiving level to obtain a target message queue;
[0012] The service request message is sent to the target message queue through the message connection cluster.
[0013] In some embodiments, the service server is one of the following: the first server or the second server; and the sending of the service request message to the service server through the message processing cluster comprises:
[0014] If the message receiving level corresponding to the target message queue is the first receiving level, the service request message is sent to the first server through the target message queue in a message non-reliable manner.
[0015] If the message receiving level corresponding to the target message queue is the second receiving level, the service request message is sent to the second server through the target message queue in a message reliable hierarchical manner.
[0016] In some embodiments, the sending of the service request message to the second server through the target message queue in a message reliable hierarchical manner comprises:
[0017] Performing message importance evaluation on the service request message to obtain a message importance.
[0018] If the message importance is within a preset first importance range, the service request message is sent to the second server in a direct reliable manner through a first port of the target message queue.
[0019] If the message importance is within a preset second importance range, the service request message is sent to the second server in a load balancing reliable manner through a second port of the target message queue; wherein the bandwidth of the first port is greater than that of the second port.
[0020] If the message importance is within a preset third importance range, the service request message is sent to the second server in a load balancing reliable manner through a third port of the target message queue; wherein the bandwidth of the second port is greater than that of the third port.
[0021] In some embodiments, the message importance evaluation on the service request message comprises:
[0022] Obtaining field data of the service request message.
[0023] According to the matching of the field data and a preset service matching rule, the message importance of the service request message is obtained.
[0024] In some embodiments, the method further comprises:
[0025] Detecting the computing resources of the second message queue to obtain a computing resource pressure value.
[0026] If the computing resource pressure value is greater than a preset pressure value, a configuration modification is performed on the first message queue, so that the first message queue is used as a second message queue.
[0027] In some embodiments, the detecting the computing resource of the second message queue obtains a computing resource pressure value, including:
[0028] The detecting the computing resource of the second message queue obtains a concurrent message amount, a total message amount and a message delay;
[0029] According to a preset resource pressure rule and the concurrent message amount, the total message amount and the message delay, a calculation is performed to obtain the resource pressure value.
[0030] To achieve the above object, a second aspect of the embodiments of the present application provides a message processing device, which comprises:
[0031] A first sending module is configured to send a service request message to a message connection cluster in response to the service request message;
[0032] A message distribution module is configured to distribute the service request message to a message processing cluster through the message connection cluster;
[0033] A second sending module is configured to send the service request message to a service server through the message processing cluster;
[0034] A message processing module is configured to perform message processing on the service request message through the service server.
[0035] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the method of the first aspect when executing the computer program.
[0036] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of the first aspect.
[0037] The message processing method and device, electronic equipment and storage medium provided by the present application are used for responding to a service request message, sending the service request message to a message connection cluster, distributing the service request message to a message processing cluster through the message connection cluster, sending the service request message to a service server through the message processing cluster, and performing message processing on the service request message through the service server. In this way, the hierarchical architecture of the message connection cluster and the message processing cluster is introduced, the service request message can be effectively distributed to multiple clusters for processing, the single cluster is avoided from becoming a bottleneck in the case of high load, and the risk of delay or message loss is reduced, thereby optimizing the message forwarding in the Internet of Things system. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 is a flowchart of the message processing method provided by the present application;
[0039] Figure 2 is a flowchart of step S102 in Figure 1
[0040] Figure 3 is a flowchart of step S103 in Figure 1
[0041] Figure 4 is a flowchart of step S302 in Figure 3
[0042] Figure 5 is a flowchart of step S401 in Figure 4
[0043] Figure 6 is a flowchart of the message processing method provided by another embodiment of the present application;
[0044] Figure 7 is a flowchart of step S601 in Figure 6
[0045] Figure 8 is a structural schematic diagram of the message processing device provided by the present application;
[0046] Figure 9 is a hardware structural schematic diagram of the electronic equipment provided by the present application;
[0047] Figure 10 is an Internet of Things message queue architecture diagram provided by the present application. DETAILED DESCRIPTION
[0048] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.
[0049] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a manner different from the module division in the device or the sequence in the flowchart. The terms "first", "second", etc. in the specification and claims and the above-described drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0051] First, the meanings of several terms involved in the present application are analyzed:
[0052] QoS0: is a quality of service level in the MQTT protocol, which means that the delivery of messages is "at most once", that is, the message will be sent as much as possible, but no confirmation will be made, nor will it be retried. In other words, QoS0 guarantees that messages will be sent only once, and the receiving party will not send any confirmation reply, and message loss or repetition is allowed. This quality of service level is suitable for scenarios that have no strict requirements for message loss and want to reduce network transmission burden, such as sensor status update, real-time data stream, etc. QoS0 focuses on communication efficiency, but cannot guarantee that every message will be successfully delivered.
[0053] QoS1: is one of the quality of service levels in the MQTT protocol, which means that the message will be "sent at least once", that is, the message will be sent and the receiving party will receive at least one confirmation. In order to ensure the successful delivery of messages, the sender will retry if no confirmation is received. This means that even if the network has a delay or loss, the message will eventually reach the receiving party, but there may be repeated messages. It is suitable for scenarios that require high reliability but can tolerate a small amount of message repetition, such as status update, command control, etc. QoS1 is more reliable than QoS0, but correspondingly increases network overhead and delay.
[0054] QoS2: is the highest quality of service level in the MQTT protocol, indicating that the delivery of messages is "once only", that is, to ensure that each message will only be received by the recipient once, and during the entire delivery process, the message will not be lost or repeated. In order to achieve this goal, QoS2 uses a four-phase handshake protocol to ensure the reliable delivery of messages, including sending, confirming, receiving, and finally confirming the receipt. This way provides the most reliability, suitable for those who have very high requirements for message accuracy, such as financial transactions, important instructions, etc. However, due to the need for multiple interactions of QoS2, its network overhead is large, and the transmission delay is relatively high, so it is suitable for scenarios that have strict requirements for message reliability and can accept certain delays.
[0055] Message queue: refers to a mechanism for storing messages in a computer system, which can help different systems, applications or components exchange information asynchronously. Message queue can save messages in a queue, the sender puts messages into the queue, and the receiver gets messages from the queue and processes them. Message queue is usually applied to decoupling, flow control, reliability guarantee, etc. It is an important part of distributed systems, which can ensure communication between producers and consumers without time and space constraints, providing an efficient and reliable message delivery method. Message queue can be applied in various scenarios, such as real-time data processing, task scheduling, log collection, etc.
[0056] In the Internet of Things system, as the number of devices and services accessing the Internet of Things system increases, the amount of messages also increases. In the message forwarding process, the existing scheme generally uses a single cluster to process a large number of messages. This scheme can work normally in low load conditions, but as the number of devices increases and the complexity of business requirements increases, a single cluster is easy to become a performance bottleneck, causing message transmission delays, and even message loss or system crashes. Therefore, how to optimize message forwarding in the Internet of Things system has become a problem to be solved.
[0057] Based on this, the embodiments of the present application provide a message processing method and device, electronic equipment and storage medium, aiming to optimize message forwarding in the Internet of Things system.
[0058] The message processing method and device, electronic equipment and storage medium provided by the embodiments of the present application are specifically explained by the following embodiments, first describe the message processing method in the embodiments of the present application.
[0059] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. The artificial intelligence (AI) is a theory, method, technology and application system for simulating, extending and expanding human intelligence by using a digital computer or a machine controlled by a digital computer, perceiving an environment, acquiring knowledge and using the knowledge to obtain optimal results.
[0060] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric identification technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0061] The message processing method provided by the embodiments of the present application relates to the technical field of request processing. The message processing method provided by the embodiments of the present application can be applied in a terminal, can also be applied in a server end, and can also be software running in the terminal or the server end. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc.; the server end can be configured as an independent physical server, can also be configured as a server cluster or a distributed system composed of multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and big data and artificial intelligence platform; and the software can be an application for implementing the message processing method, but is not limited to the above forms.
[0062] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0063] It should be noted that in various specific embodiments of the present application, when relevant processing needs to be performed on data related to the identity or characteristics of the user, such as user information, user behavior data, user history data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain sensitive personal information of the user, the separate permission or separate consent of the user will be obtained through a pop-up window or a jump to a confirmation page, and after obtaining the separate permission or separate consent of the user, the necessary user-related data for the normal operation of the embodiments of the present application will be obtained.
[0064] Figure 1 is an optional flowchart of the message processing method provided by the embodiments of the present application, Figure 1 The method in the step S101-S104 can include but not limited to.
[0065] In step S101, in response to a service request message, the service request message is sent to a message connection cluster.
[0066] In step S102, the service request message is distributed to a message processing cluster through the message connection cluster.
[0067] In step S103, the service request message is sent to a service server through the message processing cluster.
[0068] In step S104, the service request message is processed by the service server.
[0069] The steps S101-S104 shown in the embodiments of the present application are as follows: in response to a service request message, the service request message is sent to a message connection cluster; the service request message is distributed to a message processing cluster through the message connection cluster; the service request message is sent to a service server through the message processing cluster; and the service request message is processed by the service server. In this way, by introducing the hierarchical architecture of the message connection cluster and the message processing cluster, the embodiments of the present application can effectively distribute the service request message to multiple clusters for processing, avoid the single cluster from becoming a bottleneck in the case of high load, and thus reduce the risk of delay or message loss, thereby optimizing the message forwarding in the Internet of Things system.
[0070] Please refer to Figure 10 In step S101 of some embodiments, the service request message is a message sent by each device in the Internet of Things system. For example, camera alarm information, for example, camera access networking message, for example, scan payment information.
[0071] When a device sends a request, that is, sends a service request message, in response to the service request message, the service request message is sent to the message connection cluster of the Internet of Things server connection cluster.
[0072] The message connection cluster is composed of a cluster of RabbitMQ, and is used for preliminary shunting of the service request message to each message processing cluster.
[0073] Referring to Figure 2 In some embodiments, the message processing cluster includes a first message queue and a second message queue, the first message queue corresponding to a first receiving level, and the second message queue corresponding to a second receiving level; step S102 can include but is not limited to steps S201 to S203:
[0074] Step S201, obtaining a message delivery level of the service request message;
[0075] Step S202, screening the first message queue and the second message queue according to the message delivery level, the first receiving level and the second receiving level to obtain a target message queue;
[0076] Step S203, sending the service request message to the target message queue through the message connection cluster.
[0077] The steps S201 to S203 shown in the embodiments of the present application can screen the message queue according to the message delivery level, the first receiving level and the second receiving level, and send the service request message to the target message queue, so that the messages can be shunted according to the importance of the messages, important messages will not be lost, and unimportant messages will not cause system congestion.
[0078] In step S201 of some embodiments, as shown in Figure 10 The message delivery level can be divided into three levels of QoS0, QoS1 and QoS2. QoS0 means that the message is delivered at most once without retry. QoS1 means that the message is delivered at least once and is confirmed. QoS2 means that the message is delivered only once to ensure no repetition and no loss.
[0079] The first receiving level corresponds to QoS0, and is usually used to deliver messages that are more tolerant to message loss, such as environmental monitoring data or status update information sent at regular intervals.
[0080] The second receiving level corresponds to QoS1 and QoS2, and is usually used to deliver messages that have higher requirements for message reliability, such as important information such as remote control commands and alarm notifications, which need to be ensured to be delivered and error-free.
[0081] As Figure 10 shown, the first message queue corresponds to the IoT server QoS0 message cluster. The second message queue corresponds to the IoT message queue QoS1 message cluster and the IoT message queue QoS2.
[0082] In step S202 of some embodiments, the screening process is to select the first message queue and the second message queue according to the delivery level of the message, the first receiving level and the second receiving level. For example, assuming that the message delivery level of a service request message is QoS1, the receiving level of the first message queue is QoS0, and the receiving level of the second message queue is QoS1 and QoS2, at this time the target message queue is the second message queue.
[0083] Referring to Figure 3 In some embodiments, the service server is one of the following: the first server or the second server; step S103 can include but is not limited to steps S301-S302:
[0084] Step S301, if the message receiving level corresponding to the target message queue is the first receiving level, the service request message is sent to the first server through the target message queue in a message non-reliable manner;
[0085] Step S302, if the message receiving level corresponding to the target message queue is the second receiving level, the service request message is sent to the second server through the target message queue in a message reliable hierarchical manner.
[0086] The steps S301-S302 shown in the embodiments of the present application, if the message receiving level corresponding to the target message queue is the first receiving level, the service request message is sent to the first server through the target message queue in a message non-reliable manner, if the message receiving level corresponding to the target message queue is the second receiving level, the service request message is sent to the second server through the target message queue in a message reliable hierarchical manner, thereby message is shunted, for the message that does not need reliable transmission, the sending mode with small calculation resource consumption is adopted, for the message that needs reliable transmission, the sending mode with large calculation resource consumption is adopted, so that important messages will not be lost, and unimportant messages will not cause system congestion.
[0087] In step S301 of some embodiments, if the message receiving level corresponding to the target message queue is the first receiving level, that is, the target message queue corresponds to the QoS0 message, then the service request message is sent to the first server through the target message queue once, and no confirmation information is required.
[0088] Referring to Figure 4In some embodiments, step S302 can include, but is not limited to, steps S401-S404:
[0089] Step S401, message importance evaluation is performed on the service request message to obtain a message importance;
[0090] Step S402, if the message importance is within a preset first importance range, the service request message is directly and reliably sent to the second server through a first port of the target message queue;
[0091] Step S403, if the message importance is within a preset second importance range, the service request message is load-balanced and reliably sent to the second server through a second port of the target message queue; wherein the bandwidth of the first port is greater than that of the second port;
[0092] Step S404, if the message importance is within a preset third importance range, the service request message is load-balanced and reliably sent to the second server through a third port of the target message queue; wherein the bandwidth of the second port is greater than that of the third port.
[0093] The steps S401-S404 shown in the embodiments of the present application, by performing message importance evaluation on the service request message and selecting different message transmission ports according to different message importance ranges, the priority transmission of the message is realized. By preferentially transmitting the high importance message to the port with larger bandwidth, it is ensured that these important messages can quickly reach the server under efficient and reliable conditions. For low importance messages, the smaller bandwidth port is used for processing, which optimizes the allocation of system resources and transmission efficiency.
[0094] Please refer to Figure 5 In some embodiments, step S401 includes, but is not limited to, steps S501-S502:
[0095] Step S501, field data of the service request message is obtained;
[0096] Step S502, the field data is matched with a preset service matching rule to obtain the message importance of the service request message.
[0097] The steps S501-S502 shown in the embodiments of the present application, by obtaining the field data of the service request message and matching the field data according to the preset service matching rule, the message importance of the service request message is obtained.
[0098] In step S501 of some embodiments, the field data can include, but is not limited to, a subscription topic and a service-related level information in the service request message. Specifically, the subscription topic can be user behavior, commodity purchase, payment request, etc., which represent different types of messages in the service request. According to different nature of the service, the service level is also different. For example, the registration service is usually considered as low priority, while the payment service usually belongs to high priority.
[0099] In step S502 of some embodiments, the service matching rule is a set of rules for evaluating the importance of the message according to the preset condition by analyzing the field data in the service request message when processing the service request message, which is used to assign appropriate priority to the message.
[0100] For example, if the topic of the service request message is "payment request", the message will be automatically evaluated as high priority. While the message with the topic of "browsing record" is evaluated as low priority.
[0101] The way to get the importance of the service request message can adopt a weighted method based on the field data, or judge the overall importance of the message by taking the maximum value of the topic and the service level, or assign points to each field and finally take the highest score field.
[0102] In step S402 of some embodiments, the preset first importance range refers to the service request message with the highest priority, and the first port has the highest bandwidth compared to the second port and the third port, which can support the fastest message transmission. Direct reliable sending refers to that the first port directly sends the service request information to the second server without load balancing.
[0103] It should be noted that the second server can be a computer cluster, and the first port corresponds to a specific computer A in the computer cluster. In the computer cluster, the second port and the third port correspond to computers other than A in the computer cluster. That is, the first port has the highest bandwidth and corresponds to a computer that belongs to the first port only, so as to realize the highest bandwidth and the highest computing resources to process the service request message.
[0104] It should be noted that the direct reliable sending does not need to go through load balancing, thereby improving the processing speed of the message.
[0105] It should be noted that the direct reliable sending refers to QoS1 or QoS2 sending to ensure that the service request message will be processed by the second server.
[0106] In step S403 of some embodiments, the preset second importance degree range is the service request message of the second priority, and the second port has a bandwidth larger than the third port and smaller than the first port. The service request message sent from the second port needs to be load balanced, and the load balancing manner can be: according to the current load condition of the server, using common load balancing algorithms such as polling, weighted polling, and minimum connection number, to ensure that the service request message is evenly distributed among multiple servers.
[0107] It should be noted that the load balancing reliable sending refers to QoS1 or QoS2 sending to ensure that the service request message will be processed by the second server.
[0108] In step S404 of some embodiments, the bandwidth of the third port is the smallest, and is responsible for sending requests that need reliable delivery but do not need immediacy, such as system log recording, periodic data synchronization, historical data backup, etc. Although these requests need to ensure reliable delivery, the time efficiency requirement of transmission is low, so they can be processed through the third port with smaller bandwidth. Since the bandwidth is small, this port will not interfere with the real-time service request in the case of heavy load, while ensuring that these important but not urgent requests are reliably transmitted to the service server when the system resources allow.
[0109] Please refer to Figure 6 In some embodiments, the message processing method further includes but is not limited to steps S601 to S602:
[0110] Step S601, detecting the computing resources of the second message queue to obtain a computing resource pressure value;
[0111] Step S602, if the computing resource pressure value is greater than a preset pressure value, performing configuration modification on the first message queue to make the first message queue as the second message queue.
[0112] The steps S601 to S602 shown in the embodiments of the application, by detecting the computing resources of the second message queue to obtain a computing resource pressure value, if the computing resource pressure value is greater than a preset pressure value, performing configuration modification on the first message queue to make the first message queue as the second message queue, so that when the important message corresponding message queue is busy, the first message queue corresponding to the unimportant message is made as the second message queue, the computing resources of the message queue processing important messages are improved, and the processing speed of the important messages is improved.
[0113] Please refer to Figure 7 In some embodiments, step S601 can include but is not limited to steps S701 to S702:
[0114] Step S701, detecting the computing resource of the second message queue to obtain the concurrent message quantity, the total message quantity, and the message delay;
[0115] Step S702, performing calculation according to the preset resource pressure rule and the concurrent message quantity, the total message quantity, and the message delay to obtain the resource pressure value.
[0116] The steps S701 to S702 shown in the embodiments of the present application detect the computing resource of the second message queue to obtain the concurrent message quantity, the total message quantity, and the message delay, perform calculation according to the preset resource pressure rule and the concurrent message quantity, the total message quantity, and the message delay to obtain the resource pressure value, and thus comprehensively evaluate the processing capability of the server where the second message queue is located from multiple aspects.
[0117] In step S701 of some embodiments, the concurrent message quantity refers to the number of messages being processed in the second message queue at the same time. For example, if 100 messages are processed at the same time, the concurrent message quantity is 100.
[0118] The total message quantity refers to the number of all messages processed in the second message queue within a certain time. For example, if 1000 messages are processed in the second message queue in the past 1 hour, the total message quantity is 1000.
[0119] The message delay refers to the time experienced from when a message enters the queue to when the message is processed. For example, if a message takes 2 seconds from entering the queue to being processed, the delay of the message is 2 seconds.
[0120] In step S702 of some embodiments, according to the preset resource pressure rule, the concurrent message quantity, the total message quantity, and the message delay can be weighted to obtain the resource pressure value. For example, the calculation rule of the resource pressure value is that the weight of the concurrent message quantity is 0.4, the weight of the total message quantity is 0.3, and the weight of the message delay is 0.3.
[0121] The resource pressure value can be calculated in the following manner:
[0122] Resource pressure value=(concurrent message quantity*0.4)+(total message quantity*0.3)+(message delay*0.3).
[0123] For example, assuming that at a certain time, the concurrent message quantity of the second message queue is 100, the total message quantity is 1000, and the message delay is 2 seconds. Then, the calculation process of the resource pressure value is as follows:
[0124] Resource pressure value=(100*0.4)+(1000*0.3)+(2*0.3)=40+300+0.6=340.6.
[0125] In step S602 of some embodiments, the configuration modification refers to directly adjusting the first message queue to the second message queue, and merging into the original second message queue to form a new second message queue.
[0126] In one embodiment, a camera in the Internet of Things system sends a version upgrade inquiry request as a business request message, enters the message connection cluster, and belongs to the QoS0 level. Since the message belongs to a low-priority business, it does not require high-reliability transmission, and is therefore distributed to the first message queue in the message processing cluster. The first message queue corresponds to the QoS0 receiving level, and is suitable for business requests with high tolerance to message loss.
[0127] After the message enters the first message queue, it is sent to the first server through the message connection cluster. Since the message has a low reliability requirement, according to the QoS0 level, no retry or confirmation is performed, and the message is directly sent to the business server. The business server receives and processes the alarm information, and completes the corresponding business operation.
[0128] In one embodiment, a device in the Internet of Things system detects low power and sends a low power reminder, which is a business request message, enters the message connection cluster, and belongs to the QoS2 level. Since the message has a high reliability requirement, it needs to ensure reliable transmission of the message, and is therefore distributed to the second message queue in the message processing cluster. The second message queue corresponds to the QoS2 receiving level, and is suitable for business requests with high reliability requirements for messages.
[0129] After entering the second message queue, the low power reminder is evaluated for message importance. In the evaluation process, the message is prioritized according to the business type of the low power reminder (low power warning), and an appropriate port is selected for processing according to the evaluation result. Assuming that the low power reminder is evaluated as a highest-priority message, the message is sent to the second server through the first port (with the largest bandwidth).
[0130] In this case, the first port has a high bandwidth, which can ensure that the low power reminder can be quickly transmitted to the second server under reliable and efficient conditions, and the processing is completed.
[0131] In one embodiment, a device in the Internet of Things system sends a networking request, which is a business request message, enters the message connection cluster, and belongs to the QoS1 level. Since the message has a certain reliability requirement (i.e., at least one delivery), but does not require the highest priority processing, it is distributed to the second message queue in the message processing cluster. The second message queue corresponds to the QoS1 receiving level, and is suitable for business requests with high reliability requirements for messages but low real-time requirements.
[0132] After entering the second message queue, the message importance of the group networking request is evaluated, and it is confirmed that the message belongs to the second priority. According to the evaluation result, the message is sent to the second port with moderate bandwidth for load balancing processing, and the group networking request is distributed to the most suitable server according to the current server load.
[0133] Referring to Figure 8 The embodiment of the present application further provides a message processing device which can realize the message processing method, and the device comprises:
[0134] The first sending module 801 is used for sending the service request message to the message connection cluster in response to the service request message.
[0135] The message distribution module 802 is used for distributing the service request message to the message processing cluster through the message connection cluster.
[0136] The second sending module 803 is used for sending the service request message to the service server through the message processing cluster.
[0137] The message processing module 804 is used for processing the service request message through the service server.
[0138] The specific implementation of the message processing device is basically the same as the specific embodiment of the message processing method, and will not be repeated here.
[0139] The embodiment of the present application further provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor realizes the message processing method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer and the like.
[0140] Referring to Figure 9 , Figure 9 The hardware structure of the electronic device of another embodiment is illustrated, and the electronic device comprises:
[0141] The processor 901 can be realized in the mode of a general CPU (Central Processing Unit, central processor), a microprocessor, an ASIC (Application Specific Integrated Circuit, application specific integrated circuit) or one or more integrated circuits, and is used for executing a related program to realize the technical solutions provided by the embodiment of the present application.
[0142] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 902 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, the related program codes are stored in the memory 902 and are invoked and executed by the processor 901 to perform the message processing method of the embodiments of the present application.
[0143] The input / output interface 903 is configured to realize information input and output.
[0144] The communication interface 904 is configured to realize the communication interaction between the device and other devices. The communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0145] The bus 905 is configured to transmit information between various components (for example, the processor 901, the memory 902, the input / output interface 903, and the communication interface 904) of the device.
[0146] The processor 901, the memory 902, the input / output interface 903, and the communication interface 904 are connected to each other through the bus 905 to realize the communication connection between the device.
[0147] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the above message processing method.
[0148] The memory is a non-transitory computer readable storage medium, which can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory can include a high-speed random access memory and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor. These remote memories can be connected to the processor through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0149] The message processing method, the message processing device, the electronic device and the storage medium provided by the embodiments of the present application, in response to a service request message, send the service request message to a message connection cluster; distribute the service request message to a message processing cluster through the message connection cluster; send the service request message to a service server through the message processing cluster; and perform message processing on the service request message through the service server. In this way, by introducing the hierarchical architecture of the message connection cluster and the message processing cluster, the embodiments of the present application can effectively distribute the service request message to multiple clusters for processing, avoid the single cluster from becoming a bottleneck in the case of high load, and thus reduce the risk of delay or message loss, thereby optimizing message forwarding in the Internet of Things system.
[0150] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0151] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than shown in the figures, or combine certain steps or different steps.
[0152] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separate, that is, can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0153] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the function modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0154] The terms "first", "second", "third", "fourth" and the like (if any) in the specification of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0155] It should be understood that, in the application, "at least one" means one or more, "multiple" means two or more. "And / or" is used to describe the relationship between the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or similar expressions means any combination of these items, including single or multiple combinations of items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0156] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0157] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0158] In addition, the functional units in each embodiment of the application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0159] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, 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 computer software product is stored in a storage medium, and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0160] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not limited to the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.
Claims
1. A message processing method characterized by, The method comprises: sending the service request message to a message connection cluster in response to the service request message; distributing the service request message to a message processing cluster through the message connection cluster; sending the service request message to a service server through the message processing cluster; performing message processing on the service request message through the service server.
2. The method of claim 1, wherein, The message processing cluster comprises a first message queue and a second message queue, the first message queue corresponding to a first receiving level, and the second message queue corresponding to a second receiving level; the distributing the service request message to a message processing cluster through the message connection cluster comprises: obtaining a message delivery level of the service request message; screening the first message queue and the second message queue according to the message delivery level, the first receiving level and the second receiving level to obtain a target message queue; sending the service request message to the target message queue through the message connection cluster.
3. The method of claim 2, wherein, The service server is one of a first server or a second server; the sending the service request message to a service server through the message processing cluster comprises: if the message receiving level corresponding to the target message queue is the first receiving level, performing message non-reliable sending on the first server through the target message queue; if the message receiving level corresponding to the target message queue is the second receiving level, performing message reliable hierarchical sending on the second server through the target message queue.
4. The method of claim 3, wherein, The performing message reliable hierarchical sending on the second server through the target message queue comprises: performing message importance evaluation on the service request message to obtain a message importance; if the message importance is within a preset first importance range, performing direct reliable sending on the second server through a first port of the target message queue; if the message importance is within a preset second importance range, performing load balancing reliable sending on the second server through a second port of the target message queue; wherein the bandwidth of the first port is greater than that of the second port; if the message importance is within a preset third importance range, performing load balancing reliable sending on the second server through a third port of the target message queue; wherein the bandwidth of the second port is greater than that of the third port.
5. The method of claim 4, wherein, The performing message importance evaluation on the service request message to obtain a message importance comprises: obtaining field data of the service request message; matching the field data with a preset service matching rule to obtain the message importance of the service request message.
6. The method of claim 3, wherein, The method further comprises: detecting a computing resource of the second message queue to obtain a computing resource pressure value; if the computing resource pressure value is greater than a preset pressure value, performing configuration modification on the first message queue to make the first message queue serve as a second message queue.
7. The method of claim 6, wherein, The detecting the computing resource of the second message queue comprises: detecting the computing resource of the second message queue to obtain a concurrent message amount, a total message amount and a message delay; calculating according to a preset resource pressure rule and the concurrent message amount, the total message amount and the message delay to obtain the resource pressure value.
8. A message processing device, characterized by The device comprises: a first sending module configured to send the service request message to a message connection cluster in response to the service request message; a message distribution module configured to distribute the service request message to a message processing cluster through the message connection cluster; a second sending module configured to send the service request message to a service server through the message processing cluster; a message processing module configured to perform message processing on the service request message through the service server.
9. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the message processing method in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the message processing method in any one of claims 1 to 7.