CN113315708B - System, method, computer equipment and storage medium for realizing grid gateway - Google Patents

System, method, computer equipment and storage medium for realizing grid gateway Download PDF

Info

Publication number
CN113315708B
CN113315708B CN202110860470.5A CN202110860470A CN113315708B CN 113315708 B CN113315708 B CN 113315708B CN 202110860470 A CN202110860470 A CN 202110860470A CN 113315708 B CN113315708 B CN 113315708B
Authority
CN
China
Prior art keywords
gateway
gateway node
node
current
rasterized
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110860470.5A
Other languages
Chinese (zh)
Other versions
CN113315708A (en
Inventor
甘兵
廖瑞毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Digital Guangdong Network Construction Co Ltd
Original Assignee
Digital Guangdong Network Construction Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Digital Guangdong Network Construction Co Ltd filed Critical Digital Guangdong Network Construction Co Ltd
Priority to CN202110860470.5A priority Critical patent/CN113315708B/en
Publication of CN113315708A publication Critical patent/CN113315708A/en
Application granted granted Critical
Publication of CN113315708B publication Critical patent/CN113315708B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/48Routing tree calculation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses a system and a method for realizing a rasterized gateway, computer equipment and a storage medium. The system comprises two or more gateway nodes, wherein each gateway node stores identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores network address information of the gateway node through a target gateway node in each associated gateway node. According to the technical scheme provided by the embodiment of the invention, unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by utilizing the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, and network interaction among different gateways is realized without adopting a preset complex gateway algorithm, so that the scheduling overhead among different gateway nodes in the rasterized gateway is reduced, and the convenience and the efficiency of the network interaction among different gateway nodes are further improved.

Description

System, method, computer equipment and storage medium for realizing grid gateway
Technical Field
The embodiment of the invention relates to the technical field of gateway control, in particular to a system and a method for realizing a rasterized gateway, computer equipment and a storage medium.
Background
In the existing network communication, the gateway, as a service component between the client and the background application and between the client and the server, can provide routing management functions such as network transmission, traffic management, service monitoring, and the like.
At present, in each service system, gateways often exist as a single subsystem, that is, each gateway only mounts each micro service supported in one service system, so that the gateways in each service system exist independently. At this time, if there is a network interaction requirement for service collaborative linkage between service systems, considering that there are problems of management dispersion, system complexity, different service standards, etc. in each service system, a gateway in each service system needs to adopt a complex algorithm to implement corresponding network interaction, resulting in problems of insufficient service collaborative linkage between multiple service systems and great gateway scheduling overhead, which greatly affects network interaction performance between multiple service systems.
Disclosure of Invention
The embodiment of the invention provides a system and a method for realizing a rasterized gateway, computer equipment and a storage medium, which realize the unified management and the cooperative linkage among different gateway nodes in the rasterized gateway, improve the convenient network interaction among the different gateway nodes in the rasterized gateway and reduce the scheduling overhead among the different gateway nodes.
In a first aspect, an embodiment of the present invention provides a system for implementing a rasterized gateway, where the system includes: each gateway node stores the identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores the network address information of the gateway node through a target gateway node in each associated gateway node; wherein the content of the first and second substances,
when a current gateway node joins the rasterized gateway, a seed gateway node is determined from the rasterized gateway, and an associated gateway node of the current gateway node in the rasterized gateway is retrieved through a gateway routing table dynamically maintained on the seed gateway node, so as to generate a gateway routing table of the current gateway node;
and the current gateway node retrieves a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using a micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path.
In a second aspect, an embodiment of the present invention provides a method for implementing a rasterized gateway, where the method is applied to the system for implementing a rasterized gateway provided in the first aspect, and the method includes:
responding to a join request of a current gateway node facing the rasterized gateway, retrieving an associated gateway node of the current gateway node in the rasterized gateway through a gateway routing table dynamically maintained on a seed gateway node in the rasterized gateway, and generating a gateway routing table of the current gateway node;
searching a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using a micro service path arranged on the current gateway node, and storing the network address information of the current gateway node in the target gateway node according to the micro service path;
each gateway node in the rasterized gateway stores identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores network address information of the gateway node through a target gateway node in each associated gateway node.
In a third aspect, an embodiment of the present invention provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for implementing the rasterizing gateway according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for implementing a rasterization gateway according to any embodiment of the present invention.
The embodiment of the invention provides a system, a method, computer equipment and a storage medium for realizing a rasterized gateway.A plurality of gateway nodes are added into the rasterized gateway, when each current gateway node is added into the rasterized gateway, a seed gateway node is determined from the rasterized gateway, each associated gateway node of the current gateway node in the rasterized gateway is searched in a gateway routing table dynamically maintained on the seed gateway node, and the gateway routing table of the current gateway node is generated by adopting the identification information of each associated gateway node, so that each gateway node added into the rasterized gateway stores the identification information of each associated gateway node of the gateway node in the rasterized gateway through the gateway routing table dynamically maintained on the gateway node; moreover, the current gateway node searches a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path, so that each gateway node added in the rasterized gateway can store the network address information of the gateway node on the target gateway node; therefore, unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by utilizing the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, and network interaction among different gateways is realized without adopting a preset complex gateway algorithm, so that the scheduling overhead among different gateway nodes in the rasterized gateway is reduced, and the convenience and the efficiency of the network interaction among different gateway nodes are further improved.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1A is a schematic diagram of an architecture of a rasterized gateway in an implementation system of the rasterized gateway according to an embodiment of the present invention;
fig. 1B is a schematic diagram of a gateway routing table of each gateway node in the system according to the first embodiment of the present invention;
fig. 2A is a schematic diagram of a gateway transmission protocol in a rasterized gateway according to a second embodiment of the present invention;
fig. 2B is a schematic diagram illustrating a principle of storing network address information in a rasterized gateway according to a second embodiment of the present invention;
fig. 3 is a flowchart of an implementation method of a rasterized gateway according to a third embodiment of the present invention;
fig. 4 is a flowchart of responding to a microservice request in an implementation method of a rasterized gateway according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures. In addition, the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
The embodiment of the invention mainly aims at the problem that when all gateways oriented to different service systems exist independently as single subsystems, if interaction of service collaborative linkage is executed among different gateways, gateway scheduling overhead is extremely high, and network interaction performance among different gateways is influenced, so that a plurality of independent gateways are combined to be managed in a unified mode to generate corresponding rasterized gateways, and all the independent gateways are different gateway nodes added into the rasterized gateways. Meanwhile, a gateway routing table is dynamically maintained on each gateway node in the rasterized gateway to store identification information of each associated gateway node of the gateway node in the rasterized gateway, and each gateway node can search out a corresponding target gateway node from each associated gateway node stored in the gateway routing table dynamically maintained thereon and store network address information of the gateway node on the target gateway node according to a micro service path set on the gateway node, so that unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by using the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, network interaction among different gateways is realized without adopting a preset complex gateway algorithm, and scheduling overhead among different gateway nodes in the rasterized gateway is reduced, the convenience and the efficiency of network interaction among different gateway nodes are further improved.
Example one
Fig. 1A is a schematic diagram of an architecture of a rasterized gateway in an implementation system of the rasterized gateway according to an embodiment of the present invention, which is applicable to a case where network interaction needs to be performed between independent gateways corresponding to multiple service systems. Referring to fig. 1A, the system for implementing a rasterized gateway in the present embodiment may include two or more gateway nodes 10.
Each gateway node 10 stores identification information of each associated gateway node in the rasterized gateway through the dynamically maintained gateway routing table 110 thereof, and stores network address information of the gateway node through a target gateway node in each associated gateway node.
Specifically, when a current gateway node joins a rasterized gateway, a seed gateway node is determined from the rasterized gateway, and a gateway routing table of the current gateway node in the rasterized gateway is retrieved through a gateway routing table dynamically maintained on the seed gateway node to generate a gateway routing table of the current gateway node; and the current gateway node searches a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path.
In this embodiment, each gateway node is continuously added to the rasterized gateway to expand the coordinated linkage range of the rasterized gateway, so as to obtain a transmission network composed of a plurality of gateways. At this time, the gateway node that first joined the rasterized gateway is referred to as a create node (geneside node), and since there is no second gateway node in the rasterized gateway, the gateway routing table that was first maintained on the create node is empty. When a second gateway node joins the rasterized gateway, because only the first added created node exists in the rasterized gateway, the created node is used as a corresponding seed gateway node, and then the two gateway nodes can exchange respective gateway information and store the gateway information, for example, the created node can store identification information of the second gateway node joining the rasterized gateway in a dynamically maintained gateway routing table on the created node, and the second gateway node can store identification information of the created node in the dynamically maintained gateway routing table on the created node; moreover, because only the identification information of the opposite node exists in the gateway routing table of each gateway node, the opposite node is directly used as a target gateway node corresponding to the own node, so that the created node can store the network address information of the created node on the second added gateway node according to each micro service path by analyzing each micro service path mounted on the created node, and the network address information of the second added gateway node in the rasterized gateway can also be stored on the created node according to each micro service path by analyzing each micro service path mounted on the created node; therefore, on the basis that the two gateway nodes are added into the rasterization gateway, the system linkage range of the rasterization gateway is expanded by continuously adding new gateway nodes, so that the rasterization gateway in the embodiment at least comprises two gateway nodes.
It should be noted that, considering the problems of management dispersion of the Government platform and application construction, unsmooth service sharing, and insufficient service collaboration linkage among multiple Government systems across departments, levels, and regions, the rasterized Gateway in this embodiment may be set as a Government Gateway applied in a Government management scenario, so that multiple Gateway nodes form a corresponding Government Transport Protocol (GTP) network, and a Gateway Routing Table dynamically maintained on each Gateway node may be a Government Gateway fragmented Routing Table (GAGSRT).
When a new gateway node is added into a rasterized gateway every time, in order to ensure convenient interaction between the new gateway node and each gateway node added into the rasterized gateway, a corresponding gateway routing table needs to be generated for the new gateway node to know the characteristics of some other gateway nodes added into the rasterized gateway, and a target gateway node corresponding to a new gateway node needs to be screened from each gateway node added into the rasterized gateway, so as to store the network address information of the new gateway node on the target gateway node according to each micro-service path mounted on the new gateway node, thereby establishing a corresponding network connection relationship between the new gateway node and a certain specific gateway node in the rasterized gateway, and realizing unified management and cooperative linkage between different gateway nodes in the rasterized gateway.
Taking the current gateway node as a new gateway node added in the rasterization gateway each time as an example, a detailed explanation is made on a specific process of each new gateway node when adding in the rasterization gateway:
1) the process of generating the gateway routing table of the current gateway node is as follows:
when a current gateway node (denoted as CurNode) requests to join a rasterized gateway, a node context where the current gateway node is located is initialized through a front-end development framework (e.g., nodebonstrap) for node processing, and identification information (e.g., NodeId) of the current gateway node is determined according to a configuration file on the current gateway node, for example, the identification information of the current gateway node may be 0101xxx …, the first four bits (0101) may represent a division code of a region where the current gateway node is located, and the subsequent xxx … may be a result of performing hash coding on data after the first four bits by using a public key (public key) of the current gateway node, so as to be used for security identity authentication of the current gateway node. Considering that each gateway node in the rasterized gateway can set identification information according to the region where the gateway node is located, and the like, the identification information of different gateway nodes in the same region can have the same prefix, and in the identification information of different gateway nodes, if the number of bits of the leftmost common prefix is more, the different gateway nodes are more relevant, so that the embodiment can analyze the relevance between the different gateway nodes by using the identification information of different gateway nodes.
After the identification information of the current gateway node is determined, a certain gateway node added in the rasterized gateway is required to be used as a seed gateway node (marked as a seed node) to be responsible for the preprocessing work of the current gateway node for adding in the rasterized gateway, at this time, the seed gateway node of the current gateway node is set in the configuration file of the current gateway node, and the seed gateway node can be a founder node in the rasterized gateway or any gateway node which is known and trusted by the current gateway node. Then, the current gateway node establishes communication connection with the seed gateway node according to its own configuration file, and sends a corresponding node retrieval instruction (e.g., retrieval _ node) in the rasterized gateway, where a parameter in the node retrieval instruction is identification information (e.g., CurNode node id) of the current gateway node, so as to broadcast network information of the current gateway node in the rasterized gateway.
After receiving a node retrieval instruction sent by a current gateway node, a seed gateway node in a rasterized gateway first stores identification information of the current gateway node in a gateway routing table of the seed gateway node to refresh the gateway routing table. Meanwhile, the seed gateway node executes the node search instruction in the gateway routing table dynamically maintained thereon, that is, in the gateway routing table (GAGSRT) dynamically maintained thereon, corresponding exclusive or operation (CurNode node id @ node id) is asynchronously executed between a parameter (CurNode node id) in the node search instruction and identification information (node id) of each gateway node stored in the gateway routing table (GAGSRT). Therefore, the seed gateway node can search out information of phi (default is 3) gateway nodes corresponding to the situation that the number of bits with the leftmost common prefix being 0 is the maximum according to the number of bits with the leftmost common prefix being 0 in the plurality of exclusive-or results, and the information is used as each associated gateway node of the current gateway node in the rasterized gateway. Then, the seed gateway node may perform encoding processing on the identification information of each associated gateway node, so as to generate a corresponding response stream by using a transmission protocol in a rasterized gateway for the result of the serialization of each associated gateway node, and send the response stream to the current gateway node.
The current gateway node decodes the coded response stream to obtain information of each associated gateway node retrieved from a gateway routing table of the seed gateway node, so that the gateway routing table of the current gateway node is generated by using the identification information of each associated gateway node, and the gateway routing table is used for storing the identification information of each associated gateway node of the current gateway node in the rasterized gateway.
It should be noted that, in the gateway routing table of each gateway node in the rasterized gateway of this embodiment, different slot positions may be used to store the identification information of each first-level associated gateway node of the gateway node, and the slot point chain table of the slot position in which each first-level associated gateway node is located is used to store the identification information of each second-level associated gateway node below the first-level associated gateway node.
For example, as shown in fig. 1B, in retrieving each associated gateway node of the current gateway node in the rasterized gateway, the seed gateway node may perform an exclusive or operation on the identification information of the current gateway node and the identification information of each gateway node stored in the slot position array in the gateway routing table of the seed gateway node, and also perform an exclusive or operation on the identification information of the current gateway node and the identification information of the gateway nodes stored in each slot point under each slot position, thereby retrieving information of phi gateway nodes having the most significant digits and having the leftmost common prefix of 0 as each first-level associated gateway node of the current gateway node, and using the information of the gateway nodes stored in each slot point in the slot point linked list connected after each first-level associated gateway node in the gateway routing table of the seed gateway node as each second-level associated gateway node of the current gateway node under the first-level associated gateway node, therefore, in the gateway routing table of the current gateway node, different slot positions in the slot position array are adopted to respectively and correspondingly store the identification information of each primary associated gateway node, and then the identification information of each secondary associated gateway node under the primary associated gateway node is correspondingly stored in the slot point chain table of the slot position where each primary associated gateway node is located, so that the sequential storage of the gateway routing table is realized, and the retrieval efficiency of the gateway routing table of the current gateway node in the subsequent actual network interaction process is improved.
It should be noted that, in the rasterized Gateway of this embodiment, the number of the slots in the Gateway routing table of each Gateway node may be set to be the same as the number of bits (Gateway node id Bit, GWNIDBIT) of the identification information of the Gateway node, the number of the slot points in the slot point chain table of each slot may be set to be 8 by default, and at this time, the number of the slots and the number of the slot points under each slot may be adjusted according to the actual network condition in the rasterized Gateway, which is not limited in this embodiment. At this time, when a new primary associated gateway node and identification information of a new secondary associated gateway node under the primary associated gateway node are added in a gateway routing table of a current gateway node, whether a slot point chain table of a corresponding slot position in the gateway routing table is full needs to be judged, and if the slot point chain table is not full, the identification information of the new secondary associated gateway node is directly added; if the slot is full, a corresponding node detection instruction (Probe instruction) needs to be sent to the gateway node in each slot point in the slot point linked list of the corresponding slot position to judge whether the gateway node of each slot point is alive (online), if not, invalid slot points are directly eliminated, the identification information of a new secondary associated gateway node is added to the extracted corresponding slot point, if all the slot points are alive, the last slot point in the slot point linked list is deleted to add the identification information of the new secondary associated gateway node, and each slot point in the slot point linked list is reordered to ensure the accuracy of the gateway routing table of the current gateway node.
In addition, in order to ensure the comprehensive relevance between the gateway routing table of the current gateway node and each gateway node added in the rasterized gateway, so that when the current gateway node responds to the micro-service request set on another gateway node, the gateway node for executing the micro-service request can be quickly queried from the rasterized gateway, the gateway routing table of the current gateway node is comprehensively optimized and updated in the rasterized gateway by adopting the following two ways:
(1) and optimizing the gateway routing table of the current gateway node by using the actual addressing state of the current gateway node in the received micro-service request.
Specifically, after a current gateway node is added into a rasterized gateway, the current gateway node participates in network interaction between different gateway nodes, at this time, the current gateway node receives a corresponding micro-service request, the micro-service request includes identification information of a target gateway node for executing the micro-service request and a micro-service path mounted on the target gateway node in the micro-service request, then the current gateway node performs xor operation with a hash result of the micro-service path according to the identification information of each associated gateway node stored in a gateway routing table dynamically maintained on each gateway node in the rasterized gateway, so as to continuously route the current gateway node to the target gateway node corresponding to the target gateway node according to the number of bits with the leftmost common prefix of 0 in the xor result, thereby finding out network address information of the target gateway node according to the micro-service path in the target gateway node, the actual addressing of the destination gateway node is achieved. In this embodiment, to simplify the actual addressing flow of the destination gateway node, the relevance between the current gateway node and each gateway node in the routing process is continuously analyzed according to the actual addressing state of the destination gateway node, that is, the number of bits of the leftmost common prefix of 0 in the xor result is 0, so as to retrieve the gateway node whose number of bits of the leftmost common prefix of 0 in the xor result meets the requirement after performing xor operation with the identification information of the current gateway node in the routing process, and the gateway node is used as the associated gateway node of the current gateway node, and update the identification information of the associated gateway node into the gateway routing table of the current gateway node, at this time, the current gateway node can optimize the gateway routing table of the current gateway node for each received micro service request through the actual addressing state of the destination gateway node in each micro service request, and realizing the self-learning optimization process of the gateway routing table of the current gateway node.
(2) Continuously searching new associated gateway nodes of the current gateway node in the rasterized gateway from the gateway routing table dynamically maintained on each associated gateway node stored in the gateway routing table of the current gateway node, and iteratively updating the gateway routing table of the current gateway node until no new associated gateway node is searched in the rasterized gateway.
Specifically, after the gateway routing table of the current gateway node is preliminarily generated, a corresponding node retrieval instruction is sent to each associated gateway node stored in the gateway routing table, and the xor operation is continuously performed on the identification information of the current gateway node and the identification information of each gateway node stored in each gateway routing table in the gateway routing table of each associated gateway node, so that according to the retrieval flow of the node retrieval instruction, a new associated gateway node of the current gateway node in the rasterized gateway is retrieved in parallel from the gateway routing tables of each associated gateway node, and the identification information of the new associated gateway node is added in the gateway routing table of the current gateway node. And then, continuously sending corresponding node retrieval instructions to each newly-added associated gateway node in the gateway routing table updated by the current gateway node, and continuously retrieving the new associated gateway node in parallel in the gateway routing table of each newly-added associated gateway node according to the node retrieval flow so as to iteratively update the gateway routing table of the current gateway node until the new associated gateway node cannot be retrieved in the rasterized gateway, thereby realizing the association convergence of the gateway routing table of the current gateway node in the rasterized gateway.
2) The process of correspondingly storing the network address information of the current gateway node on the target gateway node according to the micro service path set on the current gateway node is as follows:
specifically, after the gateway routing table of the current gateway node is generated, it is considered that each micro service mounted on each gateway node is generally responded to in the actual network interaction process among different gateway nodes in the rasterized gateway, so in order to realize accurate response of the micro services on different gateway nodes in the rasterized gateway, the network address information of the current gateway node needs to be correspondingly stored in the target gateway node of the current gateway node according to each micro service path mounted on the current gateway node.
At this time, acquiring the micro service paths corresponding to the micro services mounted on the current gateway node, and considering that the micro service paths are relatively complicated, this embodiment may perform hash operation on the micro service paths to obtain hash results of the micro service paths, so that the hash results of the micro service paths are subsequently used for corresponding storage, and the occupied space when network address information is stored according to the micro service paths is reduced. For example, the current gateway node may execute an issue instruction (publish instruction) to issue each micro service governed by the current gateway node to phi other nodes (the target gateway node in this embodiment) with the leftmost common prefix being 0 and the largest number of bits according to an addressing algorithm in the gateway routing table.
That is, the current gateway node executes a node address retrieval instruction (retrieval _ url) in the gateway routing table dynamically maintained thereon, where a parameter of the node address retrieval instruction is a hash result (RootUrlHash) of the micro service path set on the current gateway node, that is, a corresponding exclusive or operation (RootUrlHash, NodeId) is asynchronously executed on the hash result (RootUrlHash) of the micro service path and the identification information of each gateway node stored in the gateway routing table of the current gateway node. Then, according to the digits of which the leftmost common prefix is 0 in the plurality of exclusive-or results, retrieving information of phi (default is 3) gateway nodes corresponding to the situation that the digits of which the leftmost common prefix is 0 are the most, and taking the information as a target gateway node retrieved from a gateway routing table dynamically maintained by the current gateway node. Furthermore, in the target gateway node, the network address information of the current gateway node may be correspondingly stored according to the hash result of the micro service path on the current gateway node, so that when a micro service request is subsequently received, the carried micro service path may be used to search the target gateway node for executing the micro service request, thereby implementing accurate response of the current gateway node to the micro service requests set on other gateway nodes.
According to the technical scheme provided by the embodiment, a plurality of gateway nodes are added into a rasterized gateway, when each current gateway node is added into the rasterized gateway, a seed gateway node is determined from the rasterized gateway, each associated gateway node of the current gateway node in the rasterized gateway is searched in a gateway routing table dynamically maintained on the seed gateway node, and the gateway routing table of the current gateway node is generated by adopting the identification information of each associated gateway node, so that each gateway node added into the rasterized gateway stores the identification information of each associated gateway node of the gateway node in the rasterized gateway through the gateway routing table dynamically maintained on the gateway node; moreover, the current gateway node searches a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path, so that each gateway node added in the rasterized gateway can store the network address information of the gateway node on the target gateway node; therefore, unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by utilizing the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, and network interaction among different gateways is realized without adopting a preset complex gateway algorithm, so that the scheduling overhead among different gateway nodes in the rasterized gateway is reduced, and the convenience and the efficiency of the network interaction among different gateway nodes are further improved.
Example two
Fig. 2A is a schematic diagram of a principle of a gateway transmission protocol in a rasterized gateway according to a second embodiment of the present invention, and fig. 2B is a schematic diagram of a principle of storing network address information in the rasterized gateway according to the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and this embodiment mainly explains in detail the gateway transmission protocol used when network transmission is performed in the rasterized gateway and the actual storage format of the network address information of the current gateway node by the target gateway node.
Optionally, the rasterized gateway of this embodiment includes two or more gateway nodes, each gateway node stores, through a gateway routing table dynamically maintained thereon, identification information of each associated gateway node of the gateway node in the rasterized gateway, and stores, through a target gateway node in each associated gateway node, network address information of the gateway node.
When the current gateway node is added into the rasterized gateway, a seed gateway node is determined from the rasterized gateway, and a gateway routing table of the current gateway node in the rasterized gateway is retrieved through a gateway routing table dynamically maintained on the seed gateway node to generate a gateway routing table of the current gateway node; and the current gateway node searches a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path.
Specifically, when network interaction is performed between different gateway nodes in a rasterized gateway each time, a gateway transmission protocol set in the rasterized gateway needs to be used to encapsulate a corresponding network message, and in order to ensure the simplicity of the network message, this embodiment optimizes the gateway transmission protocol supported in the rasterized gateway: the protocol header of the gateway transmission protocol supported by the rasterized gateway can adopt a hash mapping table maintained on each gateway node to set the header information of the network message on the gateway node, and support the dynamic extension of the header.
For example, the gateway transmission protocol in this embodiment may include a protocol header and a protocol body, where the protocol header may locate a corresponding header in the network message by using an index in a hash mapping table maintained on each gateway node, and the hash mapping table includes a key value key obtained by performing hash operation on identification information of each gateway node, so that the key value key of each header in the network message may be obtained according to the index in the hash mapping table, and a plurality of bytes corresponding to the identification information need not to be stored, and only a few bits after the hash operation are used, and an actual value of the header may also be further reduced by huffman coding.
As shown in fig. 2A, the gateway transport protocol requires that the first 2 bytes of the header in the network message can be used to represent a specific protocol, then the first 3 bits in 1 byte can be used to represent a specific message type, and the last 5 bits are used to represent a key value key after hash index of the message header name; next, 1 byte is used to represent the length hlength of the actual value of the head key value (where the value can be huffman coded); the following hlength byte can be the actual value corresponding to the head key; then the next head is analogized in turn until the head end mark bit is encountered finally and is 111, which indicates the head end; the first 27 bits of the 4 bytes after the head end mark can store the length of the message body in the network message, the last 3 bits can store the message body serialization mode, and the last blength bytes can store the serialized message body.
And when the network address information of the current gateway node is correspondingly stored in the target gateway node corresponding to the current gateway node according to the micro service path set on the current gateway node, the network address information of the current gateway node is stored by the target gateway node by adopting a tree structure. The root node of the tree structure may be configured to store a hash result of a micro service path on a current gateway node, and the leaf nodes of the tree structure may be configured to store network address information including identification information of the current gateway node, an Internet Protocol (IP) address, and a port.
Specifically, because a certain gateway node in the rasterized gateway serves as a target gateway node of a plurality of other gateway nodes, when the target gateway node correspondingly stores the network address information of the gateway node according to the micro service path set on each gateway node, the network address information of each gateway node is stored by using a tree structure, so as to form a cache forest, as shown in fig. 2B, each tree in the cache forest represents the network address information of the gateway node correspondingly stored according to the micro service path on the certain gateway node. Therefore, when the network address information of the current gateway node is correspondingly stored according to the micro service path set on the current gateway node, firstly, whether a target tree taking the hash result of the micro service path as a root node exists in the cache forest on the target gateway node is judged, if yes, the network address information of the current gateway node is directly taken as a leaf node of the target tree for storage, if not, a tree is newly built in the cache forest, the hash result of the micro service path on the current gateway node is taken as the root node of the newly-built tree, and the network address information of the current gateway node is taken as the leaf node of the newly-built tree, so that the network address information of the current gateway node is stored on the target gateway node.
It should be noted that, in order to ensure the accuracy and validity of the forest cache on the target gateway node, the target gateway node needs to continuously receive the persistent storage (for example, persistent publish) of the current gateway node on the network address information, and if the persistent storage of the current gateway node on the network address information is not received within a set time period (for example, 60 s), the sub-tree corresponding to the current gateway node is automatically invalidated, and the network address information storage of other gateway nodes is similar.
In addition, since each gateway node in the rasterized gateway may receive the micro service request executed by another gateway node, the rasterized gateway needs to address a destination gateway node corresponding to the micro service request, so that the destination gateway node executes a corresponding operation of the micro service request.
The process of responding to the micro service request received by the current gateway node by the rasterization gateway is as follows:
the first step is as follows: and responding to the micro-service request received by the current gateway node, and analyzing the micro-service path in the micro-service request and the identification information of the destination gateway node. That is, after the current gateway node receives a micro service request, the micro service request is first analyzed to obtain a micro service path (e.g.,/rootpath/a/b/c) carried in the micro service request and identification information of a destination gateway node that governs the micro service, so as to address the destination gateway node.
The second step is that: and if the identification information of the destination gateway node does not exist in the gateway routing table of the current gateway node, continuously traversing the gateway node information of the specified slot position in the gateway routing table of the current gateway node according to the XOR result between the Hash result of the micro-service path in the micro-service request and the identification information of the current gateway node, and searching the corresponding first gateway node.
Specifically, after analyzing the micro service path and the identification information of the destination gateway node in the micro service request, first, according to the identification information of each gateway node stored in the gateway routing table of the current gateway node, it is determined whether the identification information of the destination gateway node exists in the gateway routing table of the current gateway node, and if so, the addressing of the destination gateway node is completed. If not, performing hash operation on the micro service path in the micro service request to obtain a hash result of the micro service path (e.g., RootUrlHash = hash (rootpath)). Then, performing an exclusive-or operation (rooturrl hash ≧ CurNodeId) on the hash result of the micro service path and the identification information of the current gateway node to obtain a corresponding exclusive-or result (CurPrefixZeroNum), then determining a corresponding designated slot position from the gateway routing table of the current gateway node according to the digit number of which the leftmost common prefix in the exclusive-or result is 0, and determining whether the gateway node stored in the designated slot position is a target gateway node (i.e. the first gateway node in the embodiment) storing the micro service path, if not, continuing performing the exclusive-or operation on the identification information of the gateway node of the designated slot position and the identification information of the current gateway node to obtain a corresponding exclusive-or result, thereby determining a new designated slot position in the gateway routing table of the gateway node of the designated slot position, and continuing to determine whether the gateway node stored in the new designated slot position is the target gateway node storing the micro service path, and sequentially circulating according to the steps until the target gateway node (namely the first gateway node in the embodiment) storing the micro service path is found out.
For example, the specific traversal process when searching for the first gateway node in this embodiment may be: determining a designated slot position in a gateway routing table of the current gateway node according to the digit with the prefix of zero in the XOR result between the hash result of the micro service path in the micro service request and the identification information of the current gateway node; and according to the Hash result of the micro-service path in the micro-service request, performing parallel retrieval on the gateway routing tables of all gateway nodes corresponding to the specified slot position, if the first gateway node is not retrieved, taking the second gateway node which is retrieved in parallel as a new current gateway node, continuously determining the specified slot position in the gateway routing table of the new current gateway node so as to perform parallel retrieval on the gateway routing tables of all gateway nodes corresponding to the specified slot position until the first gateway node is retrieved.
That is, after performing an exclusive or operation on the hash result of the micro service path in the micro service request and the identification information of the current gateway node, a corresponding exclusive or result (CurPrefixZeroNum) is obtained, and a bit number (e.g., log CurPrefixZeroNum) with a prefix of zero in the exclusive or result is calculated. Then, the slot position in the (GWNIDBIT- [ log CurPrefix ZeroNum ]) position in the gateway routing table of the current gateway node is used as the designated slot position, and the gateway nodes stored by phi slot points in the slot point linked list connected with the designated slot position in the gateway routing table of the current gateway node are found out. If the number of slot points in the slot point linked list of the designated slot position is less than phi, the gateway nodes stored by the phi slot points cannot be found in the designated slot position, so that the gateway nodes stored by the phi slot points can be continuously found in the adjacent slot position of the designated slot position (GWNIDBIT- [ log CurPrefix Zeronum ]) in the gateway routing list of the current gateway node by adopting the same method.
Then, for each gateway node stored in the searched phi slot points, a node address retrieval instruction is executed in the searched gateway routing table of each gateway node, and an exclusive-or operation is performed on the hash result of the micro service path and the identification information of each gateway node stored in the gateway routing table of each gateway node, so as to retrieve a second gateway node when the number of bits with the leftmost common prefix of 0 is the most in the exclusive-or result in parallel. And, determining whether the second gateway node is a target gateway node (i.e. the first gateway node in the embodiment) storing the micro service path, if not, continuing to use the second gateway node retrieved in parallel as a new current gateway node, and according to the same steps, continuing to determine a specified slot position in the gateway routing table of the new current gateway node, so as to perform parallel retrieval on the gateway routing tables of the gateway nodes corresponding to the specified slot position, and sequentially looping until the first gateway node is retrieved.
The third step: and in the cache forest of the first gateway node, finding out a target tree pointed by the hash result of the micro-service path in the micro-service request, determining the network address information of the target gateway node from leaf nodes of the target tree, and sending the micro-service request to the target gateway node for response according to the network address information.
Specifically, after the first gateway node is retrieved, the network address information of the destination gateway node where the micro service path is located is stored in the first gateway node in a tree structure. At this time, in the cache forest of the first gateway node, the root node of each tree is compared with the hash result of the micro service path in the micro service request received by the current gateway node, so that the target tree pointed by the hash result of the micro service path is found out, the network address information of the destination gateway node is further determined from the leaf nodes of the target tree, the micro service request is sent to the destination gateway node according to the network address information, and the destination gateway node responds to the micro service request.
It should be noted that, when the micro service request responds, the addressing process of the destination gateway node is too complicated, so to improve the addressing efficiency of the destination gateway node, in this embodiment, each gateway node in the meshed gateway is provided with a multi-level cache index table, and the multi-level cache index table can be used to correspondingly store the network address information after the destination gateway node is addressed according to the hash result of the micro service path in the micro service request after the destination gateway node in the micro service request received by the gateway node is addressed, so that when the destination gateway node is addressed again by the previous gateway node, the network address information of the destination gateway node can be quickly searched directly from the multi-level cache index table provided on the current gateway node according to the hash result of the micro service path in the micro service request, thereby improving the addressing efficiency of the destination gateway node, the response efficiency of the micro service request in the grid gateway is guaranteed.
According to the technical scheme provided by the embodiment, the special gateway transmission protocol is set in the rasterized gateway, so that the packaging occupied space of the network message in the rasterized gateway is reduced, the simplicity of the network message is ensured, and the network interaction efficiency in the rasterized gateway is improved; in addition, by arranging a multi-level cache index table on each gateway node in the rasterized gateway, the network address information of the destination gateway node is continuously stored, the addressing efficiency of the destination gateway node is improved, and the response efficiency of the micro-service request in the rasterized gateway is ensured.
EXAMPLE III
Fig. 3 is a flowchart of an implementation method of a rasterized gateway according to a third embodiment of the present invention. The embodiment is applicable to a situation that network interaction needs to be performed between independent gateways corresponding to a plurality of service systems, and can be applied to the implementation system of the rasterization gateway provided by the embodiment of the present invention. The method for implementing a rasterized gateway provided by this embodiment may be executed by the electronic device provided by this embodiment of the present invention.
Specifically, as shown in fig. 3, the method may include the following steps:
s310, responding to a joining request of the current gateway node facing the rasterization gateway, searching the associated gateway node of the current gateway node in the rasterization gateway through the gateway routing table dynamically maintained on the seed gateway node in the rasterization gateway, and generating the gateway routing table of the current gateway node.
Each gateway node in the rasterized gateway stores identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores network address information of the gateway node through a target gateway node in each associated gateway node.
In this embodiment, when a current gateway node (denoted as CurNode) requests to join a rasterized gateway, a front-end development framework (e.g., nodebostruct) for node processing is first used to initialize a node context where the current gateway node is located, and identify information (e.g., NodeId) of the current gateway node is determined according to a configuration file on the current gateway node, for example, the identification information of the current gateway node may be 0101xxx …, the first four bits (0101) may represent a partition code of a region where the current gateway node is located, and the subsequent xxx … may be a result of performing hash coding on data after the first four bits by using a public key (public key) of the current gateway node, so as to be used for security authentication of the current gateway node. Considering that each gateway node in the rasterized gateway can set identification information according to the region where the gateway node is located, and the like, the identification information of different gateway nodes in the same region can have the same prefix, and in the identification information of different gateway nodes, if the number of bits of the leftmost common prefix is more, the different gateway nodes are more relevant, so that the embodiment can analyze the relevance between the different gateway nodes by using the identification information of different gateway nodes.
After the identification information of the current gateway node is determined, a certain gateway node added in the rasterized gateway is required to be used as a seed gateway node (marked as a seed node) to be responsible for the preprocessing work of the current gateway node for adding in the rasterized gateway, at this time, the seed gateway node of the current gateway node is set in the configuration file of the current gateway node, and the seed gateway node can be a founder node in the rasterized gateway or any gateway node which is known and trusted by the current gateway node. Then, the current gateway node establishes communication connection with the seed gateway node according to its own configuration file, and sends a corresponding node retrieval instruction (e.g., retrieval _ node) in the rasterized gateway, where a parameter in the node retrieval instruction is identification information (e.g., CurNode node id) of the current gateway node, so as to broadcast network information of the current gateway node in the rasterized gateway.
After receiving a node retrieval instruction sent by a current gateway node, a seed gateway node in a rasterized gateway first stores identification information of the current gateway node in a gateway routing table of the seed gateway node to refresh the gateway routing table. Meanwhile, the seed gateway node executes the node search instruction in the gateway routing table dynamically maintained thereon, that is, in the gateway routing table (GAGSRT) dynamically maintained thereon, corresponding exclusive or operation (CurNode node id @ node id) is asynchronously executed between a parameter (CurNode node id) in the node search instruction and identification information (node id) of each gateway node stored in the gateway routing table (GAGSRT). Therefore, the seed gateway node can search out information of phi (default is 3) gateway nodes corresponding to the situation that the number of bits with the leftmost common prefix being 0 is the maximum according to the number of bits with the leftmost common prefix being 0 in the plurality of exclusive-or results, and the information is used as each associated gateway node of the current gateway node in the rasterized gateway. Then, the seed gateway node may perform encoding processing on the identification information of each associated gateway node, so as to generate a corresponding response stream by using a transmission protocol in a rasterized gateway for the result of the serialization of each associated gateway node, and send the response stream to the current gateway node.
The current gateway node decodes the coded response stream to obtain information of each associated gateway node retrieved from a gateway routing table of the seed gateway node, so that the gateway routing table of the current gateway node is generated by using the identification information of each associated gateway node, and the gateway routing table is used for storing the identification information of each associated gateway node of the current gateway node in the rasterized gateway.
It should be noted that, in the gateway routing table of each gateway node in the rasterized gateway of this embodiment, different slot positions may be used to store the identification information of each first-level associated gateway node of the gateway node, and the slot point chain table of the slot position in which each first-level associated gateway node is located is used to store the identification information of each second-level associated gateway node below the first-level associated gateway node.
Illustratively, when retrieving each associated gateway node of the current gateway node in the rasterized gateway, the seed gateway node may perform an exclusive-or operation on the identification information of the current gateway node and the identification information of each gateway node stored in the slot position array in the gateway routing table of the seed gateway node, and may also perform an exclusive-or operation on the identification information of the current gateway node and the identification information of the gateway nodes stored in each slot point under each slot position, thereby retrieving information of phi gateway nodes having the most significant digits and having the leftmost common prefix of 0 as each first-level associated gateway node of the current gateway node, and using the information of the gateway node stored in each slot point in a slot point linked list connected after each first-level associated gateway node in the gateway routing table of the seed gateway node as each second-level associated gateway node of the current gateway node under the first-level associated gateway node, therefore, in the gateway routing table of the current gateway node, different slot positions in the slot position array are adopted to respectively and correspondingly store the identification information of each primary associated gateway node, and then the identification information of each secondary associated gateway node under the primary associated gateway node is correspondingly stored in the slot point chain table of the slot position where each primary associated gateway node is located, so that the sequential storage of the gateway routing table is realized, and the retrieval efficiency of the gateway routing table of the current gateway node in the subsequent actual network interaction process is improved.
It should be noted that, in the rasterized Gateway of this embodiment, the number of the slots in the Gateway routing table of each Gateway node may be set to be the same as the number of bits (Gateway node id Bit, GWNIDBIT) of the identification information of the Gateway node, the number of the slot points in the slot point chain table of each slot may be set to be 8 by default, and at this time, the number of the slots and the number of the slot points under each slot may be adjusted according to the actual network condition in the rasterized Gateway, which is not limited in this embodiment. At this time, when a new primary associated gateway node and identification information of a new secondary associated gateway node under the primary associated gateway node are added in a gateway routing table of a current gateway node, whether a slot point chain table of a corresponding slot position in the gateway routing table is full needs to be judged, and if the slot point chain table is not full, the identification information of the new secondary associated gateway node is directly added; if the slot is full, a corresponding node detection instruction (Probe instruction) needs to be sent to the gateway node in each slot point in the slot point linked list of the corresponding slot position to judge whether the gateway node of each slot point is alive (online), if not, invalid slot points are directly eliminated, the identification information of a new secondary associated gateway node is added to the extracted corresponding slot point, if all the slot points are alive, the last slot point in the slot point linked list is deleted to add the identification information of the new secondary associated gateway node, and each slot point in the slot point linked list is reordered to ensure the accuracy of the gateway routing table of the current gateway node.
In addition, in order to ensure the comprehensive relevance between the gateway routing table of the current gateway node and each gateway node added in the rasterized gateway, so that when the current gateway node responds to the micro-service request set on another gateway node, the gateway node for executing the micro-service request can be quickly queried from the rasterized gateway, the gateway routing table of the current gateway node is comprehensively optimized and updated in the rasterized gateway by adopting the following two ways: (1) and optimizing the gateway routing table of the current gateway node by using the actual addressing state of the current gateway node in the received micro-service request. Or (2) continuously searching new associated gateway nodes of the current gateway node in the rasterized gateway from the gateway routing table dynamically maintained on each associated gateway node stored in the gateway routing table of the current gateway node, and iteratively updating the gateway routing table of the current gateway node until no new associated gateway node is searched in the rasterized gateway.
S320, searching a target gateway node corresponding to the current gateway node from the gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node, and storing the network address information of the current gateway node in the target gateway node according to the micro service path.
Specifically, after the gateway routing table of the current gateway node is generated, it is considered that each micro service mounted on each gateway node is generally responded to in the actual network interaction process among different gateway nodes in the rasterized gateway, so in order to realize accurate response of the micro services on different gateway nodes in the rasterized gateway, the network address information of the current gateway node needs to be correspondingly stored in the target gateway node of the current gateway node according to each micro service path mounted on the current gateway node.
At this time, acquiring the micro service paths corresponding to the micro services mounted on the current gateway node, and considering that the micro service paths are relatively complicated, this embodiment may perform hash operation on the micro service paths to obtain hash results of the micro service paths, so that the hash results of the micro service paths are subsequently used for corresponding storage, and the occupied space when network address information is stored according to the micro service paths is reduced. For example, the current gateway node may execute an issue instruction (publish instruction) to issue each micro service governed by the current gateway node to phi other nodes (the target gateway node in this embodiment) with the leftmost common prefix being 0 and the largest number of bits according to an addressing algorithm in the gateway routing table.
That is, the current gateway node executes a node address retrieval instruction (retrieval _ url) in the gateway routing table dynamically maintained thereon, where a parameter of the node address retrieval instruction is a hash result (RootUrlHash) of the micro service path set on the current gateway node, that is, a corresponding exclusive or operation (RootUrlHash, NodeId) is asynchronously executed on the hash result (RootUrlHash) of the micro service path and the identification information of each gateway node stored in the gateway routing table of the current gateway node. Then, according to the digits of which the leftmost common prefix is 0 in the plurality of exclusive-or results, retrieving information of phi (default is 3) gateway nodes corresponding to the situation that the digits of which the leftmost common prefix is 0 are the most, and taking the information as a target gateway node retrieved from a gateway routing table dynamically maintained by the current gateway node. Furthermore, in the target gateway node, the network address information of the current gateway node may be correspondingly stored according to the hash result of the micro service path on the current gateway node, so that when a micro service request is subsequently received, the carried micro service path may be used to search the target gateway node for executing the micro service request, thereby implementing accurate response of the current gateway node to the micro service requests set on other gateway nodes.
According to the technical scheme provided by the embodiment, a plurality of gateway nodes are added into a rasterized gateway, when each current gateway node is added into the rasterized gateway, a seed gateway node is determined from the rasterized gateway, each associated gateway node of the current gateway node in the rasterized gateway is searched in a gateway routing table dynamically maintained on the seed gateway node, and the gateway routing table of the current gateway node is generated by adopting the identification information of each associated gateway node, so that each gateway node added into the rasterized gateway stores the identification information of each associated gateway node of the gateway node in the rasterized gateway through the gateway routing table dynamically maintained on the gateway node; moreover, the current gateway node searches a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using the micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path, so that each gateway node added in the rasterized gateway can store the network address information of the gateway node on the target gateway node; therefore, unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by utilizing the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, and network interaction among different gateways is realized without adopting a preset complex gateway algorithm, so that the scheduling overhead among different gateway nodes in the rasterized gateway is reduced, and the convenience and the efficiency of the network interaction among different gateway nodes are further improved.
Example four
Fig. 4 is a flowchart of responding to a microservice request in an implementation method of a rasterized gateway according to a fourth embodiment of the present invention. The embodiment of the invention is optimized on the basis of the embodiment. Optionally, this embodiment mainly explains in detail a specific response process of the micro service request received by the current gateway node.
Specifically, referring to fig. 4, the method of this embodiment may specifically include:
s410, responding to the micro service request received by the current gateway node, and analyzing the micro service path in the micro service request and the identification information of the destination gateway node.
After the current gateway node receives a micro service request, the micro service request is firstly analyzed to obtain a micro service path (such as a rootpath/a/b/c) carried in the micro service request and identification information of a destination gateway node which governs the micro service so as to address the destination gateway node.
And S420, if the identification information of the destination gateway node does not exist in the gateway routing table of the current gateway node, continuously traversing the gateway node information of the specified slot position in the gateway routing table of the current gateway node according to the XOR result between the Hash result of the micro service path in the micro service request and the identification information of the current gateway node, and searching the corresponding first gateway node.
Specifically, after analyzing the micro service path and the identification information of the destination gateway node in the micro service request, first, according to the identification information of each gateway node stored in the gateway routing table of the current gateway node, it is determined whether the identification information of the destination gateway node exists in the gateway routing table of the current gateway node, and if so, the addressing of the destination gateway node is completed. If not, performing hash operation on the micro service path in the micro service request to obtain a hash result of the micro service path (e.g., RootUrlHash = hash (rootpath)). Then, performing an exclusive-or operation (rooturrl hash ≧ CurNodeId) on the hash result of the micro service path and the identification information of the current gateway node to obtain a corresponding exclusive-or result (CurPrefixZeroNum), then determining a corresponding designated slot position from the gateway routing table of the current gateway node according to the digit number of which the leftmost common prefix in the exclusive-or result is 0, and determining whether the gateway node stored in the designated slot position is a target gateway node (i.e. the first gateway node in the embodiment) storing the micro service path, if not, continuing performing the exclusive-or operation on the identification information of the gateway node of the designated slot position and the identification information of the current gateway node to obtain a corresponding exclusive-or result, thereby determining a new designated slot position in the gateway routing table of the gateway node of the designated slot position, and continuing to determine whether the gateway node stored in the new designated slot position is the target gateway node storing the micro service path, and sequentially circulating according to the steps until the target gateway node (namely the first gateway node in the embodiment) storing the micro service path is found out.
For example, the specific traversal process when searching for the first gateway node in this embodiment may be: determining a designated slot position in a gateway routing table of the current gateway node according to the digit with the prefix of zero in the XOR result between the hash result of the micro service path in the micro service request and the identification information of the current gateway node; and according to the Hash result of the micro-service path in the micro-service request, performing parallel retrieval on the gateway routing tables of all gateway nodes corresponding to the specified slot position, if the first gateway node is not retrieved, taking the second gateway node which is retrieved in parallel as a new current gateway node, continuously determining the specified slot position in the gateway routing table of the new current gateway node so as to perform parallel retrieval on the gateway routing tables of all gateway nodes corresponding to the specified slot position until the first gateway node is retrieved.
That is, after performing an exclusive or operation on the hash result of the micro service path in the micro service request and the identification information of the current gateway node, a corresponding exclusive or result (CurPrefixZeroNum) is obtained, and a bit number (e.g., log CurPrefixZeroNum) with a prefix of zero in the exclusive or result is calculated. Then, the slot position in the (GWNIDBIT- [ log CurPrefix ZeroNum ]) position in the gateway routing table of the current gateway node is used as the designated slot position, and the gateway nodes stored by phi slot points in the slot point linked list connected with the designated slot position in the gateway routing table of the current gateway node are found out. If the number of slot points in the slot point linked list of the designated slot position is less than phi, the gateway nodes stored by the phi slot points cannot be found in the designated slot position, so that the gateway nodes stored by the phi slot points can be continuously found in the adjacent slot position of the designated slot position (GWNIDBIT- [ log CurPrefix Zeronum ]) in the gateway routing list of the current gateway node by adopting the same method.
Then, for each gateway node stored in the searched phi slot points, a node address retrieval instruction is executed in the searched gateway routing table of each gateway node, and an exclusive-or operation is performed on the hash result of the micro service path and the identification information of each gateway node stored in the gateway routing table of each gateway node, so as to retrieve a second gateway node when the number of bits with the leftmost common prefix of 0 is the most in the exclusive-or result in parallel. And, determining whether the second gateway node is a target gateway node (i.e. the first gateway node in the embodiment) storing the micro service path, if not, continuing to use the second gateway node retrieved in parallel as a new current gateway node, and according to the same steps, continuing to determine a specified slot position in the gateway routing table of the new current gateway node, so as to perform parallel retrieval on the gateway routing tables of the gateway nodes corresponding to the specified slot position, and sequentially looping until the first gateway node is retrieved.
S430, in the cache forest of the first gateway node, finding out a target tree pointed by the hash result of the micro-service path in the micro-service request, and determining the network address information of the target gateway node from the leaf nodes of the target tree, so as to send the micro-service request to the target gateway node for response according to the network address information.
Specifically, after the first gateway node is retrieved, the network address information of the destination gateway node where the micro service path is located is stored in the first gateway node in a tree structure. At this time, in the cache forest of the first gateway node, the root node of each tree is compared with the hash result of the micro service path in the micro service request received by the current gateway node, so that the target tree pointed by the hash result of the micro service path is found out, the network address information of the destination gateway node is further determined from the leaf nodes of the target tree, the micro service request is sent to the destination gateway node according to the network address information, and the destination gateway node responds to the micro service request.
In addition, since the addressing process of the destination gateway node is too cumbersome when the micro service request responds, in order to improve the addressing efficiency of the destination gateway node, this embodiment may further include, after determining the network address information of the destination gateway node from the leaf nodes of the target tree: and correspondingly storing the network address information after the addressing of the destination gateway node in a multi-level cache index table arranged on the current gateway node according to the Hash result of the micro service path, so that when the current gateway node addresses the destination gateway node again, the network address information of the destination gateway node can be directly and quickly searched from the multi-level cache index table arranged on the current gateway node according to the Hash result of the micro service path in the micro service request, the addressing efficiency of the destination gateway node is improved, and the response efficiency of the micro service request in the rasterized gateway is ensured.
According to the technical scheme provided by the embodiment, unified management and cooperative linkage among different gateway nodes in the rasterized gateway are realized by using the gateway routing table of each gateway node in the rasterized gateway and the network address information stored on the corresponding target gateway node, so that the scheduling overhead among different gateway nodes in the rasterized gateway is reduced, and the convenience and the efficiency of network interaction among different gateway nodes are further improved. In addition, by arranging a multi-level cache index table on each gateway node in the rasterized gateway, the network address information of the destination gateway node is continuously stored, the addressing efficiency of the destination gateway node is improved, and the response efficiency of the micro-service request in the rasterized gateway is ensured.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention. As shown in fig. 5, the computer apparatus includes a processor 50, a storage device 51, and a communication device 52; the number of processors 50 in the computer device may be one or more, and one processor 50 is taken as an example in fig. 5; the processor 50, the storage means 51 and the communication means 52 of the computer device may be connected by a bus or other means, as exemplified by the bus connection in fig. 5.
The storage device 51 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as modules corresponding to the implementation method of the rasterization gateway in the embodiment of the present invention. The processor 50 executes various functional applications and data processing of the computer device by running software programs, instructions and modules stored in the storage device 51, that is, implements the implementation method of the rasterization gateway described above.
The storage device 51 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 51 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage 51 may further include memory located remotely from multifunction controller 50, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication means 52 may be used to enable a network connection or a mobile data connection between the devices.
The computer device provided by this embodiment may be configured to execute the method for implementing a rasterized gateway provided by any of the above embodiments, and has corresponding functions and advantages.
EXAMPLE six
The sixth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, can implement the method for implementing a rasterized gateway in any of the above embodiments. The method specifically comprises the following steps:
responding to a join request of a current gateway node facing the rasterized gateway, retrieving an associated gateway node of the current gateway node in the rasterized gateway through a gateway routing table dynamically maintained on a seed gateway node in the rasterized gateway, and generating a gateway routing table of the current gateway node;
searching a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using a micro service path arranged on the current gateway node, and storing the network address information of the current gateway node in the target gateway node according to the micro service path;
each gateway node in the rasterized gateway stores identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores network address information of the gateway node through a target gateway node in each associated gateway node.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A system for implementing a rasterized gateway, comprising: each gateway node stores the identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores the network address information of the gateway node through a target gateway node in each associated gateway node; wherein the content of the first and second substances,
when a current gateway node joins the rasterized gateway, a seed gateway node is determined from the rasterized gateway, and an associated gateway node of the current gateway node in the rasterized gateway is retrieved through a gateway routing table dynamically maintained on the seed gateway node, so as to generate a gateway routing table of the current gateway node;
and the current gateway node retrieves a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using a micro service path arranged on the current gateway node so as to store the network address information of the current gateway node in the target gateway node according to the micro service path.
2. The system according to claim 1, wherein the gateway routing table of each gateway node in the rasterized gateway stores the identification information of each first-level associated gateway node of the gateway node using different slot positions, and stores the identification information of each second-level associated gateway node under the first-level associated gateway node through a slot point chain table of the slot position where each first-level associated gateway node is located.
3. The system according to claim 1, wherein a protocol header of a gateway transport protocol supported by the rasterized gateway uses a hash map maintained at each gateway node to set header information of a network message at the gateway node and support dynamic header extension.
4. The system according to claim 1, wherein the target gateway node corresponding to the current gateway node stores the network address information of the current gateway node in a tree structure, a root node of the tree structure is configured to store a hash result of the micro service path on the current gateway node, and leaf nodes of the tree structure are configured to store the network address information consisting of the identification information of the current gateway node, the internet protocol IP address, and the port.
5. The system according to claim 1, wherein a multi-level cache index table is provided on each gateway node in the rasterized gateway, and the multi-level cache index table is configured to, after addressing a destination gateway node in a micro service request received by the gateway node, correspondingly store network address information addressed by the destination gateway node according to a hash result of a micro service path in the micro service request.
6. A method for implementing a rasterized gateway, which is applied to the system for implementing a rasterized gateway according to any one of claims 1 to 5, includes:
responding to a join request of a current gateway node facing the rasterized gateway, retrieving an associated gateway node of the current gateway node in the rasterized gateway through a gateway routing table dynamically maintained on a seed gateway node in the rasterized gateway, and generating a gateway routing table of the current gateway node;
searching a target gateway node corresponding to the current gateway node from a gateway routing table of the current gateway node by using a micro service path arranged on the current gateway node, and storing the network address information of the current gateway node in the target gateway node according to the micro service path;
each gateway node in the rasterized gateway stores identification information of each associated gateway node in the rasterized gateway through a gateway routing table dynamically maintained on the gateway node, and stores network address information of the gateway node through a target gateway node in each associated gateway node.
7. The method of claim 6, further comprising:
responding to a micro-service request received by the current gateway node, and analyzing a micro-service path in the micro-service request and identification information of a target gateway node;
if the identification information of the destination gateway node does not exist in the gateway routing table of the current gateway node, continuously traversing the gateway node information of the specified slot position in the gateway routing table of the current gateway node according to the XOR result between the hash result of the micro service path in the micro service request and the identification information of the current gateway node, and searching the corresponding first gateway node;
and in the cache forest of the first gateway node, finding out a target tree pointed by the hash result of the micro-service path in the micro-service request, determining the network address information of the target gateway node from leaf nodes of the target tree, and sending the micro-service request to the target gateway node for response according to the network address information.
8. The method of claim 7, wherein continuously traversing the gateway node information of the specified slot in the gateway routing table of the current gateway node to find the corresponding first gateway node according to the xor result between the hash result of the micro-service path in the micro-service request and the identification information of the current gateway node, comprises:
determining a designated slot position in a gateway routing table of the current gateway node according to the number of bits with a prefix of zero in an XOR result between the hash result of the micro service path in the micro service request and the identification information of the current gateway node;
and according to the Hash result of the micro-service path in the micro-service request, performing parallel retrieval on the gateway routing tables of the gateway nodes corresponding to the specified slot position, if the first gateway node is not retrieved, taking a second gateway node which is retrieved in parallel as a new current gateway node, continuously determining the specified slot position in the gateway routing table of the new current gateway node, and performing parallel retrieval on the gateway routing tables of the gateway nodes corresponding to the specified slot position until the first gateway node is retrieved.
9. The method of claim 7, further comprising, after determining the network address information of the destination gateway node from the leaf nodes of the target tree:
and correspondingly storing the network address information addressed by the destination gateway node in a multi-level cache index table arranged on the current gateway node according to the hash result of the micro-service path.
10. The method of claim 7, further comprising, after generating the gateway routing table for the current gateway node:
optimizing a gateway routing table of the current gateway node by using the actual addressing state of the current gateway node in the received micro-service request; alternatively, the first and second electrodes may be,
continuously and concurrently retrieving a new associated gateway node of the current gateway node in the rasterized gateway from the gateway routing table dynamically maintained on each associated gateway node stored in the gateway routing table of the current gateway node, so as to iteratively update the gateway routing table of the current gateway node until no new associated gateway node is retrieved in the rasterized gateway.
11. A computer device, characterized in that the computer device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of implementing a rasterization gateway as defined in any one of claims 6 to 10.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method for implementing a rasterization gateway as defined in any one of claims 6 to 10.
CN202110860470.5A 2021-07-29 2021-07-29 System, method, computer equipment and storage medium for realizing grid gateway Active CN113315708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110860470.5A CN113315708B (en) 2021-07-29 2021-07-29 System, method, computer equipment and storage medium for realizing grid gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110860470.5A CN113315708B (en) 2021-07-29 2021-07-29 System, method, computer equipment and storage medium for realizing grid gateway

Publications (2)

Publication Number Publication Date
CN113315708A CN113315708A (en) 2021-08-27
CN113315708B true CN113315708B (en) 2021-10-08

Family

ID=77381974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110860470.5A Active CN113315708B (en) 2021-07-29 2021-07-29 System, method, computer equipment and storage medium for realizing grid gateway

Country Status (1)

Country Link
CN (1) CN113315708B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8976795B2 (en) * 2009-02-25 2015-03-10 Microsoft Corporation Gateway advertisement in a wireless mesh
CN103945415B (en) * 2014-05-14 2017-03-22 常熟理工学院 Communication implementation method for wireless network
CN106572540B (en) * 2016-11-01 2020-04-03 上海华为技术有限公司 Data scheduling method and access network equipment
CN110401696B (en) * 2019-06-18 2020-11-06 华为技术有限公司 Decentralized processing method, communication agent, host and storage medium
CN110336753B (en) * 2019-06-19 2021-10-22 腾讯科技(深圳)有限公司 Cross-network-area service calling method, device, equipment and storage medium
CN110519379A (en) * 2019-08-29 2019-11-29 泰康保险集团股份有限公司 Request processing method and equipment based on micro services
CN111478935B (en) * 2019-12-16 2021-03-30 马上消费金融股份有限公司 Resource access method, internetwork connecting device, system and device

Also Published As

Publication number Publication date
CN113315708A (en) 2021-08-27

Similar Documents

Publication Publication Date Title
US10574574B2 (en) System and method for BGP sFlow export
KR101858542B1 (en) Container Name Server and Container Name Interpretation Method
US8073978B2 (en) Proximity guided data discovery
CN104283723B (en) Network access log processing method and processing device
US10176343B2 (en) Internet protocol network mapper
US9270636B2 (en) Neighbor lookup operations in a network node
CN103477613A (en) Mapping private and public addresses
US20180227230A1 (en) Stateless information centric forwarding using dynamic filters
CN103618801A (en) Method, device and system for sharing P2P (Peer-to-Peer) resources
US9742669B2 (en) Aliasing of named data objects and named graphs for named data networks
CN113556413A (en) Message processing method and device
US20180343194A1 (en) Network-aware routing in information centric networking
CN112437127A (en) Message processing method and device, load balancer and server
CN109413224B (en) Message forwarding method and device
CN102037711B (en) Limiting storage messages in peer to peer network
CN113315708B (en) System, method, computer equipment and storage medium for realizing grid gateway
RU2613034C2 (en) Rapid establishment of compliance with content addressing
CN109495525B (en) Network component, method of resolving content identification, and computer-readable storage medium
US20180367452A1 (en) Information centric networking over multi-access network interfaces
CN103685367A (en) Offline download system and offline download method
Chatterjee et al. Efficient data storage and name look-up in named data networking using connected dominating set and patricia trie
CN115334035B (en) Message forwarding method and device, electronic equipment and storage medium
CN107846290B (en) Topological relation management method and management equipment
Ramadan et al. A Distributed Cloud Architecture Based on General De Bruijn Overlay Network
Ouyang et al. Research and Realization of Home Region Authentication Server Resolution Mechanism

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant