Cross-cluster communication method and system, gateway, data processing device and storage medium
Through the inter-cluster gateway to obtain and forward cross-cluster access requests, combined with the load balancing strategy, the inter-cluster communication difficulty and performance problems caused by Service Mesh components are solved, and efficient and stable cross-cluster communication is achieved.
Patent Information
- Application Number
- CN202311595482.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2025-07-08
AI Technical Summary
Under the microservice framework, communication between clusters increases difficulty, Service Mesh components lead to increased network time consumption and system performance decline, cluster stability dependence decreases, the framework itself is heavier, and operation and maintenance consume additional resources.
The gateway between clusters obtains cross-cluster access requests, determines the target service node, and forwards the request based on the load balancing policy. The gateway obtains and updates the information of the cluster service node to avoid domain name configuration and code intrusion, and adopts a lightweight implementation.
It improves the stability and efficiency of cross-cluster communication, reduces operation and maintenance resource consumption, and realizes lightweight cross-cluster communication.
Smart Images

Figure CN120281819A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and particularly to a cross-cluster communication method, system, gateway, data processing device, and storage medium. Background Art
[0002] With the rapid development of Internet technologies, microservice frameworks combined with containerization technologies can be independently deployed, have advantages such as high availability, distribution, scalability, and intelligent operation and maintenance, can quickly respond to business development, and are increasingly adopted.
[0003] Under the microservice framework, services are generally deployed in a cluster manner. The more services there are, the larger the cluster will be, and service governance will be more complex, affecting efficiency. Within a company, there are generally several to a dozen services at least, and up to hundreds at most. Generally, the cluster will not be too large. When the cluster is too large, it can be split into multiple clusters, and the scale of each cluster is within an appropriate range.
[0004] After splitting, the interfaces between clusters need to call each other. Taking the Spring Cloud microservice framework as an example, internal services can be easily accessed through the client openfeign. After service splitting, services cannot be called through the feign method, and the difficulty of cross-cluster communication increases.
[0005] Service Mesh, the initial understanding of which is a platform used to share data between different services and clusters of distributed applications, can be used to solve complex network management problems between various microservice components of distributed applications, and is known as the TCP (Transmission Control Protocol) of the next generation of microservices.
[0006] Service Mesh usually consists of a control plane and a data plane. The data plane consists of SideCars (sidecars) that run along with microservices; the control plane is a set of programs used to configure, monitor, and display the network traffic of the data plane.
[0007] Istio is the most widely used implementation solution of Service Mesh currently. After the service is started, Envoy Proxy (proxy) runs as a container of a pod (container group). The pod itself supports multi-container sharing of network resources. Envoy proxy and the service are deployed in the same pod, and by adjusting the Envoy configuration, the network requests of the service can be controlled. Summary of the Invention
[0008] An object of the present disclosure is to improve the stability and efficiency of cross-cluster communication.
[0009] According to one aspect of some embodiments of the present disclosure, a cross-cluster communication method is proposed, including: a gateway between clusters obtains a cross-cluster access request from a source cluster; determines a target service node according to the cross-cluster access request; and forwards the cross-cluster access request to the target service node based on cluster service node information, where the cluster service node information is obtained by the gateway from a backend system.
[0010] In some embodiments, the method further includes: the gateway obtains cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency, where after a service node of a cluster is started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
[0011] In some embodiments, the cluster service node information includes the communication address and communication port of the service node.
[0012] In some embodiments, determining a target service node according to the cross-cluster access request includes: determining a target cluster according to the cross-cluster access request; obtaining candidate nodes providing the target service in the target cluster; and determining the target service node among the candidate service nodes based on a predetermined load balancing policy.
[0013] In some embodiments, the predetermined load balancing policy includes at least one of the following: determining the target service node by polling; randomly determining the target service node; determining the target service node according to the weight of the service node, where the probability that a service node is selected as the target service node is positively correlated with the magnitude of the weight of the service node, and the weight of the service node is negatively correlated with the response duration of the service node; or, selecting the service node with the least number of requests in the normal working state among the candidate service nodes as the target service node.
[0014] In some embodiments, determining the target service node among the candidate service nodes based on a predetermined load balancing policy includes: determining the period to which the current moment belongs; updating the candidate service nodes based on the correspondence between the period and the set of service nodes; and determining the target service node among the updated candidate service nodes based on a predetermined load balancing policy.
[0015] In some embodiments, forwarding the cross-cluster access request to the target service node based on cluster service node information includes: determining the communication address and communication port of the target service node according to the cluster service node information; and sending the cross-cluster access request according to the communication address and communication port.
[0016] In some embodiments, the method further includes: registering the gateway to more than two clusters as the gateway between the registered clusters; the gateway obtaining, at a predetermined moment or according to a predetermined frequency, cluster service node information related to the service nodes of the registered clusters from the backend system, wherein after the service nodes of the cluster are started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
[0017] In some embodiments, the method further includes: the gateway obtaining the configuration information of the cluster, where the configuration information includes a cluster identifier, a service identifier, and an access path.
[0018] According to one aspect of some embodiments of the present disclosure, a cross-cluster communication method is provided, including: a service node of a first cluster generating a cross-cluster access request and sending it to the gateway between the clusters; the gateway forwarding the cross-cluster access request to a service node of a second cluster according to any one of the methods executed by the gateway in the foregoing; the service node of the second cluster receiving the cross-cluster access request and executing it.
[0019] In some embodiments, the method further includes: after the service node of the cluster is started, writing the node information into the backend system; the backend system generating or updating the stored cluster service node information according to the node information; the gateway obtaining the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency.
[0020] In some embodiments, the method further includes at least one of the following: the first cluster and the second cluster receiving the registration information of the gateway; or the gateway obtaining the configuration information of the first cluster and the second cluster, where the configuration information includes a cluster identifier, a service identifier, and an access path.
[0021] According to one aspect of some embodiments of the present disclosure, a gateway is provided, including: a request obtaining unit configured to obtain a cross-cluster access request from a source cluster; a target node determining unit configured to determine a target service node according to the cross-cluster access request; a request forwarding unit configured to forward the cross-cluster access request to the target service node based on the cluster service node information, where the cluster service node information is obtained by the gateway from the backend system.
[0022] In some embodiments, the gateway further includes: a node information obtaining unit configured to obtain the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency, wherein after the service nodes of the cluster are started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
[0023] In some embodiments, the gateway further includes: a configuration information obtaining unit configured to obtain the configuration information of the cluster, where the configuration information includes a cluster identifier, a service identifier, and an access path.
[0024] According to one aspect of some embodiments of the present disclosure, a cross-cluster communication system is provided, including: a plurality of clusters, where each cluster includes: a first cluster including at least one service node configured to generate a cross-cluster access request and send it to a gateway between the clusters; and a second cluster including at least one service node configured to receive and execute the cross-cluster access request; a gateway configured to forward the cross-cluster access request to the service node of the second cluster according to any one of the cross-cluster communication methods executed by the gateway mentioned above; and a backend system configured to provide cluster service node information to the gateway.
[0025] According to one aspect of some embodiments of the present disclosure, a data processing device is provided, including: a memory; and a processor coupled to the memory, the processor being configured to execute any one of the cross-cluster communication methods mentioned above based on instructions stored in the memory.
[0026] According to one aspect of some embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, on which computer program instructions are stored, and when the instructions are executed by a processor, the steps of any one of the cross-cluster communication methods mentioned above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings described herein are used to provide a further understanding of the present disclosure and form a part of the present disclosure. The illustrative embodiments and descriptions thereof of the present disclosure are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the drawings:
[0028] Figure 1 It is a flowchart of some embodiments of the cross-cluster communication method of the present disclosure.
[0029] Figure 2 It is a flowchart of some other embodiments of the cross-cluster communication method of the present disclosure.
[0030] Figure 3 It is a flowchart of some further embodiments of the cross-cluster communication method of the present disclosure.
[0031] Figure 4 It is a schematic diagram of some embodiments of the gateway of the present disclosure.
[0032] Figure 5 It is a schematic diagram of some embodiments of the cross-cluster communication system of the present disclosure.
[0033] Figure 6 It is a schematic diagram of some other embodiments of the cross-cluster communication system of the present disclosure.
[0034] Figure 7 It is a schematic diagram of some embodiments of the data processing device of the present disclosure.
[0035] Figure 8Schematic diagrams of other embodiments of the data processing device of the present disclosure. Detailed implementation manners
[0036] The technical solutions of the present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments.
[0037] The inventors found that using the Service Mesh component to calculate and forward requests in proxy mode would lead to increased network latency and degraded system performance; managing network traffic by the Service Mesh component made the cluster stability completely dependent on the Service Mesh, reducing the stability and reliability of the cluster; in addition, the framework itself was relatively heavy, and running and maintaining it required additional resources.
[0038] In view of the above problems, the present disclosure provides a cross-cluster communication method, system, gateway, data processing device, and storage medium to improve the stability and efficiency of cross-cluster communication.
[0039] The flowchart of some embodiments of the cross-cluster communication method of the present disclosure is as Figure 1 shown.
[0040] In step 101, the gateway between clusters obtains a cross-cluster access request from the source cluster. In some embodiments, when any service node that enables cross-cluster communication in the system generates a cross-cluster communication requirement, it sends a cross-cluster access request to the pre-configured gateway between clusters.
[0041] In some embodiments, the cross-cluster access request may include a service name or service identifier. In some embodiments, the cross-cluster access request may further include the identifier of the target cluster.
[0042] In step 102, the target service node is determined according to the cross-cluster access request.
[0043] In some embodiments, the cross-cluster access request may include a service name, and the gateway filters the target cluster and the service nodes that can provide the corresponding service according to the service name. In some embodiments, the cross-cluster access request may include the identifier of the target cluster, and the gateway filters the target service node from the service nodes of the target cluster according to the identifier of the target cluster.
[0044] In some embodiments, the gateway may determine a target service node based on a predetermined policy according to the cluster identifiers and service identifiers of each stored cluster. In some embodiments, the cluster identifiers and service identifiers stored in the gateway may come from pre-configuration; in some embodiments, the cluster identifiers and service identifiers stored in the gateway may be collected through a backend system. In some embodiments, the gateway may also store the access paths of each service node, and one or more of the cluster identifier, service identifier, and access path may be presented to the user, thereby improving user-friendliness and the convenience of scheduling.
[0045] In some embodiments, the gateway may first determine a target cluster according to a cross-cluster access request. In some embodiments, the cross-cluster access request includes the identifier of the target cluster, and the gateway determines the target cluster by reading a predetermined field in the cross-cluster access request. In some embodiments, the cross-cluster access request includes a service identifier, and the gateway determines a cluster that can provide the corresponding service as the target cluster among the clusters it is connected to other than the source cluster according to the service identifier. In some embodiments, the target cluster may be determined based on a predetermined policy, such as determining the target cluster according to a predetermined load balancing algorithm. Further, candidate nodes that can provide the target service are determined in the target cluster, and based on a predetermined load balancing policy, a target service node is determined among the candidate service nodes.
[0046] In some embodiments, the above-mentioned predetermined load balancing policy may include determining the target service node by polling. In some embodiments, requests are distributed to different service nodes in a polling manner. For example, the candidate service nodes are numbered from 1 to x, where x is the number of candidate service nodes. The gateway maintains the call count n and determines that the (n + 1)-th request is scheduled to the node numbered (n + 1) mod x, that is, the node numbered (n + 1) mod x is the target service node. By such a method, the number of requests received by each service node can be balanced, and the reliability of load balancing can be improved.
[0047] In some embodiments, the above load balancing policy may include randomly determining the target service node to achieve load balancing in a random manner.
[0048] In some embodiments, the above load balancing policy may include determining a target service node according to the weight of the service node, wherein the probability of a service node being selected as the target service node is positively correlated with the magnitude of the weight of the service node, and the weight of the service node is negatively correlated with the response duration of the service node. In some embodiments, the gateway may assign weights to each service node according to the response duration of each service node, wherein the shorter the response duration, the greater the weight, and the greater the probability of being selected as the target service node. In some embodiments, the response duration of each service node may be obtained from the backend system. In some embodiments, the gateway may update the weights of each service node in real time or at a certain period to improve the determination efficiency of the target service node; in some embodiments, the gateway may determine the weights of each candidate service node immediately after receiving a cross-cluster access request to improve the timeliness of the weight information. By such a method, it is possible to preferentially select a service node with timely response as the target service node and improve the service efficiency.
[0049] In some embodiments, the above load balancing policy may include selecting, as the target service node, the service node with the least number of requests in the normal working state among the candidate service nodes. In some embodiments, the gateway may traverse all candidate service nodes, filter out the faulty candidate service nodes, and use the candidate service node with the least number of requests as the target service node. By such a method, it is possible to ensure that the target service node is in a normal running state, and to balance the number of requests received by each service node, thereby improving the reliability of load balancing.
[0050] In some embodiments, after determining the candidate service nodes based on any one of the methods mentioned above, the gateway may first determine the time period to which the current moment belongs, and then update the candidate service nodes based on the corresponding relationship between the time period and the set of service nodes. For example, in the case where the time period is the night time period, based on the pre-stored corresponding relationship between the time period and the set of service nodes, some service nodes that do not provide services during the night time period are deleted from the candidate service nodes to obtain the updated candidate service nodes. Further, any one of the predetermined load balancing policies mentioned above is adopted to determine the target service node among the candidate service nodes. In some embodiments, after updating the candidate service nodes according to the time period, the polling policy is adopted to determine the target service node. By such a method, on the basis of realizing the load balancing of cross-cluster access, it is possible to take into account the differences in the working time periods of the service nodes providing services, thereby improving the reliability of cross-cluster access.
[0051] In some embodiments, a custom time window may be set. For the same service, the set of service nodes may be different within different time windows, so as to implement the corresponding relationship between the set time period and the set of service nodes, which is convenient for updating the candidate service nodes based on the custom time window.
[0052] In step 103, based on the cluster service node information obtained by the gateway from the backend system, the cross-cluster access request is forwarded to the target service node.
[0053] In some embodiments, the gateway may obtain the cluster service node information from the backend system at a predetermined moment, thereby improving the controllability of information acquisition.
[0054] In some embodiments, the gateway may obtain the cluster service node information from the backend system at a predetermined frequency, thereby improving the timeliness of information.
[0055] In some embodiments, the cluster service node information stored in the backend system may be generated or updated by writing the node information into the backend system after the service nodes of the cluster are started.
[0056] In some embodiments, the gateway may only obtain the cluster service node information related to the service nodes in the cluster connected to itself that have enabled the cross-cluster communication function, thereby reducing the amount of information that needs to be obtained and stored, and reducing the communication and storage pressure.
[0057] In some embodiments, the cluster service node information includes the communication address and communication port of the service node. After the gateway determines the target service node, it determines the target address for request sending according to the communication address and port of the target service node in the cluster service node information, and then sends the cross-cluster access request to the target service node. By such a method, the gateway can determine the communication address of the target service node based on the stored information, improving the reliability of request forwarding.
[0058] Based on the method in the above embodiments, it is convenient for service nodes in different clusters to perform service calls without domain name configuration and code intrusion, and the implementation of the gateway is lightweight, avoiding the use of additional systems or tools that consume additional resources for operation and maintenance, and improving the stability and efficiency of cross-cluster communication.
[0059] Another flowchart of embodiments of the cross-cluster communication method of the present disclosure is as Figure 2 shown.
[0060] In step 201, after the service nodes of the cluster are started, the node information is written into the backend system. In some embodiments, the node information written into the backend system may refer to the information that needs to be reported to the registration center and written into the backend system in the related art.
[0061] In step 202, the backend system generates or updates the stored cluster service node information according to the node information. In some embodiments, the cluster service node information may include all the node information in step 201. In some embodiments, the cluster node information may include the communication address and port information of each service node.
[0062] In step 203, the first cluster and the second cluster receive the registration information of the gateway. In some embodiments, after the gateway goes online, it can initiate registration to multiple clusters that use the gateway as the relay of request messages.
[0063] In step 204, the gateway obtains the configuration information of the first cluster and the second cluster. The configuration information includes the cluster identifier, service identifier, and access path. In some embodiments, the gateway can allow users to configure it actively.
[0064] In some embodiments, after the gateway completes the configuration, it can provide the relay service for cross-cluster communication. During the process of providing the service, such as when executing Figure 1 any one of the methods in the corresponding embodiments, step 205 is executed.
[0065] In step 205, the gateway obtains the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency. In some embodiments, the gateway can obtain only the cluster service node information related to the service nodes that have enabled the cross-cluster communication function in the cluster connected to itself, so as to reduce the amount of information that needs to be obtained and stored, and reduce the pressure of communication and storage.
[0066] Based on the methods in the above embodiments, on the basis of the related technologies of microservices, by establishing a gateway between clusters and configuring parameters, cross-cluster communication with the gateway as the relay between clusters can be realized, the implementation difficulty is reduced, there is no need to use an additional system (such as Linkerd), a lightweight implementation of cross-cluster communication can be achieved, the amount of additional resources required for operation and maintenance is reduced, and the cross-cluster communication efficiency is improved.
[0067] In some embodiments, the flowchart of still some other embodiments of the cross-cluster communication method of the present disclosure is as Figure 3 shown.
[0068] In step 301, the service node of the first cluster generates a cross-cluster access request and sends it to the gateway between clusters. In some embodiments, when any service node that has enabled cross-cluster communication in the system has a cross-cluster communication requirement, it sends a cross-cluster access request to the pre-configured gateway between clusters.
[0069] In step 302, the gateway forwards the cross-cluster access request to the service node of the second cluster according to any one of the methods executed by the gateway above, such as Figure 1 any one of the methods in the embodiments shown above.
[0070] In step 303, the service node of the second cluster receives the cross-cluster access request and executes it.
[0071] Through the method in the embodiments shown above, it is possible to facilitate service calls between service nodes in different clusters without domain name configuration and code intrusion, and the implementation of the gateway is lightweight, avoiding the use of additional systems or tools that consume additional resources for operation and maintenance, and improving the stability and efficiency of cross-cluster communication.
[0072] A schematic diagram of some embodiments of the gateway 41 of the present disclosure is as Figure 4 shown. In some embodiments, the gateway 41 is a gateway between clusters that is independent of the clusters.
[0073] The request acquisition unit 411 can acquire a cross-cluster access request from the source cluster. In some embodiments, when any service node in the system that has enabled cross-cluster communication generates a cross-cluster communication requirement, a cross-cluster access request is sent to the pre-configured gateway between clusters. In some embodiments, the cross-cluster access request may include a service name or a service identifier. In some embodiments, the cross-cluster access request may further include an identifier of the target cluster.
[0074] The target node determination unit 412 can determine the target service node according to the cross-cluster access request. In some embodiments, the cross-cluster access request may include a service name, and the target node determination unit 412 filters the target cluster and the service nodes that can provide the corresponding service according to the service name. In some embodiments, the cross-cluster access request may include an identifier of the target cluster, and the target node determination unit 412 filters the target service node from the service nodes of the target cluster according to the identifier of the target cluster.
[0075] In some embodiments, the target node determination unit 412 may determine the target service node based on a predetermined policy according to the stored cluster identifiers and service identifiers of each cluster. In some embodiments, the target node determination unit 412 may first determine the target cluster according to the cross-cluster access request. In some embodiments, the cross-cluster access request includes an identifier of the target cluster, and the target node determination unit 412 determines the target cluster by reading a predetermined field in the cross-cluster access request. Further, candidate nodes that can provide the target service are determined in the target cluster, and the target service node is determined from the candidate service nodes based on a predetermined load balancing policy.
[0076] In some embodiments, the predetermined load balancing policy may include determining the target service node by polling, which can balance the number of requests received by each service node and improve the reliability of load balancing. In some embodiments, the load balancing policy may include randomly determining the target service node to achieve load balancing in a random manner. In some embodiments, the load balancing policy may include determining the target service node according to the weight of the service node. Among them, the probability that a service node is selected as the target service node is positively correlated with the magnitude of the weight of the service node, and the weight of the service node is negatively correlated with the response duration of the service node. Therefore, a service node with timely response can be preferentially selected as the target service node to improve service efficiency. In some embodiments, the above load balancing policy may include selecting the service node in the candidate service nodes with the least number of requests in the normal working state as the target service node, which can ensure that the target service node is in the normal running state, balance the number of requests received by each service node, and improve the reliability of load balancing.
[0077] In some embodiments, after determining the candidate service nodes, the target node determination unit 412 first determines the time period to which the current moment belongs, and then updates the candidate service nodes based on the corresponding relationship between the time period and the service node set. Further, any one of the predetermined load balancing policies mentioned above is adopted to determine the target service node among the candidate service nodes, so that on the basis of realizing the load balancing of cross-cluster access, the situation where the working time periods of the service nodes providing services are different can be taken into account, and the reliability of cross-cluster access can be improved.
[0078] The request forwarding unit 413 can forward the cross-cluster access request to the target service node based on the cluster service node information, where the cluster service node information is obtained by the gateway from the backend system. In some embodiments, the request forwarding unit 413 determines the target address for request sending according to the communication address and port of the target service node in the cluster service node information, and then sends the cross-cluster access request to the target service node.
[0079] Such a gateway can facilitate service calls between service nodes in different clusters, without the need for domain name configuration and code intrusion, and is a lightweight implementation, avoiding the use of additional systems or tools that consume additional resources for operation and maintenance, and improving the stability and efficiency of cross-cluster communication.
[0080] In some embodiments, such as Figure 4As shown, the gateway further includes a node information acquisition unit 414, which can obtain cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency. The cluster service node information stored in the backend system can be generated or updated by writing the node information into the backend system after the service nodes of the cluster are started. Such a gateway can ensure the timeliness of the obtained cluster service node information, improve the reliability of the communication addresses and ports based on which the request forwarding is performed, and improve the success rate of cross-cluster communication.
[0081] In some embodiments, the node information acquisition unit 414 may only obtain the cluster service node information related to the service nodes in the cluster enabled with the cross-cluster communication function that are connected to itself, so as to reduce the amount of information that needs to be obtained and stored, and reduce the communication and storage pressure.
[0082] In some embodiments, as Figure 4 shown, the gateway further includes a configuration information acquisition unit 415, which can obtain the configuration information of the cluster. The configuration information includes the cluster identifier, service identifier, and access path. In some embodiments, one or more of the cluster identifier, service identifier, and access path may be presented to the user, so as to improve the user-friendliness and the convenience of scheduling.
[0083] A schematic diagram of some embodiments of the cross-cluster communication system of the present disclosure is as Figure 5 shown.
[0084] Multiple clusters 521 - 52n, where n is the number of clusters in the cross-cluster communication system, which is a positive integer greater than or equal to 2. In some embodiments, cross-cluster communication can be performed between at least two clusters in the cluster. In some embodiments, the underlying layer of each cluster is a docker cluster, and container orchestration adopts Kubernates.
[0085] In some embodiments, the cluster where the service node initiating the cross-cluster communication is located is called the first cluster, and the cluster to which the called service node belongs is called the second cluster. The first cluster 521 includes at least one service node, which can generate a cross-cluster access request and send it to the gateway between the clusters. The second cluster 522 includes at least one service node, which can receive the cross-cluster access request and execute it. The cross-cluster access request received by the second cluster 522 comes from the gateway 51 between the clusters.
[0086] The gateway 51 between the clusters can execute any one of the cross-cluster communication methods performed by the gateway in the above text, and forward the cross-cluster access request to the service node of the second cluster. In some embodiments, the gateway 51 can be implemented through Kubernates.
[0087] The backend system 53 can provide cluster service node information to the gateway. In some embodiments, the backend system 53 can be implemented through ETCD.
[0088] In the system of the embodiments shown above, service nodes between different clusters can perform cross-cluster communication via the gateway between clusters. The implementation of this gateway does not require domain name configuration and code intrusion, avoiding the use of additional systems or tools that consume additional resources for operation and maintenance, and improving the stability and efficiency of cross-cluster communication.
[0089] Schematic diagrams of some other embodiments of the cross-cluster communication system of the present disclosure are as Figure 6 shown. Figure 6 In the embodiments shown in, the module structures, messages, parameters, etc. included in the cluster are only examples and do not constitute improper limitations to this application.
[0090] Cluster 621 and cluster 622 are two clusters. The underlying layer is a docker cluster, and container orchestration uses kubernates. After clusters 621 and 622 are started, the information of their respective service nodes is reported to the registration center and written into ETCD, which is used as the backend system. ETCD is an orchestration container middleware for kubernates. In some embodiments, after the service nodes of clusters 621 and 622 are started, the node information is written into ETCD to save the node information of all running containers of clusters 621 and 622.
[0091] The gateway 61 between clusters is a gateway external to clusters 621 and 622, which can be registered to clusters 621 and 622, and can also read the services that clusters A and B can access configured on the gateway 61, and periodically obtain service node information from ETCD.
[0092] When there is an access within the cluster, the load balancing module (robbin module) of the client will periodically obtain node information from the registration center. When requesting other modules, the robbin module performs load distribution according to the cached service information and accesses other modules.
[0093] The default load of the Robbin module is the round-robin strategy. In some embodiments, the load balancing strategy of the Robbin module can be set by configuring the parameter: robbin.NFLoadBalanceRuleClassName. In some embodiments, the load balancing strategies of the Robbin module include the following several types.
[0094] Round-robin strategy: The requests are distributed to different servers in a round-robin manner. The service nodes in the group are numbered from 1 to x, where x is the number of service nodes in the group. The number of calls n is maintained on the server. For the (n + 1)th request, it is scheduled to the ((n + 1) mod x)th node, and the node for the (n + 1)th request is calculated.
[0095] Random policy: Scheduled to the corresponding node according to a random algorithm. Weight policy: Assign a weight according to the node response time. The smaller the response time, the larger the weight, and the greater the probability of being scheduled.
[0096] Optimal policy: Traverse all nodes, filter out faulty nodes, and return the node with the smallest number of requests.
[0097] In some embodiments, when the services in clusters 621 and 622 are ready to enable cross-cluster access, configuration needs to be performed on gateway 61. After the configuration is completed, gateway 61 will periodically obtain the node information of the service from ETCD.
[0098] In some embodiments, the information configured on the gateway includes: cluster identifier, service identifier, and access path.
[0099] For example, when serviceA in cluster A is ready to open cross-cluster access, the following configuration is performed on gateway 61:
[0100] Cluster identifier: A
[0101] Service identifier: serviceA
[0102] Access path: / serviceA
[0103] When cluster 621 accesses cluster 622 across clusters, it directly requests gateway 61 outside the cluster, and gateway 61 forwards the service to cluster 622. For example, when a service in cluster B accesses serviceA, it can access @gateway / serviceA / xxx through the internal service client feign, and the request will be forwarded to serviceA. In some embodiments, gateway 61 can determine the service node based on any of the methods mentioned above to achieve load balancing.
[0104] In some embodiments, the load policy in gateway 61, in addition to the load balancing policy of the robbin module inside the cluster, also includes a custom time window policy: controlling the request to access the corresponding service node by configuring a time period, and the load balancing policy between service nodes in the same time period can adopt a polling policy. In some embodiments, gateway 61 defaults to using the custom time window policy for load balancing.
[0105] Based on the cross-cluster communication system shown above, it is possible to conveniently implement service calls between different clusters without domain name configuration, non-invasive code, and can be deployed independently. After simple settings, it can work, improving the implementation efficiency.
[0106] The structural schematic diagram of an embodiment of the data processing device of the present disclosure is as Figure 7As shown in the figure. The data processing device includes a memory 701 and a processor 702. Among them: The memory 701 can be a magnetic disk, a flash memory, or any other non-volatile storage medium. The memory is used to store the instructions in the corresponding embodiments of the cross-cluster communication method described above. The processor 702 is coupled to the memory 701 and can be implemented as one or more integrated circuits, such as a microprocessor or a microcontroller. The processor 702 is used to execute the instructions stored in the memory and can improve the stability and efficiency of cross-cluster communication.
[0107] In one embodiment, it can also be as Figure 8 As shown in the figure, the data processing device 800 includes a memory 801 and a processor 802. The processor 802 is coupled to the memory 801 through the BUS bus 803. The data processing device 800 can also be connected to an external storage device 805 through a storage interface 804 to call external data, and can also be connected to a network or another computer system (not shown) through a network interface 806. Details are not described here.
[0108] In this embodiment, by storing data instructions in the memory and then processing the above instructions through the processor, the stability and efficiency of cross-cluster communication can be improved.
[0109] In another embodiment, a computer-readable storage medium stores computer program instructions, and when the instructions are executed by a processor, the steps of the method in the corresponding embodiment of the cross-cluster communication method are implemented. Those skilled in the art should understand that the embodiments of the present disclosure can be provided as methods, devices, or computer program products. Therefore, the present disclosure can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable non-transitory storage media (including but not limited to magnetic disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.
[0110] The present disclosure is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0111] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including instruction means that implement the functions specified in one or more of the procedures Figure 1 one or more procedures and / or blocks Figure 1 specified in a block or blocks.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one or more of the procedures Figure 1 one or more procedures and / or blocks Figure 1 specified in a block or blocks.
[0113] So far, the present disclosure has been described in detail. To avoid obscuring the concept of the present disclosure, some details well known in the art are not described. Those skilled in the art can fully understand how to implement the technical solutions disclosed herein based on the above description.
[0114] The methods and apparatuses of the present disclosure can be implemented in many ways. For example, the methods and apparatuses of the present disclosure can be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of the steps for the method is for illustration only. The steps of the method of the present disclosure are not limited to the specific order described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure can also be implemented as a program recorded in a recording medium, and these programs include machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
[0115] It should be noted that the terms "first", "second", etc. in the specification, claims, and drawings of the present disclosure are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or apparatuses.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure and are not intended to limit them; although the present disclosure has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that it is still possible to modify the specific implementation manners of the present disclosure or perform equivalent replacements for some technical features; without departing from the spirit of the technical solutions of the present disclosure, they should all be covered within the scope of the technical solutions claimed in the present disclosure.
Claims
1. A cross - cluster communication method, comprising: The gateway between clusters obtains a cross - cluster access request from the source cluster; Determine a target service node according to the cross - cluster access request; Based on the cluster service node information, forward the cross - cluster access request to the target service node, where the cluster service node information is obtained by the gateway from the backend system.
2. The method according to claim 1, further comprising: The gateway obtains the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency. After the service node of the cluster is started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
3. The method according to claim 1 or 2, wherein The cluster service node information includes the communication address and communication port of the service node.
4. The method according to claim 1, wherein The determining the target service node according to the cross - cluster access request includes: Determine a target cluster according to the cross - cluster access request; Obtain candidate nodes providing the target service in the target cluster; Based on a predetermined load - balancing policy, determine the target service node among the candidate service nodes.
5. The method according to claim 4, wherein, The predetermined load - balancing policy includes at least one of the following: Determine the target service node by round - robin; Randomly determine the target service node; Determine the target service node according to the weight of the service node, where the probability of a service node being selected as the target service node is positively correlated with the magnitude of the weight of the service node, and the weight of the service node is negatively correlated with the response duration of the service node; or Select the service node with the least number of requests in the normal working state among the candidate service nodes as the target service node.
6. The method according to claim 4 or 5, wherein The determining the target service node among the candidate service nodes based on the predetermined load - balancing policy includes: Determine the time period to which the current moment belongs; Based on the correspondence between the time period and the set of service nodes, update the candidate service nodes; Based on the predetermined load - balancing policy, determine the target service node among the updated candidate service nodes.
7. The method according to claim 1, wherein The forwarding the cross - cluster access request to the target service node based on the cluster service node information includes: According to the cluster service node information, determine the communication address and communication port of the target service node; Send the cross - cluster access request according to the communication address and communication port.
8. The method according to claim 1, further comprising: The gateway registers to two or more clusters as the gateway between the registered clusters; The gateway obtains the cluster service node information related to the service nodes of the registered clusters from the backend system at a predetermined moment or a predetermined frequency. After the service node of the cluster is started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
9. The method according to claim 8, further comprising: The gateway obtains the configuration information of the cluster, and the configuration information includes the cluster identifier, service identifier, and access path.
10. A cross - cluster communication method, comprising: The service nodes of the first cluster generate a cross-cluster access request and send it to the gateway between the clusters; The gateway forwards the cross-cluster access request to the service nodes of the second cluster according to the method described in any one of claims 1 to 9; The service nodes of the second cluster receive the cross-cluster access request and execute it.
11. The method according to claim 10 further includes: After the service nodes of the cluster are started, the node information is written into the backend system; The backend system generates or updates the stored cluster service node information according to the node information; The gateway obtains the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency.
12. The method according to claim 10 further includes at least one of the following: The first cluster and the second cluster receive the registration information of the gateway; or The gateway obtains the configuration information of the first cluster and the second cluster, and the configuration information includes a cluster identifier, a service identifier, and an access path.
13. A gateway includes: A request acquisition unit configured to acquire a cross-cluster access request from a source cluster; A target node determination unit configured to determine a target service node according to the cross-cluster access request; A request forwarding unit configured to forward the cross-cluster access request to the target service node based on the cluster service node information, where the cluster service node information is obtained by the gateway from the backend system.
14. The gateway according to claim 13 further includes: A node information acquisition unit configured to obtain the cluster service node information from the backend system at a predetermined moment or according to a predetermined frequency, where after the service nodes of the cluster are started, the node information is written into the backend system to generate or update the cluster service node information stored in the backend system.
15. The gateway according to claim 13 further includes: A configuration information acquisition unit configured to acquire the configuration information of the cluster, and the configuration information includes a cluster identifier, a service identifier, and an access path.
16. A cross-cluster communication system includes: Multiple clusters, where the clusters include: A first cluster including at least one service node configured to generate a cross-cluster access request and send it to the gateway between the clusters; and A second cluster including at least one service node configured to receive the cross-cluster access request and execute it; A gateway configured to forward the cross-cluster access request to the service nodes of the second cluster according to the method described in any one of claims 1 to 9; And A backend system configured to provide cluster service node information to the gateway.
17. A data processing device includes: A memory; And A processor coupled to the memory, where the processor is configured to execute the method described in any one of claims 1 to 12 based on instructions stored in the memory.
18. A non-transitory computer-readable storage medium stores computer program instructions, and when the instructions are executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.