A method for efficient data exchange in a cross-physical network environment
By adopting database message protocol and multi-channel FTP sharding technology in a cross-physical network environment, combined with advanced message queue and hashing technology, the efficiency and performance defects of traditional data exchange methods are solved, and high concurrency and large throughput are achieved. , low-latency data exchange, meeting the needs for efficient data exchange under the new era service architecture.
Patent Information
- Application Number
- CN202311499004.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-11-10
AI Technical Summary
The traditional data exchange method in a cross-physical network environment has flaws in efficiency and performance. In particular, the database polling method has a great impact on database performance, and single-node scheduled tasks cannot play a cluster role, resulting in low throughput and high latency, which cannot meet the requirements. High concurrency and low latency requirements under the new era service architecture.
Adopting a method based on database message protocol and multi-channel FTP sharding technology, using optical gate switches in a safe isolation environment, using advanced message queue technology and hashing technology to achieve high concurrency, large throughput, and cross-physical network environments. Low-latency data exchange, combined with JMS protocol and multi-thread monitoring, dynamically balances FTP channels to improve data exchange efficiency.
It effectively avoids slow query caused by data backlog, shortens the gap from data landing to extraction, improves the concurrency capability of FTP exchange, maximizes the use of dedicated switching physical equipment, realizes efficient exchange of database and FTP, and supports high concurrency and low Delayed data transfer.
Smart Images

Figure CN117478669B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data exchange, and more specifically, to a method for efficient data exchange in a cross-physical network environment. Background Art
[0002] In recent years, with the development of social service platform construction, from the perspective of data security, important data can only be stored in the public security network. Therefore, the existence of the social service platform business system and the public security traffic management information system supports the needs of high concurrency and low latency data exchange across physical network environments.
[0003] The traditional method of data exchange across physical network environments is based on high-frequency polling of database tables and low-frequency polling of FTP. For data exchange with high real-time requirements, the database method is used: the sender writes the exchange table, and after exchanging it to the same table on the receiving end through the optical gate, the receiving end program scans the receiving table through high-frequency task polling to achieve rapid data flow; for data exchange with low real-time requirements, the FTP method is used: the sender writes the FTP sending directory, exchanges it to the receiving end FTP receiving directory through the optical gate, and the receiving end exchange service periodically polls the FTP receiving directory to read data. The traditional implementation method has obvious defects in efficiency and performance: first, the database uses polling to scan the exchange receiving table after exchange, which has a great impact on database performance; second, for a single table and a single FTP service, only a single node can be polled to read data through a scheduled task, which cannot play the role of the cluster, the overall throughput cannot be effectively improved, and the exchange is time-consuming. In order to effectively adapt to the data exchange scenario under the new era service architecture, a new set of boundary exchange software needs to be designed to provide support for the construction of the next generation of social service platforms. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art. The present invention provides a method for efficient data exchange in a cross-physical network environment. On the basis of the security isolation optical gate providing the ability to exchange database tables and FTP files, high concurrency, high throughput and low latency cross-physical network environment data exchange is achieved based on database message protocol application technology and multi-channel FTP fragmentation technology.
[0005] As a first aspect of the present invention, a method for efficient data exchange in a cross-physical network environment is provided, wherein data is exchanged between a network environment end A and a network environment end B via an optical gate switch, and the method for efficient data exchange in a cross-physical network environment comprises the following steps:
[0006] Step S1: Initiate a cross-network exchange request through any business service at end A of the network environment, and provide a request message body in the agreed format;
[0007] Step S2: parsing the request message body through the border gateway at the end A of the network environment to obtain the request exchange configuration information, and writing the request message body into the exchange table or FTP exchange directory in the exchange database according to the request exchange configuration information;
[0008] Step S3: monitoring the message queue in the exchange database or polling the FTP exchange directory through the border gateway at the B end of the network environment to obtain the request message body;
[0009] Step S4: parsing the request message body through the border gateway at the network environment B end to obtain request routing configuration information, and selecting a target business service from the network environment B end according to the request routing configuration information;
[0010] Step S5: calling the target business service through the border gateway at the B end of the network environment to obtain a response message body;
[0011] Step S6: parsing the response message body through the border gateway at the B end of the network environment to obtain response exchange configuration information, and writing the response message body into the exchange table in the exchange database or the FTP exchange directory according to the response exchange configuration information;
[0012] Step S7: monitoring the message queue in the exchange database or polling the FTP exchange directory through the border gateway at the A end of the network environment to obtain the response message body;
[0013] Step S8: Parse the response message body through the border gateway at the network environment A end to obtain response routing configuration information, select the target business service from the network environment A end according to the response routing configuration information, and return the response message body to the target business service in the network environment A end; wherein, the target business service in the network environment A end is the business service that initiates the cross-network exchange request in step S1.
[0014] Further, the step of writing the request message body into a switching table in a switching database according to the request switching configuration information; and monitoring a message queue in the switching database through a border gateway at the B end of the network environment to obtain the request message body further includes the following steps:
[0015] (1) writing the request message body into the exchange table in the exchange database at the network environment end A, the optical gate switch reads the request message body from the exchange table at the network environment end A according to the request exchange configuration information, and directly writes the request message body into the receiving table in the exchange database at the network environment end B through an Insert operation; wherein the receiving table at the network environment end B has a trigger;
[0016] (2) The trigger at the network environment B side directly triggers the request message body in the receiving table to be written into the message queue of the exchange database at the network environment B side through the Insert operation;
[0017] (3) The border gateway at the B end of the network environment starts a multi-threaded listening message queue based on the JMS protocol, and directly obtains the request message body from the message queue.
[0018] Further, the step of writing the response message body into a switching table in a switching database according to the response switching configuration information, and monitoring a message queue in the switching database through a border gateway at the A end of the network environment to obtain the response message body, further comprises the following steps:
[0019] (1) writing the response message body into the exchange table in the exchange database at the network environment end B, the optical gate switch reads the response message body from the exchange table at the network environment end B according to the response exchange configuration information, and directly writes the response message body into the receiving table in the exchange database at the network environment end A through an Insert operation; wherein the receiving table at the network environment end A has a trigger;
[0020] (2) The trigger at the network environment A end directly triggers the response message body in the receiving table to be written into the message queue of the exchange database at the network environment A end through the Insert operation;
[0021] (3) The border gateway at the A end of the network environment starts a multi-threaded listening message queue based on the JMS protocol, and directly obtains the response message body from the message queue.
[0022] Further, the FTP exchange directory is polled by the border gateway to obtain the request message body or the response message body, wherein the border gateway works in a cluster manner and includes multiple border gateway nodes, each border gateway node includes the main working process after the node is started and various sub-processes related to node allocation, and the various sub-processes related to node allocation include the main node election process, the pre-allocated node sharding process and the self-allocated sharding process, which are as follows:
[0023] The main work flow after the node is started includes the following steps:
[0024] (1) Start the service, register the node as a working node, and send heartbeats regularly;
[0025] (2) Master node detection, including whether a master node exists and whether the current node is a master node; if there is no master node, the master node election process is entered; if there is a master node and the current node is a master node, the pre-allocation node sharding process is entered;
[0026] (3) Fragment detection: determine whether the fragments held by this node are consistent with the fragments pre-allocated by the master node. If they are inconsistent, enter the self-allocation fragmentation process; if they are consistent, work normally and poll the sub-directories of the FTP exchange directory according to the allocated fragments.
[0027] Furthermore, the master node election process includes the following steps:
[0028] (1) Obtain the master node election information. If there is an election record for another node and it is within the validity period, give up the election. Otherwise, update the election information to this node.
[0029] (2) Try to obtain the master node election information again. If it is the current node and it is within the cycle, the election is successful and the sub-process ends. Otherwise, repeat the master node election process.
[0030] Furthermore, the pre-allocation node sharding process includes the following steps:
[0031] (1) Determine whether the currently allocated nodes are balanced. The conditions for determining imbalance are as follows:
[0032] Condition 1: If there is a heartbeat expired node, kick out the node;
[0033] Condition 2: All current working nodes have not yet allocated all shards;
[0034] Condition 3: The number of shards held by a node differs from the average by more than 1;
[0035] (2) Pre-allocate node shards and evenly distribute the shards to all valid nodes. When the pre-allocation is completed, the sub-process ends.
[0036] Furthermore, the self-allocation sharding process includes the following steps:
[0037] (1) If the shards held by the current node are allocated to other nodes, the current node abandons these shards;
[0038] (2) Try to obtain the shard that is assigned to you but you do not hold. If the shard is currently held by other nodes, repeat this step until the shard is successfully obtained.
[0039] (3) The shards held by the current node are consistent with the pre-allocated ones, and the sub-process ends.
[0040] The method for efficient data exchange in a cross-physical network environment provided by the present invention has the following advantages:
[0041] (1) The database avoids the traditional method of timing task extraction and uses advanced message queue technology to effectively avoid slow queries caused by data backlogs and shorten the gap between data landing and extraction. Since the advanced queue itself is based on standard protocols, it is conducive to the continuous iteration and development of upper-layer technologies, and also has practical guarantees in terms of performance and security;
[0042] (2) When using the FTP server for data storage, the present invention uses hashing technology to dynamically balance multiple FTP channels and disperse storage, which is conducive to targeted extraction according to business and data types, making maximum use of dedicated switching physical equipment, and all nodes of the receiving end boundary program are extracted simultaneously, thereby improving the concurrent capacity of FTP exchange;
[0043] (3) The present invention provides a unified border gateway program to achieve efficient data flow across the border of a cross-network environment. The program automatically selects database exchange or FTP exchange according to the real-time requirements of the data. After using the software of the present invention, the cross-network business system can achieve simple and fast service interface calls. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.
[0045] Figure 1 A flow chart of the method for efficient data exchange in a cross-physical network environment provided by the present invention.
[0046] Figure 2 This is a flow chart of the application of the database message protocol provided by the present invention.
[0047] Figure 3 The present invention provides a workflow diagram for the border gateway to poll the FTP exchange directory.
[0048] Figure 4 This is a schematic diagram of the subdirectory allocation results of the FTP exchange directory provided by the present invention. DETAILED DESCRIPTION
[0049] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation method, structure, characteristics and effects of a method for efficient data exchange across a physical network environment proposed by the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] In this embodiment, a method for efficiently exchanging data across a physical network environment is provided. Figure 1 As shown, data is exchanged between network environment end A and network environment end B through an optical switch, and the method for efficient data exchange across physical network environments includes the following steps:
[0051] Step S1: Initiate a cross-network exchange request through any business service at end A of the network environment, and provide a request message body in the agreed format;
[0052] Step S2: parsing the request message body through the border gateway at the end A of the network environment to obtain the request exchange configuration information, and writing the request message body into the exchange table or FTP exchange directory in the exchange database according to the request exchange configuration information;
[0053] Step S3: monitoring the message queue in the exchange database or polling the FTP exchange directory through the border gateway at the B end of the network environment to obtain the request message body;
[0054] Step S4: parsing the request message body through the border gateway at the network environment B end to obtain request routing configuration information, and selecting a target business service from the network environment B end according to the request routing configuration information;
[0055] Step S5: calling the target business service through the border gateway at the B end of the network environment to obtain a response message body;
[0056] Step S6: parsing the response message body through the border gateway at the B end of the network environment to obtain response exchange configuration information, and writing the response message body into the exchange table in the exchange database or the FTP exchange directory according to the response exchange configuration information;
[0057] Step S7: monitoring the message queue in the exchange database or polling the FTP exchange directory through the border gateway at the A end of the network environment to obtain the response message body;
[0058] Step S8: Parse the response message body through the border gateway at the network environment A end to obtain response routing configuration information, select the target business service from the network environment A end according to the response routing configuration information, and return the response message body to the target business service in the network environment A end; wherein, the target business service in the network environment A end is the business service that initiates the cross-network exchange request in step S1.
[0059] Preferably, if Figure 2As shown, the request message body is written into the exchange table in the exchange database according to the request exchange configuration information; the message queue in the exchange database is monitored by the border gateway at the B end of the network environment to obtain the request message body, and the following steps are also included:
[0060] (1) writing the request message body into the exchange table in the exchange database at the network environment end A, the optical gate switch reads the request message body from the exchange table at the network environment end A according to the request exchange configuration information, and directly writes the request message body into the receiving table in the exchange database at the network environment end B through an Insert operation; wherein the receiving table at the network environment end B has a trigger;
[0061] (2) The trigger at the network environment B side directly triggers the request message body in the receiving table to be written into the message queue of the exchange database at the network environment B side through the Insert operation;
[0062] (3) The border gateway at the B end of the network environment starts a multi-threaded listening message queue based on the JMS protocol, and directly obtains the request message body from the message queue.
[0063] Preferably, if Figure 2 As shown, the response message body is written into the exchange table in the exchange database according to the response exchange configuration information, and the message queue in the exchange database is monitored by the border gateway at the A end of the network environment to obtain the response message body, and the following steps are also included:
[0064] (1) writing the response message body into the exchange table in the exchange database at the network environment end B, the optical gate switch reads the response message body from the exchange table at the network environment end B according to the response exchange configuration information, and directly writes the response message body into the receiving table in the exchange database at the network environment end A through an Insert operation; wherein the receiving table at the network environment end A has a trigger;
[0065] (2) The trigger at the network environment A end directly triggers the response message body in the receiving table to be written into the message queue of the exchange database at the network environment A end through the Insert operation;
[0066] (3) The border gateway at the A end of the network environment starts a multi-threaded listening message queue based on the JMS protocol, and directly obtains the response message body from the message queue.
[0067] Preferably, if Figure 3As shown, the FTP exchange directory is polled by the border gateway to obtain the request message body or the response message body, wherein the border gateway works in a cluster manner and includes multiple border gateway nodes, each border gateway node includes the main work process after the node is started and various sub-processes related to node allocation, and the various sub-processes related to node allocation include the main node election process, the pre-allocated node sharding process and the self-allocated sharding process, which are as follows:
[0068] The main work flow after the node is started includes the following steps:
[0069] (1) Start the service, register the node as a working node, and send heartbeats regularly;
[0070] (2) Master node detection, including whether a master node exists and whether the current node is a master node; if there is no master node, the master node election process is entered; if there is a master node and the current node is a master node, the pre-allocation node sharding process is entered;
[0071] (3) Fragment detection: determine whether the fragments held by this node are consistent with the fragments pre-allocated by the master node. If they are inconsistent, enter the self-allocation fragmentation process; if they are consistent, work normally and poll the sub-directories of the FTP exchange directory according to the allocated fragments.
[0072] The master node election process includes the following steps:
[0073] (1) Obtain the master node election information. If there is an election record for another node and it is within the validity period, give up the election. Otherwise, update the election information to this node.
[0074] (2) Try to obtain the master node election information again. If it is the current node and it is within the cycle, the election is successful and the sub-process ends. Otherwise, repeat the master node election process.
[0075] The pre-allocation node sharding process includes the following steps:
[0076] (1) Determine whether the currently allocated nodes are balanced. The conditions for determining imbalance are as follows:
[0077] Condition 1: If there is a heartbeat expired node, kick out the node;
[0078] Condition 2: All current working nodes have not yet allocated all shards;
[0079] Condition 3: The number of shards held by a node differs from the average by more than 1;
[0080] (2) Pre-allocate node shards and evenly distribute the shards to all valid nodes. When the pre-allocation is completed, the sub-process ends.
[0081] The self-allocation sharding process includes the following steps:
[0082] (1) If the shards held by the current node are allocated to other nodes, the current node abandons these shards;
[0083] (2) Try to obtain the shard that is assigned to you but you do not hold. If the shard is currently held by other nodes, repeat this step until the shard is successfully obtained.
[0084] (3) The shards held by the current node are consistent with the pre-allocated ones, and the sub-process ends.
[0085] like Figure 4 As shown, an FTP exchange directory has 32 subdirectories by default, numbered 01-32, that is, there are 32 shards. Assuming that the number of running border gateway nodes gradually increases from 1 to 4, the allocation results are as follows:
[0086] (1) There is only one node A, all shards are assigned to node A, and node A holds 32 shards;
[0087] (2) For two nodes A and B, 16 shards are removed from the shards held by node A and given to node B. At this time, nodes A and B each hold 16 shards.
[0088] (3) The three nodes A, B, and C remove 5 shards from the shards held by nodes A and B respectively and give them to node C. At this time, nodes A and B hold 11 shards, and node C holds 10 shards.
[0089] (4) The four nodes A, B, C, and D remove three shards from the shards held by nodes A and B and give them to node D, and remove two shards from the shards held by node C and give them to node D. At this time, nodes A, B, C, and D each hold eight shards.
[0090] In this embodiment, the database advanced queue component Advance Queue technology is used in the exchange database, and the border gateway listens to the database message queue through the JMS protocol. After the data is exchanged from the network database at one end to the network database at the other end, the trigger drives the data to be written into the database message queue. The data in the queue table is pushed back to the border gateway through the JMS protocol according to the first-in-first-out principle.
[0091] Specifically, the database message protocol technology is used to actively drive data into the receiving channel. By developing a border gateway program at the border, the protocol barriers are broken down so that after the data enters the database, it can be sensed in real time and transferred to specific business services.
[0092] In this embodiment, some provinces with large business volume uniformly deploy a set of systems in a dedicated network environment, and each prefecture-level city also deploys a set of systems in its own dedicated network environment. In this way, the physical isolation between different dedicated networks of provinces and cities requires data exchange to be completed through switching equipment. Some prefecture-level cities have multiple sets of switching equipment, and adopt a multi-channel FTP sharding solution, which can effectively improve the physical exchange speed based on FTP, reduce data concentration congestion, and single point failure affects the global exchange risk. The present invention provides a data exchange solution based on hash hashing technology to dynamically balance multiple FTP channels, and on the FTP server, a maximum of 32 subfolders are generated according to the business exchange data type, and independent threads are allocated to each group of 4 to 8 subfolders to meet the efficiency of efficient storage and retrieval of batch data.
[0093] Specifically, a multi-channel FTP fragmentation scheme is adopted to dynamically balance the data exchange of multiple channels based on hashing technology. On the FTP server, a maximum of 32 subfolders are dynamically calculated and generated, and the 32 subfolders are evenly distributed to all running border gateways. All nodes of the border gateway read the FTP subfolders at the same time, further improving the efficiency of data storage and retrieval.
[0094] The present invention provides a method for efficient data exchange in a cross-physical network environment. On the basis of the ability to exchange database tables and FTP files provided by a secure isolation optical gate, the method realizes high concurrency, high throughput, and low latency cross-physical network environment data exchange based on database message protocol application technology and multi-channel FTP fragmentation technology, thereby improving application software integration and usability and having a wide range of applications.
[0095] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A method for efficient data exchange in a cross-physical network environment, characterized in that: Data is exchanged between the network environment A end and the network environment B end through an optical switch. The method for efficient data exchange across a physical network environment comprises the following steps: Step S1: Initiate a cross-network exchange request through any business service at end A of the network environment, and provide a request message body in the agreed format; Step S2: parsing the request message body through the border gateway at the end A of the network environment to obtain the request exchange configuration information, and writing the request message body into the FTP exchange directory according to the request exchange configuration information; Step S3: polling the FTP exchange directory through the border gateway at the B end of the network environment to obtain the request message body; Step S4: parsing the request message body through the border gateway at the network environment B end to obtain request routing configuration information, and selecting a target business service from the network environment B end according to the request routing configuration information; Step S5: calling the target business service through the border gateway at the B end of the network environment to obtain a response message body; Step S6: parsing the response message body through the border gateway at the network environment B end to obtain response exchange configuration information, and writing the response message body into the FTP exchange directory according to the response exchange configuration information; Step S7: polling the FTP exchange directory through the border gateway at the end A of the network environment to obtain the response message body; Step S8: parsing the response message body through the border gateway at the network environment A end to obtain response routing configuration information, selecting a target business service from the network environment A end according to the response routing configuration information, and returning the response message body to the target business service at the network environment A end; wherein the target business service at the network environment A end is the business service that initiated the cross-network exchange request in step S1; Among them, the FTP exchange directory is polled by the border gateway to obtain the request message body or the response message body, wherein the border gateway works in a cluster manner, including multiple border gateway nodes, each border gateway node includes the main working process after the node is started and various sub-processes related to node allocation, and the various sub-processes related to node allocation include the main node election process, the pre-allocated node sharding process and the self-allocated sharding process, which are as follows: The main work flow after the node is started includes the following steps: (1) Start the service, register the node as a working node, and send heartbeats regularly; (2) Master node detection, including whether a master node exists and whether the current node is a master node; if there is no master node, the master node election process is entered; if there is a master node and the current node is a master node, the pre-allocation node sharding process is entered; (3) Fragment detection, judging whether the fragments held by the node are consistent with the fragments pre-allocated by the master node. If they are inconsistent, the node enters the self-allocation fragmentation process; if they are consistent, the node works normally and polls the subdirectories of the FTP exchange directory according to the allocated fragments; The pre-allocation node sharding process includes the following steps: (1) Determine whether the currently allocated nodes are balanced. The conditions for determining imbalance are as follows: Condition 1: If there is a heartbeat expired node, kick out the node; Condition 2: All current working nodes have not yet allocated all shards; Condition 3: The number of shards held by a node differs from the average by more than 1; (2) Pre-allocate node shards and evenly distribute the shards to all valid nodes. After the pre-allocation is completed, the sub-process ends. The self-allocation sharding process includes the following steps: (1) If the shards held by the current node are allocated to other nodes, the current node abandons these shards; (2) Try to obtain the shard that is assigned to you but you do not hold. If the shard is currently held by other nodes, repeat this step until the shard is successfully obtained. (3) The shards held by the current node are consistent with the pre-allocated ones, and the sub-process ends; Among them, an FTP exchange directory has 32 subdirectories by default, numbered 01-32, that is, there are 32 fragments, and the allocation results are as follows: (1) There is only one node A, all shards are assigned to node A, and node A holds 32 shards; (2) For two nodes A and B, 16 shards are removed from the shards held by node A and given to node B. At this time, nodes A and B each hold 16 shards. (3) The three nodes A, B, and C remove 5 shards from the shards held by nodes A and B respectively and give them to node C. At this time, nodes A and B hold 11 shards, and node C holds 10 shards. (4) The four nodes A, B, C, and D remove three shards from the shards held by nodes A and B and give them to node D, and remove two shards from the shards held by node C and give them to node D. At this time, nodes A, B, C, and D each hold eight shards.
2. The method for efficient data exchange in a cross-physical network environment according to claim 1, characterized in that: The master node election process includes the following steps: (1) Obtain the master node election information. If there is an election record for another node and it is within the validity period, give up the election. Otherwise, update the election information to this node. (2) Try to obtain the master node election information again. If it is the current node and it is within the cycle, the election is successful and the sub-process ends. Otherwise, repeat the master node election process.
Citation Information
Patent Citations
Downloading method, system, P2P server and client
CN101635737A
Metadata distribution method and device based on directory partition
CN103136338A
Data transmission method and data transmission system based on distributed FTP
CN104519138A
Method and device for reading distributed metadata files
CN107315547A
A method and a device for realizing cross-gateway Oracle database synchronization based on CMSP
CN109325072A
