A communication intermediate module based on high-concurrency multi-node application and communication method thereof

By designing a communication intermediate module based on high-concurrency multi-node applications, the problem of message loss and blockage during communication between multiple nodes is solved, high-concurrency and reliable communication is achieved, flexible expansion and logging are supported, and the stability and maintenance efficiency of the system are improved.

CN116016401BActive Publication Date: 2025-05-23JIANGSU SHAGANG HIGH-TECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211550831.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2025-05-23
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

When the prior art realizes high concurrent communication between multiple nodes, there are problems such as message loss, incomplete transmission, and blockage, and does not support point-to-point communication, resulting in system instability, maintenance difficulties, and inability to flexibly expand.

Method used

A communication intermediate module based on high-concurrency multi-node applications is designed, including a database server and an application server. The client of the application server is responsible for connecting to the lower nodes, and the server is responsible for monitoring the connection status and processing business data. It adopts the message packet sending method to support multiple nodes to simultaneously connect and send packets in parallel, realizing automatic retransmission and disconnection and reconnection.

Benefits of technology

It realizes high concurrent communication between multiple nodes, avoids message loss and blockage, improves system reliability and stability, supports flexible expansion and logging, and simplifies maintenance and problem investigation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016401B_ABST
    Figure CN116016401B_ABST
Patent Text Reader

Abstract

The present invention provides a communication intermediate module based on a high-concurrency multi-node application and its communication method. The communication intermediate module includes a database server and at least one application server; each application server includes a client responsible for sending service data and a server responsible for receiving service data; the communication method includes a service data sending method and a service data receiving method. In the service data sending method, the client uses dedicated threads to group all the telegrams to be sent by group number, and creates a working thread for each telegram group to send the telegram; in the service data receiving method, the server receives the telegrams sent by the lower-level nodes, decodes and stores them in the telegram receiving table, and each upper-level node obtains its own service data from the telegram receiving table on time; the communication method proposed by the present invention supports connecting to multiple upper-level nodes simultaneously, both the client and the server support retransmission and reconnection, the nodes support mutual heartbeat detection, support high-concurrency telegram sending and receiving, and the data processing is extremely fast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a communication method, and in particular to a communication intermediate module based on high-concurrency multi-node application and a communication method thereof. Background Art

[0002] In every modern large-scale enterprise, there are several management and control computers distributed at various levels. They need to communicate through data transmission. The superior management system needs to send management decision information to each subordinate production system. At the same time, the superior management system receives field data information from each subordinate production system. With the development of enterprises, there are more and more business systems, and the communication between superior and subordinate systems is becoming more and more frequent. The integration of data communication and existing applications plays an increasingly important role in improving the efficiency of production and management.

[0003] Due to the diversity of equipment types, differences in manufacturing years, and different ways of interconnection among various suppliers, the network interconnection situation is quite complicated; and the portability between different communication codes is very low, which makes programmers spend a lot of time and energy in realizing network interconnection, and also brings a lot of inconvenience to network maintenance personnel. At the same time, the communication systems of many large enterprises do not support point-to-point communication, which leads to insufficient high concurrency capacity of the communication system and unstable communication. Abnormal situations such as telegram loss, incomplete transmission of telegram information, and a large number of telegrams in a short period of time often occur. Once these problems occur, relevant personnel need to manually process the telegrams, which is time-consuming and labor-intensive; at the same time, some connections and information interactions between the superior management system and the subordinate production system are not logged, which is extremely inconvenient for later problem finding. In addition, whenever a new production line is put into use, it is necessary to install the relevant telegram program and add a new database, and the configuration expansion cannot be flexibly performed. Summary of the invention

[0004] The purpose of the present invention is to propose a communication intermediate module and a communication method based on high-concurrency multi-node applications, which are used to realize real-time communication between the business data of the upper node and multiple lower nodes. The communication intermediate module supports simultaneous connection with multiple upper nodes and supports grouped parallel sending of data to be sent.

[0005] To achieve the above-mentioned purpose, the present invention provides the following technical solutions: a communication intermediate module based on high-concurrency multi-node application and its communication method, the communication intermediate module includes a database server and at least one application server connected thereto respectively; the application server includes a client and a server, the client of the application server is responsible for actively connecting to the subordinate node, at the same time, the client of the application server receives the business data of the upper node and sends the business data to the upper node, the server of the application server is responsible for monitoring its connection status with the subordinate node, at the same time, the server of the application server receives the business data sent by the subordinate node, processes it and stores it in the database server.

[0006] A communication method based on high-concurrency multi-node application, including a business data sending method and a business data receiving method; wherein the business data sending method includes the following steps:

[0007] Step a: Based on the application server client in the communication intermediate module receiving the business data to be sent from each upper node, the information identification of each business data to be sent is first synchronized to the message configuration table and message detail table in the database, and then each upper node calls the encoder to encode each business data to be sent into a message to be sent and writes it into the message sending table;

[0008] Step b: The working thread in the application server client sends the pending telegram groups in the telegram sending table to each target subordinate node;

[0009] Step c: Each target subordinate node decodes and verifies the received message, and returns a response message according to its receiving channel. If the verification is successful, it returns A, and if the verification fails, it returns B;

[0010] Step d: After receiving the response message from the corresponding target subordinate node, the application server client identifies the content. If it returns A, the status of the message in the message sending table is changed to sending completed, and the message is written into the log; if it returns B, the reason for the failure of the target subordinate node to receive the message is added to the message, and the message is fed back to the superior node.

[0011] The service data receiving method comprises the following steps:

[0012] Step e: After receiving the message sent by each lower-level node, the application server service end based on the communication intermediate module calls the decoder to decode the message into business data according to the message configuration table and the message details table;

[0013] Step f: The application server verifies whether the decoded service data is received correctly and completely, and returns a response message according to the original channel. If the verification is successful, it returns to A and writes the service data into the message receiving table; if the verification fails, it returns to B with the reason for the reception failure;

[0014] Step g: Each upper-level node obtains its own service data from the message receiving table according to the message group name at a preset time period.

[0015] Furthermore, the aforementioned database includes a node information table, a telegram configuration table, a telegram details table, a telegram receiving table, and a telegram sending table; the node information table contains all node codes, IPs, and listening ports connected to the communication intermediate module; the telegram configuration table contains information such as the telegram name, node code, telegram length, group number, and telegram type. A telegram name represents a business, and the node code represents the destination node to which the business data is to be sent. The corresponding node's IP and other information can be found from the node information table based on it. In addition, the node code and group number represent the group name of a group; the telegram details table contains detailed information of all telegrams in the telegram configuration table as well as the business data, data type, length, and precision in the telegram; the telegram sending table is used to temporarily store the telegrams to be sent encoded by the encoder; the telegram receiving table is used to temporarily store the business data sent by the lower-level nodes decoded by the decoder.

[0016] Further, based on the dedicated thread 2 and the sending thread pool 1 included in the application server client, the aforementioned step b includes:

[0017] b1: Dedicated thread 2 screens the group names of the pending telegrams in the telegram sending table according to the preset time period. After screening out the group names, dedicated thread 2 creates a sending task for each of these different group names and puts it into the task pool;

[0018] b2: Each sending thread in the sending thread pool 1 first receives the sending task from the task pool in order, then searches for the pending messages with the same group name from the message sending table according to the group name in the received task, and then sends the pending messages with the same group name to each target subordinate node in order; if the message is sent successfully, the message is written into the log; if the message fails to be sent, the thread will automatically resend the message.

[0019] Furthermore, when the aforementioned telegram encoder is working, it will query the telegram configuration information from the telegram configuration table and the telegram details table, and convert the data to be transmitted into a telegram format based on this information; conversely, when the telegram decoder is working, it will convert the telegram data into specific business data based on the queried telegram configuration information.

[0020] Furthermore, the aforementioned application server creates and deletes node communication connections in the following ways:

[0021] The communication connection method of the newly created node is as follows: the corresponding information of the newly created node is compiled into the node information table of the database. The application server includes a dedicated thread 1. The dedicated thread 1 reads the newly created node information from the node information table of the database regularly according to a preset time period. After obtaining the newly added node, the application server client uses the Netty launcher to establish a communication connection with the node through the IP and listening port of the newly created node.

[0022] The method of deleting the node communication connection is: deleting the information of the corresponding node in the node information table of the database, and the application server client will actively disconnect from the node.

[0023] Furthermore, the aforementioned application server maintains a communication connection with each node in the following manner: the application server uses Netty's heartbeat mechanism to send a heartbeat message to the subordinate node every 60 seconds to maintain a long connection. At the same time, the subordinate node also sends a heartbeat message to the application server every 60 seconds.

[0024] The present invention proposes a communication intermediate module and a communication method based on high-concurrency multi-node applications. Compared with the prior art, the above technical solution has the following technical effects:

[0025] 1. This communication intermediate module can connect to multiple nodes at the same time and perform the sending and receiving operations of business data without the phenomenon of telegram jamming;

[0026] 2. This communication method processes business data very quickly. The client uses telegram grouping to send messages. The groups do not affect each other, which solves the transmission congestion problem. The business transmission time is in milliseconds. The server can also complete the reception and processing of telegram data within a few milliseconds and write it into the database.

[0027] 3. The telegram data will not be missing or lost. The telegram can be automatically resent if it fails to be sent. The nodes can be reconnected without manual intervention, which is highly reliable. All operations are logged to facilitate problem analysis.

[0028] 4. This communication intermediate module is an independent communication device and is not restricted by the programs of the two communicating parties. When adding a lower-level node, only simple data configuration is required to complete the communication expansion. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of sending electronic message groups in the present invention;

[0030] Figure 2 It is a relationship diagram among the node information table, message configuration table and message details table. DETAILED DESCRIPTION

[0031] In order to better understand the technical content of the present invention, specific embodiments are given and described as follows in conjunction with the accompanying drawings.

[0032] Various aspects of the invention are described herein with reference to the accompanying drawings, in which many illustrative embodiments are shown. The embodiments of the invention are not limited to those described in the accompanying drawings. It should be understood that the invention is implemented by any of the various concepts and embodiments described above, as well as the concepts and embodiments described in detail below, because the concepts and embodiments disclosed in the invention are not limited to any implementation. In addition, some aspects disclosed in the invention may be used alone or in any appropriate combination with other aspects disclosed in the invention.

[0033] The present invention proposes a communication intermediate module and a communication method based on a high-concurrency multi-node application. The communication intermediate module includes a database server and at least one application server connected thereto respectively; the application server includes a client and a server. The client of the application server is responsible for actively connecting to the subordinate node. At the same time, the client of the application server receives the business data of the upper node and sends the business data to the upper node. The server of the application server is responsible for monitoring the connection status between it and the subordinate node. At the same time, the server of the application server receives the business data sent by the subordinate node, processes it and stores it in the database server.

[0034] In this embodiment, two servers are first prepared, one as a database server and the other as an application server for deploying the system. If the business volume is large, more application servers can be added to share the pressure. Three tables are set up in the database: node information table, message configuration table, and message details table.

[0035] like Figure 2 As shown in the figure, the node information table contains the code, IP, and listening port of all nodes connected to the communication intermediate module; the message configuration table contains the message name, node code, message length, group number, message type and other information. A message name represents a service, and the node code represents the destination node to which the service data is to be sent. It can be used to find the IP and other information of the corresponding node from the node information table. In addition, the node code + group number represents a group; the message details table contains the detailed information of all messages in the message configuration table, including what data, data type, and length exist in each message. The decoder and encoder process data according to the message configuration table and the message details table. These two tables need to be followed by the upper and lower nodes.

[0036] Then, the client program is deployed on the application server. The program creates a dedicated thread 1 on the server. It reads the newly added subordinate node information from the node information table every 60 seconds according to the preset time. After obtaining the newly added subordinate node, the Netty launcher is used to connect to the corresponding subordinate node through the IP and the listening port. At this time, the client of the application server and the subordinate node have established a communication link. Since the link will be interrupted if there is no communication for a long time after the connection, the heartbeat mechanism of Netty is used to send a heartbeat message to the subordinate node every 60 seconds to maintain a long connection.

[0037] like Figure 1 As shown, the client creates another dedicated thread 2 and a sending thread pool 1 (10 threads). Based on the business data to be sent to the subordinate node written into the telegram sending table through the encoder by the upper node, the dedicated thread 2 is responsible for filtering the group number in the telegram sending table every 10S. The group number is composed of the node name plus the group number in the telegram configuration table. After filtering the group number, the dedicated thread 2 creates a sending task for each group number and puts it into the task pool, and hands it over to the sending thread pool 1 for sending. The 10 threads in the sending thread pool 1 pick up tasks from the task pool in sequence to execute and send.

[0038] After the thread in the sending thread pool 1 receives the sending task of group 1, the thread will find all the pending messages with the group name of group 1 from the message sending table, and then send them to the lower-level nodes in sequence. In order to ensure the correctness of the business logic, the group is sent according to the first-in-first-out rule, that is, the groups are sent in parallel and in sequence within the group. If the sending fails, the thread will automatically resend the failed message.

[0039] After the message is successfully sent to the lower-level node, the lower-level node will decode and verify the received message according to the message configuration table and the message details table. Regardless of whether the verification is successful or not, the lower-level node will return a response message according to the receiving channel. Assume that A is returned if the verification is successful and B is returned if the verification fails. After receiving the response message, the client of this application server will write a log and change the status of the message in the message sending table to complete. If B is received, the reason for the failure of the lower-level node to receive the message will be added to the message, and the message will be fed back to the upper-level node.

[0040] Finally, the server program is deployed on the application server. The server creates a thread group 2 to receive client connections from the lower-level nodes and a thread group 3 to process connections between upper-level nodes. The two thread pools have clear division of labor and can handle multi-node connections and high-concurrency information processing. Finally, a Netty server starter is created and a port number is set to start the service. Similarly, in order to maintain a long connection, the lower-level node will also send a heartbeat message to the server of this application server at a frequency of 60 seconds.

[0041] After receiving the message from the lower-level node, the server will use the decoder to decode the message into business data according to the message configuration table and the message details table, and then verify whether the business data is received correctly and completely. Regardless of whether the verification is successful or not, a response message will be returned according to the message receiving channel. Similarly, if the verification is successful, A will be returned, and if the verification fails, B will be returned; if the verification fails, the reason for the reception failure will be included when B is returned. If the verification is successful, the server will write the business data into the message receiving table, and each upper-level node will obtain its own business data from the message receiving table according to the message group name at the preset time period.

[0042] If a new node is added, the communication connection method of the new node is as follows: the corresponding information of the new node is compiled in the node information table of the database. After the dedicated thread 1 in the application server obtains the newly added node, the Netty launcher is used, and the application server client establishes a communication connection with the node through the IP and listening port of the new node.

[0043] Although the present invention has been described above with preferred embodiments, it is not intended to limit the present invention. A person skilled in the art of the present invention may make various modifications and improvements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the definition of the claims.

Claims

1. A communication method based on high-concurrency multi-node applications, It is characterized in that Based on the database server, and the client and server of the application server, the communication method of the communication intermediate module includes a business data sending method and a business data receiving method; the business data sending method includes the following steps: Step a: Based on the application server client in the communication intermediate module receiving the business data to be sent from each upper node, the information identification of each business data to be sent is first synchronized to the message configuration table and message detail table in the database, and then each upper node calls the encoder to encode each business data to be sent into a message to be sent and writes it into the message sending table; Step b: The working thread in the application server client sends the pending telegram groups in the telegram sending table to each target subordinate node; Step c: Each target subordinate node decodes and verifies the received message, and returns a response message according to its receiving channel. If the verification is successful, it returns A, and if the verification fails, it returns B; Step d: After receiving the response message from the corresponding target subordinate node, the application server client identifies the content. If it returns A, the status of the message in the message sending table is changed to sending completed, and the message is written into the log; if it returns B, the reason for the failure of the target subordinate node to receive the message is added to the message, and the message is fed back to the superior node; The service data receiving method comprises the following steps: Step e: After receiving the message sent by each lower-level node, the application server service end based on the communication intermediate module calls the decoder to decode the message into business data according to the message configuration table and the message detail table; Step f: The application server verifies whether the decoded service data is received correctly and completely, and returns a response message according to the original channel. If the verification is successful, it returns A and writes the service data into the message receiving table; If the verification fails, it returns B with the reason for the reception failure; Step g: Each upper-level node obtains its own service data from the message receiving table according to the message group name at a preset time period.

2. A communication method based on high-concurrency multi-node application according to claim 1, It is characterized in that The database includes a node information table, a message configuration table, a message details table, a message receiving table, and a message sending table; The node information table includes all node codes, IP addresses, and monitoring ports connected to the communication intermediate module; The message configuration table includes message name, node code, message length, group number, message type and other information. A message name represents a service data, and the node code represents the destination node to which the service data is to be sent. The node code can be used to find the IP and other information of the corresponding node from the node information table. In addition, the node code and group number represent the group name of a group. The message details table includes the details of all messages in the message configuration table as well as the business data, data type, length and precision in the message; The message sending table is used to temporarily store the messages to be sent encoded by the encoder; the message receiving table is used to temporarily store the lower-level node sending service data decoded by the decoder.

3. A communication method based on high-concurrency multi-node application according to claim 2, It is characterized in that Based on the dedicated thread 2 and the sending thread pool 1 included in the application server client, the step b includes: b1: Dedicated thread 2 screens the group names of the pending telegrams in the telegram sending table according to the preset time period. After screening out the group names, dedicated thread 2 creates a sending task for each of these different group names and puts it into the task pool; b2: Each sending thread in the sending thread pool 1 first receives the sending task from the task pool in order, then searches for the pending messages with the same group name from the message sending table according to the group name in the received task, and then sends the pending messages with the same group name to each target subordinate node in order; if the message is sent successfully, the message is written into the log; if the message fails to be sent, the thread will automatically resend the message.

4. A communication method based on high-concurrency multi-node application according to claim 2, It is characterized in that When the telegram encoder is working, it will query the telegram configuration information from the telegram configuration table and the telegram details table, and convert the data to be transmitted into a telegram format based on this information; conversely, when the telegram decoder is working, it will convert the telegram data into specific business data based on the queried telegram configuration information.

5. A communication method based on high-concurrency multi-node application according to claim 2, It is characterized in that The method for the application server to create and delete node communication connections includes: The communication connection method of the newly created node is as follows: the corresponding information of the newly created node is compiled into the node information table of the database. The application server includes a dedicated thread 1. The dedicated thread 1 reads the newly created node information from the node information table of the database regularly according to a preset time period. After obtaining the newly added node, the application server client uses the Netty launcher to establish a communication connection with the node through the IP and listening port of the newly created node. The method of deleting the node communication connection is: deleting the information of the corresponding node in the node information table of the database, and the application server client will actively disconnect from the node.

6. A communication method based on high-concurrency multi-node application according to claim 1, It is characterized in that The way this application server maintains communication connection with each node is as follows: this application server uses Netty's heartbeat mechanism to send a heartbeat message to the lower-level node every 60 seconds to maintain a long connection. At the same time, the lower-level node also sends a heartbeat message to this application server every 60 seconds.