A gateway control method and API gateway system
By managing multiple ETCD clusters through a single control plane, the problem of wasted control resources and low utilization in API gateway systems is solved, achieving efficient resource utilization and improved user experience.
Patent Information
- Application Number
- CN202411890533.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2026-06-23
AI Technical Summary
Existing API gateway systems suffer from wasted control resources and low utilization during deployment, especially when multiple control planes are deployed, requiring the application of multiple domain names, resulting in a cluttered user experience.
By managing multiple ETCD clusters through a single control plane and sending configuration information to each data plane, the ETCD clusters can synchronize business management rules, thereby enabling rule management across multiple data planes and reducing the number of control planes deployed.
It improved the utilization rate of control resources, reduced system costs, and enhanced the user experience.
Smart Images

Figure CN122268753A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a gateway control method and an API gateway system. Background Technology
[0002] HTTPS (Hypertext Transfer Protocol Secure) service governance systems, also known as API (Application Programming Interface) gateways, are tools for API management and service governance. Located between backend services and clients, they are responsible for request routing, API monitoring, and API security. APISIX, as a mature distributed API gateway, boasts high performance, high scalability, and rich functionality, and is widely used in various scenarios.
[0003] API gateways typically include two planes: a data plane and a control plane. In practical applications, management rules can be stored in the ETCD cluster through the control plane. Then, through the long-connection and notification mechanism of the ETCD cluster, data can be updated to the data plane in real time to achieve synchronization of business rules.
[0004] In production environments, to accommodate diverse business needs, multiple API gateway systems are deployed in a single data center, or one API gateway system is deployed in multiple data centers. Regardless of the deployment method, multiple API gateway systems are required, which in turn necessitates multiple data planes and multiple control planes. However, deploying multiple control planes leads to wasted control plane resources and low utilization. Furthermore, since control planes are provided to users via domain names, deploying multiple control planes requires applying for multiple domain names, resulting in a cluttered user experience. Summary of the Invention
[0005] This invention provides a gateway control method and an API gateway system to solve the problem of wasted control resources in the deployment of existing API gateway systems.
[0006] In a first aspect, embodiments of the present invention provide a gateway control method applied to an API gateway system, the API gateway system including a control plane and M data planes, where M is a positive integer and M is greater than 1, the method comprising:
[0007] The control plane determines the ETCD clusters corresponding to each of the M data planes;
[0008] The control plane sends configuration information to the ETCD cluster corresponding to each of the M data planes, so that the ETCD cluster synchronizes the configuration information to the data plane corresponding to itself. The configuration information is used to indicate the service management rules of the data plane.
[0009] The data plane configures its own business rules based on the received configuration information and performs business processing according to the business rules.
[0010] In one optional implementation, the control plane sends configuration information to the ETCD cluster corresponding to each of the M data planes, including:
[0011] For any one of the M ETCD clusters, perform the following operations:
[0012] The control plane determines N servers deployed in the ETCD cluster, where N is a positive integer;
[0013] The control plane sends the configuration information of the data plane corresponding to the ETCD cluster to each of the N servers.
[0014] In one alternative implementation, the control plane determines multiple servers deployed in the ETCD cluster, including:
[0015] The control plane determines the N servers deployed in the ETCD cluster according to the first mapping relationship, wherein the first mapping relationship is used to characterize the correspondence between the ETCD cluster and the servers.
[0016] In one optional implementation, before the control plane determines the N servers deployed in the ETCD cluster according to the first mapping relationship, it further includes:
[0017] The control plane generates the first mapping relationship according to the configuration file and stores the first mapping relationship, wherein the configuration file carries an ETCD cluster list and a server list.
[0018] In one optional implementation, the control plane sends configuration information of the data plane corresponding to the ETCD cluster to the N servers, including:
[0019] The control plane determines the sub-configuration information to be sent to each server in the ETCD cluster based on the device identifier in the configuration information, wherein the configuration information includes N sub-configuration information;
[0020] For any one of the N servers, the control plane sends the sub-configuration information corresponding to the device identifier of the server to the server.
[0021] In one alternative implementation, the device carrying the control plane belongs to a different physical region from the K devices carrying the data plane, where K is a positive integer and K is less than or equal to M.
[0022] In an optional implementation, the method further includes:
[0023] The control plane establishes network links with each of the M ETCD clusters, and the M ETCD clusters establish network links with their respective data planes.
[0024] The performance of the communication link consisting of the control plane, the M ETCD clusters, and the M data planes is tested to obtain test data.
[0025] Based on the test data, relevant setting parameters are determined, and the control plane and the M data planes are configured according to the relevant setting parameters.
[0026] Secondly, embodiments of the present invention provide an API gateway system, including a control plane and M data planes, where M is a positive integer and M is greater than 1, wherein:
[0027] The control plane is used to determine the ETCD clusters corresponding to each of the M data planes; and to send configuration information to the ETCD clusters corresponding to each of the M data planes, so that the ETCD clusters synchronize the configuration information to the data planes corresponding to themselves, wherein the configuration information is used to indicate the service management rules of the data planes;
[0028] The data plane is used to configure its own business rules based on the received configuration information, and to perform business processing according to the business rules.
[0029] In one optional implementation, for any one of the M ETCD clusters, the control plane is specifically used for:
[0030] Determine the N servers deployed in the ETCD cluster, where N is a positive integer;
[0031] The configuration information of the data plane corresponding to the ETCD cluster is sent to each of the N servers respectively.
[0032] In one alternative implementation, the control plane is specifically used for:
[0033] Based on the first mapping relationship, the N servers deployed in the ETCD cluster are determined, wherein the first mapping relationship is used to characterize the correspondence between the ETCD cluster and the servers.
[0034] In one optional implementation, the control plane is further configured to generate the first mapping relationship according to the configuration file and store the first mapping relationship, wherein the configuration file carries an ETCD cluster list and a server list.
[0035] In one alternative implementation, the control plane is specifically used for:
[0036] Based on the device identifier in the configuration information, determine the sub-configuration information to be sent to each server in the ETCD cluster, wherein the configuration information includes N sub-configuration information;
[0037] For any one of the N servers, the sub-configuration information corresponding to the device identifier of the server is sent to the server.
[0038] In one alternative implementation, the device carrying the control plane belongs to a different physical region from the K devices carrying the data plane, where K is a positive integer and K is less than or equal to M.
[0039] In one optional implementation, the control plane is further configured to: establish network links with each of the M ETCD clusters; the M ETCD clusters are further configured to: establish network links with their respective corresponding data planes.
[0040] The parameter configurations of the control plane and the M data planes are determined based on relevant setting parameters, which are determined based on test data obtained from performance testing of the communication link composed of the control plane, the M ETCD clusters, and the M data planes.
[0041] Thirdly, embodiments of the present invention provide an electronic device, comprising:
[0042] Memory, used to store executable instructions;
[0043] A processor is configured to read and execute executable instructions stored in the memory to implement the steps of the gateway control method as described in any of the embodiments of the first aspect above.
[0044] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the steps of the gateway control method as described in any of the embodiments of the first aspect above.
[0045] Fifthly, embodiments of the present invention provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to perform the steps of the gateway control method as described in any of the embodiments of the first aspect above.
[0046] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0047] In the gateway control method provided by this invention, the API gateway system includes a control plane and M data planes, where M is a positive integer and greater than 1. The control plane determines the ETCD clusters corresponding to each of the M data planes and sends configuration information to the ETCD clusters corresponding to each of the M data planes, so that the ETCD clusters synchronize the configuration information to their corresponding data planes. The configuration information is used to indicate the business management rules of the data planes. The data planes configure their own business rules according to the received configuration information and perform business processing according to the business rules. By managing multiple ETCD clusters simultaneously through a single control plane, and with each ETCD cluster corresponding to one data plane, when multiple API gateway systems need to be deployed, only one control plane needs to be deployed to manage the rules of multiple data planes, improving the utilization of management resources. Furthermore, since only one control plane is needed, there is no need to apply for multiple domain names, thereby improving the user experience. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 A schematic diagram illustrating the deployment method of an API gateway system for related technologies;
[0050] Figure 2 This is a schematic diagram of the structure of an API gateway system provided in an embodiment of the present invention;
[0051] Figure 3 A schematic diagram illustrating the workflow of a gateway control method provided in an embodiment of the present invention;
[0052] Figure 4 This is a schematic diagram illustrating the complete workflow of a gateway control method provided in an embodiment of the present invention;
[0053] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0055] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0056] As mentioned earlier, an API gateway typically includes two planes: a data plane and a control plane. The data plane's main function is to handle user HTTP requests and coordinate and control all network communication between microservices. The control plane's main function is to provide unified management and configuration control for backend services. Therefore, in practical applications, management rules can be stored in the ETCD cluster through the control plane. Then, through the ETCD cluster's long-lived connections and notification mechanisms, data can be updated to the data plane in real time to achieve synchronization of business rules, such as gateway routing, upstream, and authentication rules.
[0057] In a production environment, to accommodate diverse business needs, multiple API gateway systems are deployed in a single data center, or one API gateway system is deployed in multiple data centers. Each API gateway system is used to execute a specific business function. Therefore, regardless of the deployment method, multiple API gateway systems must be deployed, which in turn requires multiple data planes and multiple control planes.
[0058] Figure 1 A schematic diagram illustrating the deployment method of an API gateway system provided by related technologies is shown. For example... Figure 1As shown, taking the deployment of 3 API gateway systems in computer room 1 as an example, API gateway system 01 includes a control plane 01 and a data plane 01, which interact with each other through ETCD cluster 01; API gateway system 02 includes a control plane 02 and a data plane 02, which interact with each other through ETCD cluster 02; API gateway system 03 includes a control plane 03 and a data plane 03, which interact with each other through ETCD cluster 03.
[0059] When deploying API gateways in a production environment, considering factors such as business continuity and departmental needs, multiple API gateway systems are typically required, such as API gateway systems 01-03. In this scenario, there will be multiple control planes, multiple data planes, and multiple ETCD cluster services. However, this deployment method for API gateway systems presents the following problems:
[0060] On the one hand, the control plane, as the management end, is a set of services that manage gateway rules, not a part of the actual business processing flow. Therefore, deploying multiple control planes would be a waste of resources, resulting in increased resources but low utilization.
[0061] On the other hand, the control plane is provided to users through domain names. Therefore, when deploying multiple control planes, multiple domain names also need to be applied for, resulting in a rather chaotic user experience.
[0062] Based on this, embodiments of the present invention provide a gateway control method and an API gateway system to enable one control plane to manage multiple ETCD clusters and their corresponding data planes, thereby improving the utilization rate of control resources of the control plane and reducing system costs.
[0063] The objectives, functional features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the invention. Furthermore, the embodiments and features described herein can be combined with each other without conflict.
[0064] The technical terms used in the gateway control method provided in this embodiment of the invention are explained as follows:
[0065] API Gateway: An API management and service governance tool that integrates functions such as configuration publishing, environment management, access authentication, user authentication, and access control. It is developed based on the Nginx container and serves as a single entry point for requests, distributing requests to the corresponding services, collecting results, and passing them to the requester, rather than having the client make separate requests to access each microservice.
[0066] Control plane: The control and management unit of the API gateway, primarily responsible for generating and managing control information such as routing tables to determine the rules for forwarding control packets in the network. For example, the process of creating routing tables is considered part of the control plane, which uses this control information to guide how data packets are sent from one place to another.
[0067] Data plane: This is the actual business processing unit of the API gateway, primarily responsible for forwarding data packets based on the business rules configured in the control plane. For example, after the API gateway system receives an IP packet, the data plane needs to decapsulate it and determine the outgoing interface according to the routing table created by the control plane, then forward the packet from that interface.
[0068] ETCD Cluster: A highly available tree-structured storage service, primarily used for shared configuration, service discovery, and coordination in distributed systems or computer clusters.
[0069] The gateway control method provided by the embodiments of the present invention will be described in detail below with reference to the accompanying drawings:
[0070] The gateway control method provided in this embodiment of the invention can be applied to API gateway systems. Figure 2 A schematic diagram of the structure of an API gateway system provided in an embodiment of the present invention is shown, as follows: Figure 2 As shown, the API gateway system 20 may include a control plane 21 and M data planes 22, where M is a positive integer and M is greater than 1. The control plane 21 is connected to M ETCD clusters 30 respectively, and each ETCD cluster 30 is connected to one data plane 22.
[0071] It should be noted that the API gateway system in this embodiment of the invention can support multiple protocols such as HTTPS, HTTP, TCP, UDP, and gRPC, and this embodiment of the invention does not impose any restrictions on them.
[0072] Figure 3 A schematic diagram illustrating the workflow of the gateway control method provided in an embodiment of the present invention is shown, as follows: Figure 3 As shown, the method may specifically include the following steps:
[0073] Step S301: Control plane 21 determines the ETCD cluster 30 corresponding to each of the M data planes 22.
[0074] In this process, after the control plane 21 determines the ETCD clusters 30 corresponding to the M data planes 22, the control plane 21 establishes network links with the M ETCD clusters 30 respectively, and the M ETCD clusters 30 establish network links with their respective corresponding data planes 22, thereby completing the deployment of the API gateway system architecture.
[0075] For ease of explanation, let's take the example of a control plane 21 managing three ETCD clusters 30. Figure 2 As shown, control plane 21 establishes network links with ETCD cluster A, ETCD cluster B and ETCD cluster C respectively. ETCD cluster A establishes a network link with data plane 1, and user terminal A calls service A to data plane 1. ETCD cluster B establishes a network link with data plane 2, and user terminal B calls service B to data plane 2. ETCD cluster C establishes a network link with data plane 3, and user terminal C calls service C to data plane 3.
[0076] In some embodiments, the devices carrying the control plane 21 and the M devices carrying the data planes 22 are within the same physical scope. For example, in practical applications, the devices carrying the control plane 21 and the M devices carrying the data planes 22 can all be deployed in the same data center.
[0077] In some embodiments, the device carrying the control plane 21 belongs to a different physical region from the K devices carrying the data plane 22, where K is a positive integer and K is less than or equal to M.
[0078] In practical applications, the M devices carrying the data plane 22 can be deployed in different computer rooms. This allows some of the devices carrying the data plane 22 to be deployed in the same computer room as the devices carrying the control plane 21, while the remaining devices carrying the data plane 22 and the devices carrying the control plane 21 are deployed in different computer rooms.
[0079] For example, the device carrying the control plane 21 and the device carrying the data plane 1 can be deployed in the computer room 1 at the same time, the device carrying the data plane 2 can be deployed in the computer room 2, and the device carrying the data plane 3 can be deployed in the computer room 3.
[0080] In some embodiments, after the API gateway system architecture is deployed, performance testing can be performed on the communication link consisting of the control plane, M ETCD clusters and M data planes to obtain test data; relevant setting parameters can be determined based on the test data, and the control plane and M data planes can be configured according to the relevant setting parameters.
[0081] In practical implementation, after the above system architecture is deployed, due to the increase in the number of memory and network links in the system, as well as the impact of factors such as cross-data center link establishment delays and connection timeout durations, it is necessary to conduct multiple rounds of performance tests on the communication link consisting of the control plane, M ETCD clusters, and M data planes with different data volumes to obtain multiple sets of test data. Then, based on the obtained multiple sets of test data, the optimal relevant setting parameters of the system are comprehensively evaluated. Finally, the parameters of the control plane and M data planes are configured according to the relevant setting parameters to achieve the effect of optimization.
[0082] In step S302, the control plane 21 sends configuration information to the ETCD cluster 30 corresponding to each of the M data planes 22, so that the ETCD cluster 30 synchronizes the configuration information to the data plane 22 corresponding to itself. The configuration information is used to indicate the business management rules of the data plane 22.
[0083] In some embodiments, the control plane 21 can send configuration information to the ETCD clusters 30 corresponding to each data plane 22 in the following way: For any one of the M ETCD clusters 30, the control plane 21 determines the N servers deployed in the ETCD cluster 30, and sends the configuration information of the data plane 22 corresponding to the ETCD cluster 30 to the N servers respectively, where N is a positive integer.
[0084] In practical implementation, an ETCD cluster 30 deploys multiple servers, each with an ETCD service component to perform corresponding data storage services. Therefore, when the control plane 21 sends configuration information to the ETCD cluster 30 corresponding to each data plane 22, it needs to send corresponding information to each server in the ETCD cluster 30. This information is all classified as configuration information. For example, sending the corresponding IP address to each server.
[0085] Therefore, in some embodiments, the configuration information may include N sub-configuration information, each of which carries the device identifier of the corresponding server. During the process of sending the configuration information, the control plane 21 can determine the sub-configuration information to be sent to each server in the ETCD cluster 30 based on the device identifier in the configuration information; and send the sub-configuration information corresponding to the device identifier of each server to the corresponding server.
[0086] Furthermore, control plane 21 can determine the number of servers deployed in each ETCD cluster 30 in the following ways:
[0087] In some embodiments, the control plane 21 can generate a first mapping relationship according to a configuration file and store the first mapping relationship, wherein the configuration file carries an ETCD cluster list and a server list.
[0088] In practical implementation, to reduce the business layer's awareness of code changes, control plane 21 is configured to dynamically obtain ETCD cluster objects in the storage layer. Specifically, a configuration file is pre-defined and stored in control plane 21, which carries a list of ETCD clusters and a list of servers. Furthermore, when the API gateway system starts, the original single ETCD cluster object is adjusted to multiple ETCD cluster objects, and a first mapping relationship is generated and stored based on the ETCD cluster list and server list carried in the configuration file. This first mapping relationship is used to represent the correspondence between ETCD clusters and servers.
[0089] In some embodiments, the control plane 21 may determine the N servers deployed in the ETCD cluster based on the first mapping relationship.
[0090] Based on the above settings, when the business layer makes a call, the server deployment status in each ETCD cluster can be determined through the configuration file stored in the storage layer and the first mapping relationship, thereby achieving the purpose of dynamically selecting ETCD cluster objects and managing multiple data sources (i.e., ETCD clusters in this embodiment of the invention). That is, the control plane 21 supports the function of dynamically and in real time linking to a specified ETCD cluster and reading relevant configuration information.
[0091] In step S303, the data plane 22 configures its own business rules according to the received configuration information and performs business processing according to the business rules.
[0092] In practical implementation, the ETCD cluster 30 can synchronize configuration information to the corresponding data plane 22 through long-lived connections and notification mechanisms. After receiving the configuration information, the data plane 22 can configure its own business rules according to the configuration information. When the user initiates a business call request, the data plane 22 will process the request according to its own business rules.
[0093] In addition, in some embodiments, a unified service entry point can be set for the control plane 21, and a user-operable interface can be configured for the control plane 21. In this way, the control plane 21 can provide users with the ability to switch between different ETCD clusters according to the user's usage permissions, further improving the user experience.
[0094] In the gateway control method provided by this invention, multiple ETCD clusters are managed simultaneously through a single control plane, and each ETCD cluster manages one data plane. This structure allows for the management of multiple data planes by deploying only one control plane when multiple API gateway systems need to be deployed, thereby improving the utilization of management resources. Furthermore, since only one control plane is needed, there is no need to apply for multiple domain names, thus enhancing the user experience.
[0095] Figure 4 A complete flowchart of the gateway control method provided in an embodiment of the present invention is shown, as follows: Figure 4 As shown, the method includes the following steps:
[0096] In step S401, the control plane 21 determines the ETCD clusters 30 corresponding to each of the M data planes 22, and establishes network links with each of the M ETCD clusters 30. The M ETCD clusters 30 then establish network links with their respective data planes 22.
[0097] Step S402: Perform performance testing on the communication link consisting of control plane 21, M ETCD clusters 30 and M data planes 22, and configure the parameters of control plane and M data planes according to the test results.
[0098] Step S403: Store the configuration file and the first mapping relationship in the control plane 21. The configuration file carries the ETCD cluster list and the server list. The first mapping relationship is used to represent the correspondence between the ETCD cluster and the server.
[0099] In step S404, the control plane 21 can determine the deployment status of the servers in the ETCD cluster according to the first mapping relationship, and send the configuration information of the data plane 22 corresponding to the ETCD cluster 30 to the corresponding servers.
[0100] In step S405, the ETCD cluster 30 synchronizes the configuration information to the data plane 22 corresponding to itself;
[0101] In step S406, the data plane 22 configures its own business rules according to the received configuration information and performs business processing according to the business rules.
[0102] Based on the same concept, this embodiment of the invention also provides an API gateway system. Since this API gateway system is the same system as the method in this embodiment of the invention, and the principle of solving the problem by this API gateway system is similar to that of this method, the implementation of this API gateway system can refer to the implementation of the method, and the repeated parts will not be described again.
[0103] like Figure 2As shown, the API gateway system 20 includes a control plane 21 and M data planes 2, where M is a positive integer and M is greater than 1, wherein:
[0104] The control plane 21 is used to determine the ETCD cluster 30 corresponding to each of the M data planes 22; and sends configuration information to the ETCD cluster 30 corresponding to each of the M data planes 22, so that the ETCD cluster 30 synchronizes the configuration information to the data plane 22 corresponding to itself. The configuration information is used to indicate the business management rules of the data plane 22.
[0105] Data plane 22 is used to configure its own business rules based on the received configuration information and to perform business processing according to the business rules.
[0106] In some embodiments, for any one of the M ETCD clusters 30, the control plane 21 is specifically used for:
[0107] Determine N servers to be deployed in ETCD cluster 30, where N is a positive integer;
[0108] Send the configuration information of the data plane 22 corresponding to ETCD cluster 30 to N servers respectively.
[0109] In some embodiments, the control plane 21 is specifically used for:
[0110] Based on the first mapping relationship, N servers deployed in the ETCD cluster 30 are determined, where the first mapping relationship is used to characterize the correspondence between the ETCD cluster and the servers.
[0111] In some embodiments, the control plane 21 is further configured to generate a first mapping relationship based on a configuration file and store the first mapping relationship, wherein the configuration file carries an ETCD cluster list and a server list.
[0112] In some embodiments, the control plane 21 is specifically used for:
[0113] Based on the device identifier in the configuration information, determine the sub-configuration information to be sent to each server in the ETCD cluster 30, wherein the configuration information includes N sub-configuration information;
[0114] For any one of the N servers, send the sub-configuration information corresponding to the server's device identifier to the server.
[0115] In some embodiments, the device carrying the control plane 21 belongs to a different physical region from the K devices carrying the data plane 22, where K is a positive integer and K is less than or equal to M.
[0116] In some embodiments, the control plane 21 is further configured to: establish network links with each of the M ETCD clusters 30; the M ETCD clusters 30 are further configured to: establish network links with their respective data planes 22.
[0117] The parameter configurations of the control plane 21 and the M data planes 22 are determined based on relevant setting parameters, which are determined based on test data obtained from performance testing of the communication link composed of the control plane 21, the M ETCD clusters 30, and the M data planes 22.
[0118] Based on the same concept, this embodiment of the invention also provides an electronic device. Since this electronic device is the same as the electronic device in the method of this embodiment of the invention, and the principle of solving the problem by this electronic device is similar to that of this method, the implementation of this electronic device can refer to the implementation of the method, and repeated details will not be described again.
[0119] The following reference Figure 5 To describe an electronic device 50 according to this embodiment of the present invention. Figure 5 The electronic device 50 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0120] like Figure 5 As shown, the electronic device 50 can be manifested as a general-purpose computing device, such as a terminal device. The components of the electronic device 50 may include, but are not limited to: at least one processor 51, at least one memory 52 storing instructions executable by the processor 51, and a bus 53 connecting different system components (including memory 52 and processor 51), wherein the processor 51 is a processor of a smart device.
[0121] Processor 51 performs the following steps by executing executable instructions:
[0122] The ETCD clusters corresponding to each of the M data planes are determined through the control plane.
[0123] The control plane sends configuration information to the ETCD cluster corresponding to each of the M data planes, so that the ETCD cluster can synchronize the configuration information to the data plane corresponding to itself. The configuration information is used to indicate the business management rules of the data plane.
[0124] Based on the received configuration information, the data plane configures its own business rules and performs business processing according to the business rules.
[0125] In some embodiments, for any one of the M ETCD clusters, processor 51 is specifically used for:
[0126] The control plane determines the N servers deployed in the ETCD cluster, where N is a positive integer;
[0127] The configuration information of the data plane corresponding to the ETCD cluster is sent to N servers through the control plane.
[0128] In some embodiments, the processor 51 is specifically used for:
[0129] The control plane determines the N servers deployed in the ETCD cluster based on the first mapping relationship, where the first mapping relationship is used to characterize the correspondence between the ETCD cluster and the servers.
[0130] In some embodiments, the processor 51 is further configured to:
[0131] The control plane generates the first mapping relationship based on the configuration file and stores the first mapping relationship. The configuration file carries the ETCD cluster list and the server list.
[0132] In some embodiments, the processor 51 is further configured to:
[0133] The control plane determines the sub-configuration information to be sent to each server in the ETCD cluster based on the device identifier in the configuration information. The configuration information includes N sub-configuration information.
[0134] For any one of the N servers, the sub-configuration information corresponding to the server's device identifier is sent to the server through the control plane.
[0135] In some embodiments, the device carrying the control plane belongs to a different physical region from the K devices carrying the data plane, where K is a positive integer and K is less than or equal to M.
[0136] In some embodiments, the processor 51 is specifically used for:
[0137] Establish network links with each of the M ETCD clusters through the control plane; establish network links with each of the M ETCD clusters through their respective data planes.
[0138] The parameter configurations of the control plane and the M data planes are determined based on relevant setting parameters, which are determined based on test data obtained from performance testing of the communication link consisting of the control plane, the M ETCD clusters, and the M data planes.
[0139] Bus 53 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or a local bus using any of the various bus structures.
[0140] The memory 52 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 521 and / or cache memory 522, and may further include read-only memory (ROM) 523.
[0141] The memory 52 may also include a program / utility 525 having a set (at least one) of program modules 524, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0142] Electronic device 50 can also communicate with one or more external devices 54 (e.g., keyboard, pointing device, etc.), and with one or more devices that enable a user to interact with electronic device 50, and / or with any device that enables electronic device 50 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 55. Furthermore, electronic device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 56. As shown, network adapter 56 communicates with other modules of electronic device 50 via bus 53. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0143] In some possible implementations, various aspects of the present invention can also be implemented as a program product comprising program code. When the program product is run on a terminal device, the program code causes the terminal device to execute the steps of the gateway control method according to various exemplary embodiments of the present disclosure described in the "Exemplary Methods" section above. For example, the control plane determines the ETCD clusters corresponding to each of the M data planes and sends configuration information to the ETCD clusters corresponding to each of the M data planes, so that the ETCD clusters synchronize the configuration information to the data planes corresponding to themselves. The configuration information is used to indicate the service management rules of the data planes. The data planes configure their own service rules according to the received configuration information and perform service processing according to the service rules.
[0144] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0145] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take many forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0146] The program code contained on the readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wired, optical fiber, RF, or any suitable combination thereof.
[0147] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0148] It should be noted that although several modules or sub-modules of the system have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided and embodied by multiple modules.
[0149] Furthermore, although the operation of the modules of the system of the present invention is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain operations may be omitted, multiple operations may be combined into one operation, and / or one operation may be broken down into multiple operations.
[0150] The invention has been described above with reference to block diagrams and / or flowcharts illustrating methods, apparatus (systems), and / or computer program products according to embodiments of the invention. It should be understood that a block of a block diagram and / or flowchart, as well as combinations of blocks of block diagrams and / or flowcharts, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, and / or other programmable data processing means to produce a machine such that the instructions, executable via the computer processor and / or other programmable data processing means, create methods for implementing the functions / actions specified in the blocks of the block diagrams and / or flowcharts.
[0151] Accordingly, the present invention can also be implemented using hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present invention can take the form of a computer program product on a computer-usable or computer-readable storage medium, having computer-usable or computer-readable program code implemented in the medium for use by or in conjunction with an instruction execution system. In the context of the present invention, a computer-usable or computer-readable medium can be any medium that can contain, store, communicate, transmit, or deliver a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0152] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A gateway control method, characterized in that, Applied to an API gateway system, the API gateway system comprising a control plane and M data planes, where M is a positive integer and M is greater than 1, the method includes: The control plane determines the ETCD clusters corresponding to each of the M data planes; The control plane sends configuration information to the ETCD cluster corresponding to each of the M data planes, so that the ETCD cluster synchronizes the configuration information to the data plane corresponding to itself. The configuration information is used to indicate the service management rules of the data plane. The data plane configures its own business rules based on the received configuration information and performs business processing according to the business rules.
2. The method as described in claim 1, characterized in that, The control plane sends configuration information to the ETCD cluster corresponding to each of the M data planes, including: For any one of the M ETCD clusters, perform the following operations: The control plane determines N servers deployed in the ETCD cluster, where N is a positive integer; The control plane sends the configuration information of the data plane corresponding to the ETCD cluster to each of the N servers.
3. The method as described in claim 2, characterized in that, The control plane determines the multiple servers deployed in the ETCD cluster, including: The control plane determines the N servers deployed in the ETCD cluster according to the first mapping relationship, wherein the first mapping relationship is used to characterize the correspondence between the ETCD cluster and the servers.
4. The method as described in claim 3, characterized in that, Before the control plane determines the N servers deployed in the ETCD cluster according to the first mapping relationship, it further includes: The control plane generates the first mapping relationship according to the configuration file and stores the first mapping relationship, wherein the configuration file carries an ETCD cluster list and a server list.
5. The method as described in claim 2, characterized in that, The control plane sends configuration information of the data plane corresponding to the ETCD cluster to the N servers, including: The control plane determines the sub-configuration information to be sent to each server in the ETCD cluster based on the device identifier in the configuration information, wherein the configuration information includes N sub-configuration information; For any one of the N servers, the control plane sends the sub-configuration information corresponding to the device identifier of the server to the server.
6. The method according to any one of claims 1-5, characterized in that, The device carrying the control plane belongs to a different physical region from the K devices carrying the data plane, where K is a positive integer and K is less than or equal to M.
7. The method according to any one of claims 1-5, characterized in that, The method further includes: The control plane establishes network links with each of the M ETCD clusters, and the M ETCD clusters establish network links with their respective data planes. The performance of the communication link consisting of the control plane, the M ETCD clusters, and the M data planes is tested to obtain test data. Based on the test data, relevant setting parameters are determined, and the control plane and the M data planes are configured according to the relevant setting parameters.
8. An API gateway system, characterized in that, It includes a control plane and M data planes, where M is a positive integer and M is greater than 1, where: The control plane is used to determine the ETCD clusters corresponding to each of the M data planes; and to send configuration information to the ETCD clusters corresponding to each of the M data planes, so that the ETCD clusters synchronize the configuration information to the data planes corresponding to themselves, wherein the configuration information is used to indicate the service management rules of the data planes; The data plane is used to configure its own business rules based on the received configuration information, and to perform business processing according to the business rules.
9. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor is configured to read and execute executable instructions stored in the memory to implement the steps of the gateway control method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the computer to perform the steps of the gateway control method as described in any one of claims 1-7.