Message Processing Method, Architecture, Device, Storage Medium and Electronic Device
Through message classification and node neighbor index combined with cache prefetching technology, an efficient message processing architecture is built, which solves the problem of insufficient synchronization performance in high-speed and large-traffic processing of traditional systems, and realizes efficient message processing in modern network applications.
Patent Information
- Application Number
- CN202111619252.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Traditional kernel protocol stacks and DPDK-based network message processing systems cannot meet the needs of modern high-speed and large traffic, especially in terms of inter-thread synchronization performance and hardware potential utilization.
By receiving packet classification, combining node neighbor index to determine the target node, and performing function processing, using cache prefetching technology to improve synchronization performance, and building an efficient message processing architecture.
It realizes the ability to process large-traffic messages at high speed, improves the synchronization performance of various service lines, and meets the needs of modern network applications.
Smart Images

Figure CN114296805B_ABST
Abstract
Description
Background Art
[0002] Due to the bottleneck of the operating system, the traditional kernel protocol stack can no longer adapt to modern high-speed and high-traffic application scenarios, such as data centers.
[0003] In related technologies, there are some network packet processing and forwarding systems developed based on the Data Plane Development Kit (DPDK). However, these systems also have some inherent defects. For example, the inter-thread synchronization performance of the multi-platform network protocol stack VPP (Vector Packet Processing) is too low, and the high-performance Layer 4 load balancer (DPVS) fails to fully exploit the hardware potential by using instruction cache prefetching. Moreover, these systems also have problems in applications that cannot meet the requirements of high-speed and high-traffic processing.
[0004] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure, and thus may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0005] The purpose of the present disclosure is to provide a packet processing method, architecture, device, electronic device and storage medium to solve the problem that large-volume packets cannot be processed at high speed in related technologies.
[0006] Other features and advantages of the present disclosure will become apparent through the following detailed description, or be learned in part through the practice of the present disclosure.
[0007] According to one aspect of the present disclosure, a packet processing method is provided, including: receiving a first packet, classifying the first packet according to the protocol type; sending the first packets of the same type to the same service processing node, performing function processing to obtain a second packet, and determining the target node of the second packet in combination with a preset node neighbor index; using the target node as a new service processing node, and sending the second packet to the new service processing node, and looping to execute the above steps until there is no target node, to obtain a packet processing result.
[0008] In an embodiment of the present disclosure, performing function processing to obtain a second packet includes: the number of packets received by the service processing node is N; caching and prefetching a group of packets from the received packets, and calling a function to process the group of packets to obtain a group of second packets; looping the above steps until the number of packets that have not been function-processed is less than n; the number of packets in a group is n, and N and n are positive integers, and n is less than or equal to N.
[0009] In an embodiment of the present disclosure, determining the target node of the second message in combination with a preset node neighbor index includes: retrieving the previous set of second messages and comparing them one by one with the second messages in this group: if the second messages in the two groups are the same, then using the target node of the previous set of second messages as the target node of the second messages in this group; if they are different, then based on the second messages in this group and in combination with the preset node neighbor index, determining the target nodes corresponding to the second messages in this group respectively.
[0010] In an embodiment of the present disclosure, obtaining the second message through function processing includes: performing initialization function processing, de-initialization function processing, and service function processing on the received first message to obtain the second message.
[0011] According to another aspect of the present disclosure, there is provided a message processing architecture, including: a source node, service processing nodes, and the connection relationships of the nodes; the source node receives the first message and sends it to the corresponding service processing node according to the category of the first message; the service processing node calls a function to perform function processing on the first message to obtain the second message; determining the next-level service processing node based on the connection relationships of the nodes to process the second message; wherein, the source node, service processing nodes, and the connection relationships of the nodes are stored in the same memory.
[0012] According to yet another aspect of the present disclosure, there is provided a method for constructing a message processing architecture, including: generating a directed graph based on service types and the relationships between services, where the directed graph includes nodes and the edges of the nodes, the nodes include a service type, and the edges of the nodes include the relationships between services; converting the directed graph into a table form to obtain a node adjacency list; determining whether the node adjacency list meets the construction conditions, if so, converting the node adjacency list into an array form to obtain the message processing architecture and storing it in the memory; if not, the directed graph is incorrect and the process ends; the construction conditions include that there is at least one source node in the nodes, and no node points to the source node, and the nodes have self-loops, and there are isolated nodes in the nodes.
[0013] According to still another aspect of the present disclosure, there is provided a message processing device, including: a receiving module for: receiving the first message and classifying the first message according to the protocol type; a processing module for: sending the first messages of the same type to the same service processing node, performing function processing to obtain the second message, and determining the target node of the second message in combination with a preset node neighbor index; a loop module for: using the target node as a new service processing node and sending the second message to the new service processing node, and looping through the above steps until there is no target node to obtain the message processing result.
[0014] According to still another aspect of the present disclosure, there is provided an apparatus for constructing a message processing architecture, including: a directed graph generation module, configured to: generate a directed graph based on service types and relationships between services, where the directed graph includes nodes and edges of the nodes, a node includes a service type, and an edge of the node includes a relationship between services; a node adjacency list generation module, configured to: convert the directed graph into a table form to obtain a node adjacency list; an architecture construction module, configured to: determine whether the node adjacency list meets the construction conditions, and if so, convert the node adjacency list into an array form to obtain a message processing architecture and store it in a memory; if not, the directed graph is incorrect and the process ends; the construction conditions include that there is at least one source node in the nodes, and no node points to the source node, and the nodes have self-loops, and there are isolated nodes in the nodes.
[0015] According to still another aspect of the present disclosure, there is provided a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the foregoing method is implemented.
[0016] According to still another aspect of the present disclosure, there is provided an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the foregoing method by executing the executable instructions.
[0017] The message processing method provided by the embodiments of the present disclosure can improve the synchronization performance of each service line processing by combining node neighbor indexes, so as to achieve the purpose of processing large-volume messages at high speed.
[0018] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which the message processing method of the embodiments of the present disclosure can be applied.
[0021] Figure 2 A flowchart showing the message processing method according to the first aspect embodiment of the present disclosure.
[0022] Figure 3 A flowchart showing an example in the message processing method according to the embodiments of the present disclosure.
[0023] Figure 4Shows the flowchart of the cache prefetch loop algorithm in the message processing method according to an embodiment of the present disclosure.
[0024] Figure 5 Shows a message processing architecture diagram provided according to an embodiment of the second aspect of the present disclosure.
[0025] Figure 6 Shows the node structure diagram in the message processing architecture according to an embodiment of the present disclosure.
[0026] Figure 7 Shows the construction method of the message processing architecture provided according to an embodiment of the third aspect of the present disclosure.
[0027] Figure 8 Shows an example of message processing under the message processing architecture according to an embodiment of the present disclosure.
[0028] Figure 9 Shows the block diagram of a message processing device provided according to an embodiment of the fourth aspect of the present disclosure.
[0029] Figure 10 Shows the block diagram of a device for constructing a message processing architecture provided according to an embodiment of the fifth aspect of the present disclosure.
[0030] Figure 11 Shows a network data message acceleration processing system based on DPDK according to an embodiment of the present disclosure.
[0031] Figure 12 Shows the block diagram of the structure of a message processing computer device provided according to an embodiment of the sixth aspect of the present disclosure. Detailed implementation manners
[0032] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0033] In addition, the drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0034] In addition, the terms "first" and "second" are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present disclosure, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically defined.
[0035] In view of the technical problems existing in the above related technologies, embodiments of the present disclosure provide a message processing method for at least solving one or all of the above technical problems.
[0036] Figure 1 The figure shows a schematic diagram of an exemplary system architecture to which the message processing method of the embodiments of the present disclosure can be applied; as Figure 1 shown:
[0037] The system architecture may include a server 101, a network 102, and a client 103. The network 102 is used to provide a medium for a communication link between the client 103 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0038] The server 101 may be a server that provides various services, such as a background management server that supports a device for classifying the received first message. The background management server may perform operations such as receiving, classifying, and function processing on the first message.
[0039] The client 103 may be a mobile terminal such as a mobile phone, a game console, a tablet computer, an e-book reader, smart glasses, a smart home device, an AR (Augmented Reality) device, a VR (Virtual Reality) device, etc., or the client 103 may also be a personal computer, such as a laptop portable computer and a desktop computer, etc.
[0040] In some alternative embodiments, the server 101 may receive the first message, classify the first message according to the protocol type; the server 101 may send the first messages of the same type to the same service processing node, perform function processing to obtain a second message, and determine the target node of the second message in combination with a preset node neighbor index; the server 101 may use the target node as a new service processing node and send the second message to the new service processing node, and loop through the above steps until there is no target node to obtain a message processing result.
[0041] It should be understood, Figure 1The numbers of clients, networks, and servers therein are merely illustrative. Server 101 may be a physical server, a server cluster composed of multiple servers, or a cloud server. According to actual needs, there may be any number of clients, networks, and servers.
[0042] Next, each step of the message processing method in the exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings and embodiments.
[0043] Figure 2 The flowchart of the message processing method provided by the first aspect embodiment of the present disclosure is shown. The method provided by the embodiments of the present disclosure may be executed in a server or a client as shown in Figure 1 However, the present disclosure is not limited thereto.
[0044] In the following illustrative example, the server cluster 101 is used as the execution subject for illustration.
[0045] As Figure 2 shown, the message processing method provided by the embodiments of the present disclosure may include the following steps:
[0046] Step S201: Receive a first message and classify the first message according to the protocol type;
[0047] Step S202: Send the first messages of the same type to the same service processing node, perform function processing to obtain a second message, and determine the target node of the second message in combination with the preset node neighbor index;
[0048] Step S203: Use the target node as a new service processing node, and send the second message to the new service processing node, and loop to execute the previous step until there is no target node to obtain the message processing result.
[0049] For example, as Figure 3As shown, after receiving a batch of packets, they will first be received and processed by Node A, whose function is to classify the packets according to the protocol type. For example, packets that are all 802.1Q in the packet are classified together and handed over to the VLAN node; packets that belong to 802.3 are handed over to the Ethernet node Ether. Then, after Node A finishes running, the VLAN node starts to run, finishes processing all the packets given by the previous node, and then other nodes. As long as there are packets handed over to a new node, other nodes will execute one after another. The whole process first executes Node A once, then the VLAN node executes n times, and finally the Ether node executes n times, which conforms to the pipeline model. Processing specific functions each time can effectively utilize temporal and spatial locality and reduce the overhead caused by cache misses due to program jumps. It can improve the synchronization performance of each service line processing by combining the node neighbor index, so as to achieve the purpose of processing large-volume packets at high speed.
[0050] In computer hardware, caches are used to increase the access speed of CPU instructions or data access. Caches are in units of lines. Taking the 1086 architecture as an example, each line is 64KB. If the instruction data required by the CPU is in the cache, the execution efficiency of the program will be very high. If it is not in the cache, or even the data required for each execution is not in the cache, the efficiency will be low. Placing instructions and data in the cache in advance is called cache prefetching. Cache prefetching is divided into hardware prefetching and software prefetching. Hardware prefetching is designed by CPU architecture designers and will guess possible cache prefetching situations based on the execution state of the hardware and perform prefetching. For example, when the CPU finds that it has been reading fixed-length data for a period of time, it guesses that the program may be executing an array loop at this time and will prefetch the data. In addition to the hardware code, an algorithm for software prefetching of application software should also be provided.
[0051] In some embodiments, the obtaining of the second packet by performing function processing includes: the number of packets received by the service processing node is N; a group of packets is cache-prefetched from the received packets, and a function is called to process the group of packets to obtain a group of second packets; the above step is looped until the number of packets that have not been function-processed is less than n; the number of packets in the group is n, and N and n are positive integers, and n is less than or equal to N. The processing speed can be improved by prefetching packets in advance. As Figure 4 As shown, a cache prefetching loop algorithm is specifically described, including: calculating the number n of pointers pointing to packets that can be placed in each cache line, that is, the number of packets in a cache-prefetched group. Start loop prefetching packets, prefetching n packets each time, until the cumulative number i of prefetched packets reaches the number N of received packets.
[0052] In some embodiments, determining the target node of the second message by combining a preset node neighbor index includes: retrieving the previous set of second messages and comparing them one by one with the current set of second messages: if the second messages in the two sets are the same, using the target node of the previous set of second messages as the target node of the current set of second messages; if they are different, based on the current set of second messages and in combination with the preset node neighbor index, determining the corresponding target nodes of the current set of second messages respectively.
[0053] In this embodiment, by corresponding comparison with the processing result of the previous set, the next-level target node can be quickly found, thereby achieving the purpose of improving the message processing speed.
[0054] In some embodiments, performing function processing to obtain the second message includes: performing initialization function processing, de-initialization function processing, and service function processing on the received first message to obtain the second message.
[0055] Performing preprocessing operations such as initializing the message can standardize the message format, perform verification and screening on the message, better improve the overall operation efficiency, and achieve an increase in the message processing speed.
[0056] Figure 5 FIG. shows a message processing architecture according to an embodiment of the second aspect of the present disclosure. As Figure 5 shown, the specific services of message processing are packaged into graph nodes (node). The architecture specifically includes: a source node, service processing nodes, and the connection relationships of the nodes. The source node receives the first message and sends it to the corresponding service processing node according to the category of the first message; the service processing node calls a function to perform function processing on the first message to obtain the second message; based on the connection relationships of the nodes, determining the next-level service processing node to process the second message; wherein, the source node, service processing nodes, and the connection relationships of the nodes are stored in the same memory.
[0057] The node structure is as Figure 6 shown, and includes node initialization init, de-initialization fini functions; node data packet processing function process(), node neighbor index (i.e., the edges of the vertices of the graph nb_edges), which are stored in the context memory of the current node in the form of an array. When the data processing of the current node is completed and the packet needs to be handed over to the next node, it is pointed out through its edges. The structure of the architecture of the embodiment of the present disclosure is simple and clear, and has strong maintainability.
[0058] As Figure 7 shown, the method for constructing a message processing architecture according to an embodiment of the third aspect of the present disclosure may include the following steps:
[0059] Step S701: Generate a directed graph based on the service types and the relationships between services. The directed graph includes nodes and edges of the nodes. Each node includes one of the service types, and the edges of the nodes include the relationships between the services.
[0060] Step S702: Convert the directed graph into a table form to obtain a node adjacency list.
[0061] Step S703: Determine whether the node adjacency list meets the construction conditions. If so, convert the node adjacency list into an array form to obtain a message processing architecture and store it in the memory. If not, the directed graph is incorrect and the process ends.
[0062] Among them, the construction conditions include that there is at least one source node in the nodes, and no node points to the source node, and the nodes have self-loops, and there are isolated nodes in the nodes. The service of the protocol stack can be organized in the form of a directed graph to achieve high-speed processing of large-traffic messages.
[0063] Figure 8 Illustrates an example of message processing in the Figure 5 message processing architecture shown in the present disclosure embodiment. As Figure 8 shown, the method specifically includes cache prefetching: obtaining the number N of the first messages received this time, initializing the number N_left of messages to be processed, and determining whether N_left is greater than n. If so, prefetch n messages (for example, n = 4, pkt0, pkt1, pkt2, pkt3); if not, the process ends. Message processing: Call the processing function to process the pre-fetched 4 messages in sequence to obtain processing results n0, n1, n2, n3 respectively. Result comparison: When taking out the messages (pkt’0, pkt’1, pkt’2, pkt’3) pre-fetched in the previous group, record the edges last0, last1, last2, last3 pointing to the next node, and calculate whether the processing results of the 4 messages this time are the same as the previous processing results, that is, fix_spec = (n0 ^ last1) | (n1 ^ last2) | (n2 ^ last3) | (n3 ^ last4), and determine whether fix_spec is 0. If so, send the processed messages to the nodes pointed to by last0, last1, last2, last3 respectively, and the number of messages to be processed minus N_left = N_left - n, return to the cache prefetch step, and determine whether N - left is greater than n; if not, send the processed messages to the nodes pointed to by n0, n1, n2, n3 respectively, use n0, n1, n2, n3 as the new last0, last1, last2, last3, the number of messages to be processed minus N_left = N_left - n, return to the cache prefetch step, and determine whether N - left is greater than n.
[0064] It should be noted that the above-mentioned drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present invention, rather than for limiting purposes. It is easy to understand that the processes shown in the above-mentioned drawings do not indicate or limit the chronological order of these processes. In addition, it is also easy to understand that these processes can be executed synchronously or asynchronously in, for example, multiple modules.
[0065] Figure 9 A block diagram of a message processing device 900 provided according to an embodiment of the fourth aspect of the present disclosure is shown; as Figure 9 shown, it includes: a receiving module 901, configured to: receive a first message, and classify the first message according to the protocol type; a processing module 902, configured to: send the first messages of the same type to the same service processing node, perform function processing to obtain a second message, and determine the target node of the second message in combination with a preset node neighbor index; a loop module 903, configured to: use the target node as a new service processing node, and send the second message to the new service processing node, and loop to execute the previous step until there is no target node; to obtain a message processing result.
[0066] Figure 10 A block diagram of a device 1000 for constructing a message processing architecture provided according to an embodiment of the fifth aspect of the present disclosure is shown; as Figure 10 shown, it includes: a directed graph generation module 1001, configured to: generate a directed graph based on the service type and the relationship between services, where the directed graph includes nodes and edges of the nodes, the nodes include one of the service types, and the edges of the nodes include the relationship between the services; a node adjacency list generation module 1002, configured to: convert the directed graph into a table form to obtain a node adjacency list; an architecture construction module 1003, configured to: determine whether the node adjacency list meets the construction conditions, if so, convert the node adjacency list into an array form to obtain a message processing architecture, and store it in the memory; if not, the directed graph is incorrect, and end. Wherein, the construction conditions include that there is at least one source node in the nodes, and no node points to the source node, and the nodes have self-loops, and there are isolated nodes in the nodes. The embodiments of the present disclosure can be applied to messages and scenarios carrying link layer data, and even, theoretically, systems that need to process a large number of block data can be applied.
[0067] A network data message acceleration processing system based on DPDK according to an embodiment of the present disclosure, a schematic diagram of the system architecture is as Figure 11As shown; the system architecture adopts a multi-threaded model based on DPDK and runs in a run-to-complete manner; the processing threads are divided into control threads and forwarding threads. The control threads mainly perform some management tasks, such as configuration management, time management, and receiving the entries sent by the northbound interface and sending them to the forwarding threads. The forwarding threads mainly carry the actual forwarding services. The processing threads are connected to the configuration management, and the configuration management mainly manages configuration commands, files, protocols, etc. The log management records all behavior data during the processing, including the behavior data in the configuration management and the behavior data in the thread processing. The first to fifth embodiments of the present disclosure are applied to the processing threads.
[0068] Those skilled in the art of the present technology can understand that various aspects of the present invention can be implemented as a system, a method, or a program product. Therefore, various aspects of the present invention can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuits", "modules", or "systems" here.
[0069] Figure 12 The structural block diagram of a packet processing computer device according to a sixth aspect embodiment of the present disclosure is shown. It should be noted that the illustrated electronic device is only an example and should not bring any limitation to the functions and usage scopes of the embodiments of the present invention.
[0070] Next, refer to Figure 12 to describe the electronic device 1200 according to this embodiment of the present invention. Figure 12 The illustrated electronic device 1200 is only an example and should not bring any limitation to the functions and usage scopes of the embodiments of the present invention.
[0071] As Figure 12 shown, the electronic device 1200 is presented in the form of a general computing device. The components of the electronic device 1200 may include, but are not limited to: the above-mentioned at least one processing unit 1210, the above-mentioned at least one storage unit 1220, and a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210).
[0072] Among them, the storage unit stores program codes, and the program codes can be executed by the processing unit 1210, so that the processing unit 1210 executes the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Methods" section of this specification. For example, the processing unit 1210 can execute as Figure 2Step S201 shown in the figure: Receive a first message, and classify the first message according to the protocol type; Step S202: Send the first messages of the same type to the same service processing node, perform function processing to obtain a second message, and determine the target node of the second message in combination with a preset node neighbor index; Step S203: Use the target node as a new service processing node, and send the second message to the new service processing node, and loop to execute the previous step until there is no target node, and obtain a message processing result.
[0073] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 12201 and / or a cache storage unit 12202, and may further include a read-only storage unit (ROM) 12203.
[0074] The storage unit 1220 may also include a program / utilities 12204 having a set (at least one) of program modules 12205. Such program modules 12205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.
[0075] The bus 1230 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus structures.
[0076] The electronic device 1200 may also communicate with one or more external devices 1300 (such as a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication may be through the input / output (I / O) interface 1250. In addition, the electronic device 1200 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 1260. As shown in the figure, the network adapter 1260 communicates with other modules of the electronic device 1200 through the bus 1030. It should be understood that although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0077] In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of this specification. In some possible implementation manners, various aspects of the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0078] The program product for implementing the above method according to an embodiment of the present invention may be a portable compact disc read-only memory (CD-ROM) and includes program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0079] The program product may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may, for example, but not be limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0080] The computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries the readable program code. Such a propagated data signal may take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable signal medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0081] The program code contained on the readable medium may be transmitted by any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0082] The program code for performing the operations of the present invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, executed as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0083] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0084] In addition, although the steps of the methods in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution, etc.
[0085] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (which can be a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of the present disclosure.
[0086] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include known common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and examples are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the appended claims.
Claims
1. A message processing method, characterized in that, Including: Receiving a first message and classifying the first message according to the protocol type; Sending the first messages of the same type to the same service processing node, performing function processing to obtain a second message, and determining the target node of the second message in combination with a preset node neighbor index; Taking the target node as a new service processing node, and sending the second message to the new service processing node, and looping to execute the previous step until there is no target node, to obtain a message processing result; Wherein, the first message is received by a source node, and the connection relationships among the source node, the service processing nodes and the nodes belong to the same message processing system and are stored in the same memory; the message processing system is constructed in the following manner: Generating a directed graph based on service types and the relationships between services, wherein the directed graph includes nodes and edges of the nodes, the nodes include one of the service types, and the edges of the nodes include the relationships between the services; Converting the directed graph into a table form to obtain a node adjacency list; wherein, the node neighbor index is determined according to the edges of the nodes in the directed graph; Judging whether the node adjacency list meets the construction conditions, if so, converting the node adjacency list into an array form to obtain a message processing system and storing it in the memory; if not, the directed graph is incorrect and the process ends; Wherein, the construction conditions include that there is at least one source node among the nodes, and no node points to the source node, and the nodes have self-loops, and there are isolated nodes among the nodes.
2. The method according to claim 1, wherein The performing function processing to obtain a second message includes: The number of messages received by the service processing node is N; Caching and prefetching a group of messages from the received messages, and calling a function to process the group of messages to obtain a group of second messages; Looping the previous step until the number of messages that have not been processed by the function is less than n; The number of messages in the group is n, N and n are positive integers, and n is less than or equal to N.
3. The method according to claim 2, characterized in that The determining the target node of the second message in combination with a preset node neighbor index includes: Retrieving the previous group of second messages and comparing them one by one with the current group of second messages: If the second messages in the two groups are the same, taking the target node of the previous group of second messages as the target node of the current group of second messages; If they are different, based on the current group of second messages, in combination with a preset node neighbor index, determining the target nodes corresponding to the current group of second messages respectively.
4. The method according to claim 1, wherein The performing function processing to obtain a second message includes: Performing initialization function processing, de-initialization function processing, and service function processing on the received first message to obtain a second message.
5. A message processing system, characterized in that, Including: Source node, service processing nodes, connection relationships of the nodes; The source node receives a first message and sends it to the corresponding service processing node according to the category of the first message; The service processing node calls a function to perform function processing on the first message to obtain a second message; Determining the next-level service processing node based on the connection relationships of the nodes to process the second message; Wherein, the source node, the service processing nodes and the connection relationships of the nodes are stored in the same memory; the message processing system is constructed in the following manner: Generate a directed graph based on service types and the relationships between services, where the directed graph includes nodes and edges of the nodes, the nodes include one of the service types, and the edges of the nodes include the relationships between the services; Convert the directed graph into a table form to obtain an adjacency list of nodes; among them, the node neighbor index is determined according to the edges of the nodes in the directed graph; Determine whether the adjacency list of nodes meets the construction conditions. If so, convert the adjacency list of nodes into an array form to obtain a message processing system and store it in the memory; if not, the directed graph is incorrect and the process ends; Among them, the construction conditions include that there is at least one source node in the nodes, no node points to the source node, the nodes have self-loops, and there are isolated nodes in the nodes.
6. A message processing device, characterized in that, Include: A receiving module, configured to: receive a first message and classify the first message according to the protocol type; A processing module, configured to: send the first messages of the same type to the same service processing node, perform function processing to obtain a second message, and determine the target node of the second message in combination with a preset node neighbor index; A loop module, configured to: use the target node as a new service processing node, and send the second message to the new service processing node, and loop through the above steps until there is no target node to obtain a message processing result; Among them, the first message is received through a source node, and the connection relationship between the source node, the service processing node and the nodes belongs to the same message processing system and is stored in the same memory; the message processing system is constructed as follows: A directed graph generation module, configured to: generate a directed graph based on service types and the relationships between services, where the directed graph includes nodes and edges of the nodes, the nodes include one of the service types, and the edges of the nodes include the relationships between the services; A node adjacency list generation module, configured to: convert the directed graph into a table form to obtain an adjacency list of nodes; among them, the node neighbor index is determined according to the edges of the nodes in the directed graph; An architecture construction module, configured to: determine whether the adjacency list of nodes meets the construction conditions. If so, convert the adjacency list of nodes into an array form to obtain a message processing system and store it in the memory; if not, the directed graph is incorrect and the process ends; Among them, the construction conditions include that there is at least one source node in the nodes, no node points to the source node, the nodes have self-loops, and there are isolated nodes in the nodes.
7. A computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of claims 1 to 4 is implemented.
8. An electronic device, characterized in that, Include: One or more processors; A storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for network flow data analysis based on stream processing
CN108259371A
Traffic classifier, service routing trigger, and message processing method and system
CN108632098A
Message processing method and device, electronic equipment and computer readable medium
CN112333169A
Method for transmitting data packet
CN1984028A