Micro-service access method, device, electronic equipment and storage medium

By introducing a traffic management gateway, the challenge of microservice access in multi-container cluster deployments was solved, enabling fast and accurate microservice access and improving application scalability and user experience.

CN116614552BActive Publication Date: 2026-04-24SI-TECH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SI-TECH INFORMATION TECH CO LTD
Filing Date
2023-05-18
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

When deploying microservices in a multi-container cluster, it is difficult to access microservices quickly and accurately, which affects application development and user experience.

Method used

A traffic management gateway is introduced to obtain microservice access requests and, based on the microservice registration information, distribute the requests to the corresponding microservice access gateway, thereby enabling access to microservices in the container cluster. The traffic management gateway is deployed outside the container cluster and manages multiple microservice access gateways.

Benefits of technology

It improves the speed and accuracy of microservice access, reduces concerns during application development, and enhances application scalability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116614552B_ABST
    Figure CN116614552B_ABST
Patent Text Reader

Abstract

The application discloses a micro-service access method and device, electronic equipment and storage medium. The method comprises the following steps: obtaining a micro-service access request through a shunt management gateway; sending the micro-service access request to a micro-service access gateway corresponding to shunt micro-service registration information in the shunt management gateway according to the micro-service access request and the shunt micro-service registration information in the shunt management gateway through the shunt management gateway; accessing a micro-service in a container cluster corresponding to the micro-service access request through the micro-service access gateway; the micro-service is deployed in the container cluster; the micro-service access gateway is used for providing an access interface for each micro-service in the container cluster; the shunt management gateway is deployed outside the container cluster and is used for accessing a plurality of micro-service access gateways. The technical scheme of the embodiment of the application improves the speed and accuracy of micro-service access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a microservice access method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the development of Internet technology, the speed of microservice development is getting faster and faster, the number of microservices is increasing, and access to microservices is becoming more and more frequent.

[0003] Microservices are typically deployed in container clusters, and access to each microservice in the container cluster is achieved through a microservice access gateway.

[0004] However, as container clusters grow in size, a multi-container cluster deployment approach for microservices has emerged, making it difficult to access microservices quickly and accurately. Summary of the Invention

[0005] This invention provides a microservice access method, apparatus, electronic device, and storage medium, which improves the speed and accuracy of microservice access.

[0006] According to one aspect of the present invention, a microservice access method is provided, comprising:

[0007] Microservice access requests are obtained through the traffic management gateway;

[0008] Through the traffic management gateway, based on the microservice access request and the traffic microservice registration information in the traffic management gateway, the microservice access request is sent to the microservice access gateway corresponding to the traffic microservice registration information.

[0009] The microservice access gateway accesses the corresponding microservice in the container cluster based on the microservice access request; the microservice is deployed in the container cluster; the microservice access gateway provides access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways.

[0010] According to another aspect of the present invention, a microservice access device is provided, comprising: a traffic management gateway and a microservice access gateway;

[0011] The traffic management gateway is used to obtain microservice access requests;

[0012] The traffic management gateway is used to send microservice access requests to the microservice access gateway corresponding to the traffic microservice registration information based on the microservice access request and the traffic management gateway.

[0013] The microservice access gateway is used to access the corresponding microservice in the container cluster based on the microservice access request; the microservice is deployed in the container cluster; the microservice access gateway is used to provide access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to manage access to multiple microservice access gateways.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] At least one processor; and

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the microservice access method according to any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the microservice access method according to any embodiment of the present invention.

[0019] The technical solution of this invention obtains microservice access requests through a traffic management gateway. Based on the microservice access request and the traffic management gateway's microservice registration information, the traffic management gateway sends the microservice access request to the corresponding microservice access gateway. The microservice access gateway then accesses the corresponding microservice in the container cluster based on the microservice access request. The microservice is deployed in the container cluster, and the microservice access gateway provides access interfaces for each microservice in the container cluster. The traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways. This solves the problem of difficulty in quickly and accurately accessing microservices when deploying microservices in multiple container clusters, thus improving the speed and accuracy of microservice access.

[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0021] 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.

[0022] Figure 1 This is a flowchart of a microservice access method provided according to Embodiment 1 of the present invention;

[0023] Figure 2 This is a flowchart of a microservice access method provided according to Embodiment 2 of the present invention;

[0024] Figure 3 This is a schematic diagram of the microservice access method provided in Embodiment 2 of the present invention;

[0025] Figure 4 This is a schematic diagram of the working principle of the cluster traffic splitter controller provided in Embodiment 2 of the present invention;

[0026] Figure 5 This is a schematic diagram of the working principle of the microservice detector provided in Embodiment 2 of the present invention;

[0027] Figure 6 This is a flowchart of a microservice access method provided according to an embodiment of the present invention;

[0028] Figure 7 This is a flowchart of a method for updating registration information of a traffic-sharing microservice, provided according to an embodiment of the present invention;

[0029] Figure 8 This is a schematic diagram of the structure of a microservice access device according to Embodiment 3 of the present invention;

[0030] Figure 9 This is a schematic diagram of the structure of an electronic device that implements the microservice access method of this invention. Detailed Implementation

[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0032] It should be noted that the terms "first," "second," etc., 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. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] Example 1

[0034] Figure 1 This is a flowchart illustrating a microservice access method provided in Embodiment 1 of the present invention. This embodiment of the invention is applicable to accessing microservices. The method can be executed by a microservice access device, which can be implemented in hardware and / or software and can be configured in an electronic device that carries microservice access functionality.

[0035] See Figure 1 The microservice access methods shown include:

[0036] S110. Obtain microservice access requests through the traffic management gateway.

[0037] The traffic distribution gateway is used to distribute microservice access requests. Microservice access requests are used to access microservices within a container cluster. There can be multiple container clusters.

[0038] Specifically, the traffic management gateway can be used to obtain the microservice access requests sent by users on the front-end page.

[0039] S120. Through the traffic management gateway, based on the microservice access request and the traffic microservice registration information in the traffic management gateway, the microservice access request is sent to the microservice access gateway corresponding to the traffic microservice registration information.

[0040] The traffic splitting microservice registration information provides the basis for microservice access requests. This information can include the mapping between each microservice and the microservice access gateway. The traffic splitting microservice registration information can be stored in the cache corresponding to the traffic splitting management gateway. The microservice access gateway is used to register, publish, and access microservices.

[0041] Specifically, the traffic management gateway can query the corresponding microservice access gateway based on the microservice to be accessed in the microservice access request, and then send the microservice access request to the microservice access gateway corresponding to the traffic management gateway's cache.

[0042] S130. Through the microservice access gateway, access the corresponding microservice in the container cluster according to the microservice access request; the microservice is deployed in the container cluster; the microservice access gateway is used to provide access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways.

[0043] Microservices provide a specific function for an application. Each microservice operates independently. Each microservice can be updated, deployed, and scaled independently to meet the application's functional requirements. Applications are typically developed using a front-end / back-end separation architecture. An application can contain at least one microservice. Microservices are deployed inside containers. Containers are built as container clusters. A microservice access gateway is used to access microservices within containers. Inside a container, access can be made directly via virtual addresses; outside a container, internal addresses and ports can be mapped to the addresses and ports of the physical machine outside the container, allowing access to any microservice within the container through the microservice access gateway.

[0044] Specifically, you can access the microservice through the microservice access gateway, and access the microservice in the container cluster corresponding to the microservice access gateway based on the microservice access request.

[0045] In existing technologies, when the scale of a container cluster increases or the physical address of the container cluster changes, multiple container clusters need to be created. At this point, because the microservices contained in the application are deployed in multiple containers, and the virtual addresses within different containers are different and invisible to each other, situations may arise where the microservice route cannot be determined. This can be understood as not being able to access a microservice through a single microservice access gateway. Furthermore, when developing the application, it is necessary to pay attention to the correspondence between microservices and microservice access gateways, which also adds difficulty to application development. For example, an application supporting 50 million users might access the registration information of approximately 2,000 microservices, involving approximately 100 host physical machines in the container cluster, with a container cluster size of more than 3. In the above application scenario, the original application is deployed and migrated between different container clusters. During application development, it is necessary to modify the microservice access gateways and corresponding microservice access paths according to the specific deployment of the microservices. Each modification involves sorting out and adjusting the services that inter-call among the 2,000 microservices.

[0046] The technical solution of this invention obtains microservice access requests through a traffic management gateway. Based on the microservice access request and the traffic management gateway's traffic-sharing microservice registration information, the traffic management gateway sends the microservice access request to the corresponding microservice access gateway. The microservice access gateway then accesses the corresponding microservice in the container cluster based on the microservice access request. The microservice is deployed in the container cluster, and the microservice access gateway provides access interfaces for each microservice in the container cluster. The traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways. By using the traffic-sharing microservice registration information in the traffic management gateway, traffic sharing of microservice access requests is achieved, solving the problem of multiple container deployments of microservices affecting application access, improving the speed and accuracy of microservice access, reducing the perception by front-end users, solving the problem of needing to pay attention to microservice deployment during application development, and enhancing application scalability.

[0047] In an optional embodiment of the present invention, after accessing the microservice in the corresponding container cluster according to the microservice access request through the microservice access gateway, the method further includes: obtaining microservice access exception events fed back by the microservice access gateway through the traffic management gateway, and recording the number of microservice access exception events; and when the number of microservice access exception events is greater than or equal to a preset access exception event number threshold, obtaining the access microservice registration information of each container cluster through each microservice access gateway, and updating the traffic management gateway's traffic microservice registration information.

[0048] Microservice access exception events can be events where the corresponding microservice cannot be accessed. For example, a microservice access exception event can be a 404 error. The preset threshold for the number of access exception events can be the maximum number of pre-defined microservice access exception events. This preset threshold can be set and adjusted based on the experience of technical personnel. Access microservice registration information can be the registration information of the microservice in the corresponding microservice access gateway. Distributed microservice registration information can include the access microservice registration information uploaded by each microservice access gateway. When a microservice changes, or when the physical address of the container where the microservice resides changes, the access microservice registration information in the corresponding microservice access gateway can be updated. The access microservice registration information and the distributed microservice registration information contain the same types of information; both contain the microservice access path and the corresponding microservice access gateway. However, the distributed microservice registration information contains access microservice registration information uploaded by all microservice access gateways, while the access microservice registration information only contains the microservice registration information of a single microservice access gateway. The distributed microservice registration information is more comprehensive, and the access to microservice registration information is more timely.

[0049] Specifically, the traffic distribution management gateway can obtain microservice access exception events reported by the microservice access gateway and record the number of these events. When the number of microservice access exception events exceeds or equals a preset threshold, the traffic distribution management gateway can retrieve the access microservice registration information for each container cluster through each microservice access gateway. The traffic distribution microservice registration information in the traffic distribution management gateway can be compared with the access microservice registration information of each container cluster, and the traffic distribution microservice registration information with discrepancies can be updated accordingly.

[0050] This solution works by accessing the corresponding microservice in the container cluster through a microservice access gateway. After the microservice access request is received, the solution uses a traffic management gateway to obtain and record the number of microservice access exception events reported by the gateway. When the number of exception events exceeds a preset threshold, the traffic management gateway retrieves the microservice registration information for each container cluster and updates the traffic management gateway's microservice registration information. By setting a preset threshold, the availability of system resources is considered. Updating the traffic management gateway improves the timeliness of the traffic service registration information, further enhancing the efficiency and accuracy of subsequent microservice accesses.

[0051] In an optional embodiment of the present invention, the method further includes: periodically accessing each microservice access gateway through the traffic management gateway to obtain the access microservice registration information of each container cluster, and updating the traffic microservice registration information in the traffic management gateway.

[0052] The frequency of access to each microservice access gateway can be set and adjusted by technical personnel based on experience. For example, the frequency of access to each microservice access gateway can be daily, weekly, monthly, quarterly, or yearly. The frequency of access to each microservice access gateway can be set to a period with low microservice access frequency, such as 2 AM to 4 AM, to avoid diverting microservice registration information updates and affecting normal microservice access processes.

[0053] This solution uses a traffic management gateway to periodically access each microservice access gateway, obtain the access microservice registration information of each container cluster, and update the traffic management gateway's traffic microservice registration information. This improves the timeliness of the traffic microservice registration information and further enhances the efficiency and accuracy of subsequent microservice access.

[0054] In an optional embodiment of the present invention, accessing a microservice in a corresponding container cluster based on a microservice access request via a microservice access gateway includes: parsing the microservice access request through the microservice access gateway to obtain a microservice access path; and accessing the microservice in the corresponding container cluster based on the microservice access path through the microservice access gateway.

[0055] Specifically, a microservice access gateway can be used to parse microservice access requests and obtain the microservice access path. Based on this path, the gateway can then access the corresponding microservice within the container cluster.

[0056] This solution uses a microservice access gateway to parse microservice access requests, obtain microservice access paths, and then access the corresponding microservices in the container cluster based on these paths. This enables access to the corresponding microservices in the container cluster through the microservice access gateway.

[0057] In an optional embodiment of the present invention, sending microservice access requests to the microservice access gateway corresponding to the traffic splitting microservice registration information includes: obtaining the number of microservice access requests received by each microservice access gateway in each container cluster through the traffic splitting management gateway; one container cluster corresponds to at least two microservice access gateways; through the traffic splitting management gateway, based on the number of microservice access requests received by each microservice access gateway, selecting the microservice access gateway with the fewer microservice access requests received from the microservice access gateways corresponding to the traffic splitting microservice registration information, and determining it as the target microservice access gateway; sending the microservice access requests to the target microservice access gateway, so that the number of microservice access requests processed by each microservice access gateway in the same container cluster achieves load balancing.

[0058] A container cluster can correspond to at least two microservice access gateways. This means that the container cluster hosting a microservice is configured with multiple microservice access gateways, and the corresponding microservice can be accessed through any one of these gateways within the same container cluster. Functionally, any microservice access gateway within the same container cluster is equivalent.

[0059] Specifically, the traffic management gateway can be used to obtain the number of microservice access requests received by each microservice access gateway in each container cluster. The traffic management gateway can also be used to compare the number of microservice access requests received by each microservice access gateway. From the microservice access gateways corresponding to the traffic-split microservice registration information, the microservice access gateway with the fewest received microservice access requests can be selected as the target microservice access gateway. Microservice access requests can then be sent to the target microservice access gateway, which will then access the corresponding microservice based on the request.

[0060] This solution uses a traffic management gateway to obtain the number of microservice access requests received by each microservice access gateway in each container cluster. Each container cluster corresponds to at least two microservice access gateways. Through the traffic management gateway, based on the number of microservice access requests received by each microservice access gateway, the gateway with the fewer microservice access requests received is selected from the microservice access gateways corresponding to the traffic microservice registration information and designated as the target microservice access gateway. Microservice access requests are then sent to the target microservice access gateway, thereby achieving load balancing of the number of microservice access requests processed by each microservice access gateway in the same container cluster. This ensures the load capacity of each microservice access gateway in the same container cluster and further improves the processing efficiency of microservice access gateways for microservice access requests.

[0061] Example 2

[0062] Figure 2 This is a flowchart of a microservice access method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment of the present invention specifies the process of "sending the microservice access request to the microservice access gateway corresponding to the microservice registration information through the traffic management gateway, according to the microservice access request and the traffic management gateway's traffic microservice registration information" as follows: "parse the microservice access request through the traffic management gateway to obtain the microservice access path; query the traffic management gateway's traffic microservice registration information according to the microservice access path to obtain the query result; and, if the query result is not empty, traffic the microservice access request to the microservice access gateway corresponding to the query result." This achieves rapid traffic distribution of microservice access requests, further improving the efficiency and accuracy of microservice access. It should be noted that parts not detailed in this embodiment of the present invention can be found in the descriptions of other embodiments.

[0063] See Figure 2 The microservice access methods shown include:

[0064] S210. Obtain microservice access requests through the traffic management gateway.

[0065] S220. Through the traffic management gateway, the microservice access request is parsed to obtain the microservice access path.

[0066] The microservice access path can be the microservice's routing address. For example, a microservice access request can be an HTTP (Hypertext Transfer Protocol) request; and the service access path can be a URL (Uniform Resource Locator) path.

[0067] Specifically, the microservice access request can be parsed through the traffic management gateway to obtain the microservice access path.

[0068] S230. Through the traffic management gateway, query the registration information of the traffic-sharing microservices in the traffic management gateway according to the microservice access path, and obtain the query results.

[0069] The microservice registration information can include the microservice access path and the corresponding microservice access gateway.

[0070] Specifically, the traffic management gateway can be used to query the traffic-sharing microservice registration information in its cache based on the microservice access path, and obtain the microservice access gateway that corresponds to the microservice access path, which will then be identified as the query result.

[0071] S240. When the query result is not empty, the microservice access request is diverted to the microservice access gateway corresponding to the query result through the traffic management gateway.

[0072] The query result is not empty, which can be understood as the traffic distribution microservice registration information in the traffic distribution management gateway cache containing the microservice access path and the corresponding microservice access gateway information.

[0073] Specifically, a traffic management gateway can be used to redirect microservice access requests to the corresponding microservice access gateway when the query result is not empty.

[0074] S250. Through the microservice access gateway, access the corresponding microservice in the container cluster according to the microservice access request; the microservice is deployed in the container cluster; the microservice access gateway is used to provide access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways.

[0075] The technical solution of this invention obtains microservice access requests through a traffic management gateway. The gateway parses these requests to obtain microservice access paths. Based on these paths, the gateway queries the microservice registration information within it to obtain query results. If the query result is not empty, the gateway routes the microservice access request to the corresponding microservice access gateway. The microservice access gateway then accesses the corresponding microservice in the container cluster based on the access request. The microservices are deployed within the container cluster. The microservice access gateways provide access interfaces for each microservice in the container cluster. The traffic management gateways are deployed outside the container cluster and access multiple microservice access gateways. By utilizing the correspondence between microservice access paths and microservice access gateways contained in the microservice registration information, rapid traffic routing of microservice access requests is achieved, further improving the efficiency and accuracy of microservice access.

[0076] In an optional embodiment of the present invention, after querying the microservice registration information in the traffic management gateway according to the microservice access path through the traffic management gateway and obtaining the query result, the method further includes: when the query result is empty, the microservice access request is diverted to the general microservice access gateway through the traffic management gateway.

[0077] Optionally, the general-purpose microservice access gateway can be any microservice access gateway. The general-purpose microservice access gateway can be configured and adjusted by technical personnel based on experience. Optionally, the general-purpose microservice access gateway can also be the microservice access gateway with the highest usage frequency among all microservice access gateways. Optionally, the general-purpose microservice access gateway can also be the microservice access gateway of the container cluster containing the most microservices. Optionally, the general-purpose microservice access gateway can also be a microservice access gateway specifically designed to offload microservice access requests with empty query results. Optionally, the general-purpose microservice access gateway can also accept both microservice access requests with empty query results and microservice access requests with non-empty query results.

[0078] Specifically, a traffic management gateway can be used to redirect microservice access requests to a general microservice access gateway when the query result for the microservice access path is empty.

[0079] This solution improves the fault tolerance of microservice access by querying the registration information of the microservices in the traffic management gateway according to the microservice access path. After obtaining the query results, the traffic management gateway will redirect the microservice access request to the general microservice access gateway when the query result is empty, thereby improving the fault tolerance of microservice access.

[0080] Figure 3This is a schematic diagram of the microservice access method provided in Embodiment 2 of the present invention. Figure 3 As shown, a traffic management gateway is added outside the container cluster. For example, the traffic management gateway is an Nginx (reverse proxy) gateway. Optionally, the Nginx gateway deployment can use x86 server virtual machines, with a total of approximately 20 containers. The traffic management gateway includes a cluster traffic controller and a microservice detector. Deploying the traffic management gateway outside the container cluster has no impact on the container cluster, the microservices deployed inside the container cluster, or the applications corresponding to the microservices. The number of container clusters can include at least two. Inside the container cluster, a microservice access gateway, a registry center, and multiple microservices are deployed. The microservice access gateway is used to access multiple microservices in the container cluster. The registry center is used to store registration information for accessing microservices. Microservices are used to implement a specific function of the application.

[0081] Figure 4 This is a schematic diagram illustrating the working principle of the cluster traffic splitter controller provided in Embodiment 2 of the present invention. Figure 4 As shown, when the cluster traffic splitting controller in the traffic splitting management gateway receives a microservice access request from a user, it loads the traffic splitting microservice registration information from the cache. Through microservice identification, it matches the traffic splitting microservice registration information in the cache to determine the microservice access gateway corresponding to the microservice access request. Through microservice traffic splitting, different microservice access requests are distributed to the corresponding microservice access gateways under the container cluster for processing.

[0082] Figure 5 This is a schematic diagram illustrating the working principle of the microservice detector provided in Embodiment 2 of the present invention. Figure 5 As shown, the microservice detector has two working modes: abnormal microservice detection and periodic microservice detection. Abnormal microservice detection involves identifying abnormal microservice access events (such as 404 errors) reported by the microservice access gateway and probing the microservice access gateways of each container cluster to improve the microservice registration information for traffic distribution. Periodic microservice detection involves periodically probing the microservice access gateways of each container cluster to improve the microservice registration information for traffic distribution.

[0083] Figure 6 This is a flowchart of a microservice access method provided according to an embodiment of the present invention. See also... Figure 6 The microservice access methods shown include:

[0084] S610, Obtain microservice access requests.

[0085] Specifically, microservice access requests can be obtained through a traffic management gateway.

[0086] S620. Parse the microservice access path in the microservice access request.

[0087] Specifically, the microservice access path in a microservice access request can be resolved through a traffic management gateway.

[0088] S630. Determine if the service is in the cached microservice registration information. If yes, proceed to S650; otherwise, proceed to S640.

[0089] Specifically, the traffic distribution management gateway can be used to query whether the microservice access path is in the cached traffic distribution microservice registration information. If it is, the query result is considered not empty; otherwise, the query result is considered empty.

[0090] S640, specify that traffic should be routed to the general microservice access gateway.

[0091] Specifically, when the query result is empty, the traffic can be directed to the general microservice access gateway through the traffic management gateway.

[0092] S650, Obtain the registration information of the offloading microservice.

[0093] Specifically, the traffic distribution management gateway can be used to obtain the registration information of the traffic distribution microservices cached in the traffic distribution management gateway.

[0094] S660. Determine the microservice access gateway corresponding to the service registration information.

[0095] Specifically, the traffic management gateway can be used to determine the microservice access gateway corresponding to the service registration information.

[0096] S670. Forward the microservice access request to the corresponding microservice access gateway.

[0097] Specifically, a traffic management gateway can be used to forward microservice access requests to the corresponding microservice access gateway.

[0098] S680, Record exception call.

[0099] Specifically, it can obtain and record microservice access exception events reported by the microservice access gateway.

[0100] This solution describes the processing logic of the internal cluster traffic splitting controller of the traffic splitting management gateway. It identifies the microservice access path through microservice access requests, determines the microservice access gateway corresponding to the microservice access request based on the traffic splitting microservice registration information in the cache, and splits the microservice access request to the corresponding microservice access gateway on the container cluster. This realizes access to microservices and improves the efficiency and accuracy of microservice access.

[0101] Figure 7 This is a flowchart of a method for updating registration information of a traffic-sharing microservice, provided by an embodiment of the present invention. See also... Figure 7 The method for updating registration information of the offloading microservices shown includes:

[0102] S710, Analyze the records of abnormal calls.

[0103] Specifically, the traffic management gateway can be used to obtain microservice access exception events reported by the microservice access gateway and record the number of microservice access exception events.

[0104] S720, Analyze timing strategies.

[0105] Specifically, the access period for each microservice access gateway can be obtained through the traffic management gateway. The timing strategy can include the access period for each microservice access gateway.

[0106] S730. Determine whether it is necessary to probe and access microservice registration information; if yes, execute S740; if no, return to execute S710 and S720.

[0107] Specifically, it can be determined whether the number of microservice access exception events is greater than or equal to a preset threshold for the number of access exception events, and whether the period for accessing each of the microservice access gateways has been reached, in order to determine whether it is necessary to probe the access to microservice registration information. If the number of microservice access exception events detected is greater than or equal to the preset threshold for the number of access exception events, and / or the period for accessing each of the microservice access gateways has been reached, it is considered that it is necessary to probe the access to microservice registration information, and S740 is executed; otherwise, S710 and S720 are executed.

[0108] S740 calls the microservice access gateway of different container clusters to obtain the microservice registration information.

[0109] Specifically, the traffic management gateway can be used to call the microservice access gateway of each container cluster to obtain the access microservice registration information corresponding to each microservice access gateway.

[0110] S750: Retrieve the registration information of the split microservice from the cache.

[0111] Specifically, the traffic distribution management gateway can be used to obtain the registration information of the traffic distribution microservices cached in the traffic distribution management gateway.

[0112] S760, Update the registration information of the offloading microservices.

[0113] Specifically, the traffic management gateway can update the traffic distribution microservice registration information based on the access microservice registration information of each container cluster.

[0114] This solution describes the processing logic within the business detector of the traffic distribution management gateway. It uses microservice access exception events reported by the microservice access gateway and combines them with a timed strategy to determine whether the traffic distribution microservice registration information in the traffic distribution management gateway needs to be updated. It probes the complete access microservice registration information by calling the microservice access gateways of different container clusters, compares the cached traffic distribution microservice registration information with all access microservice registration information collected by the probe, and updates the traffic distribution microservice registration information with the differences so that it can be loaded and used by the cluster traffic distribution controller.

[0115] Example 3

[0116] Figure 8 This is a schematic diagram of a microservice access device provided in Embodiment 3 of the present invention. This embodiment of the present invention is applicable to situations involving access to microservices. The device can execute microservice access methods and can be implemented in hardware and / or software. The device can be configured in an electronic device that carries microservice access functionality.

[0117] See Figure 8 The microservice access device shown includes: a traffic management gateway 810 and a microservice access gateway 820; wherein, the traffic management gateway 810 is used to obtain microservice access requests; the traffic management gateway 810 is used to send the microservice access request to the microservice access gateway corresponding to the traffic microservice registration information according to the microservice access request and the traffic microservice registration information in the traffic management gateway; the microservice access gateway 820 is used to access the corresponding microservice in the container cluster according to the microservice access request; the microservice is deployed in the container cluster; the microservice access gateway is used to provide access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to manage access to multiple microservice access gateways.

[0118] The technical solution of this invention obtains microservice access requests through a traffic management gateway. Based on the microservice access request and the traffic management gateway's traffic-sharing microservice registration information, the traffic management gateway sends the microservice access request to the corresponding microservice access gateway. The microservice access gateway then accesses the corresponding microservice in the container cluster based on the microservice access request. The microservice is deployed in the container cluster, and the microservice access gateway provides access interfaces for each microservice in the container cluster. The traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways. By using the traffic-sharing microservice registration information in the traffic management gateway, traffic sharing of microservice access requests is achieved, solving the problem of multiple container deployments of microservices affecting application access, improving the speed and accuracy of microservice access, reducing the perception by front-end users, solving the problem of needing to pay attention to microservice deployment during application development, and enhancing application scalability.

[0119] In an optional embodiment of the present invention, the traffic management gateway 810 includes: a traffic management gateway 810 for parsing microservice access requests to obtain microservice access paths; a traffic management gateway 810 for querying traffic-sharing microservice registration information in the traffic management gateway according to the microservice access paths to obtain query results; and a traffic management gateway 810 for diverting microservice access requests to the microservice access gateway corresponding to the query results when the query results are not empty.

[0120] In an optional embodiment of the present invention, after querying the microservice registration information in the traffic management gateway 810 according to the microservice access path and obtaining the query result, the traffic management gateway 810 further includes: the traffic management gateway 810 is used to divert the microservice access request to the general microservice access gateway when the query result is empty.

[0121] In an optional embodiment of the present invention, after accessing the microservice in the corresponding container cluster according to the microservice access request through the microservice access gateway 820, the microservice access gateway 820 and the traffic management gateway 810 further include: the traffic management gateway 810, which is used to obtain microservice access exception events fed back by the microservice access gateway and record the number of microservice access exception events; and the traffic management gateway 810, which is used to obtain the access microservice registration information of each container cluster through each microservice access gateway and update the traffic management gateway's traffic microservice registration information when the number of microservice access exception events is greater than or equal to a preset access exception event number threshold.

[0122] In an optional embodiment of the present invention, the traffic management gateway 810 further includes: the traffic management gateway 810 is used to periodically access each microservice access gateway, obtain access microservice registration information of each container cluster, and update the traffic microservice registration information in the traffic management gateway.

[0123] In an optional embodiment of the present invention, the microservice access gateway 820 includes: a microservice access gateway 820 for parsing microservice access requests to obtain microservice access paths; and a microservice access gateway 820 for accessing microservices in the corresponding container cluster according to the microservice access paths.

[0124] In an optional embodiment of the present invention, the traffic distribution management gateway 810 includes: a traffic distribution management gateway 810 configured to obtain the number of microservice access requests received by each microservice access gateway in each container cluster; one container cluster corresponds to at least two microservice access gateways; the traffic distribution management gateway 810 configured to, based on the number of microservice access requests received by each microservice access gateway, select the microservice access gateway with the fewer microservice access requests received from among the microservice access gateways corresponding to the traffic distribution microservice registration information, and determine it as the target microservice access gateway; the traffic distribution management gateway 810 configured to send the microservice access requests to the target microservice access gateway, so that the number of microservice access requests processed by each microservice access gateway in the same container cluster achieves load balancing.

[0125] The microservice access device provided in the embodiments of the present invention can execute the microservice access method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0126] In the technical solutions of this invention, the microservice access requests, microservice access exception events fed back by the microservice access gateway, access to microservice registration information, and the storage and application of access to microservice registration information all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0127] Example 4

[0128] Figure 9 A schematic diagram of an electronic device 900 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0129] like Figure 9As shown, the electronic device 900 includes at least one processor 901 and a memory, such as a read-only memory (ROM) 902 or a random access memory (RAM) 903, communicatively connected to the at least one processor 901. The memory stores computer programs executable by the at least one processor. The processor 901 can perform various appropriate actions and processes based on the computer program stored in the ROM 902 or loaded into the RAM 903 from storage unit 908. The RAM 903 can also store various programs and data required for the operation of the electronic device 900. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0130] Multiple components in electronic device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0131] Processor 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 901 performs the various methods and processes described above, such as microservice access methods.

[0132] In some embodiments, the microservice access method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by processor 901, one or more steps of the microservice access method described above may be performed. Alternatively, in other embodiments, processor 901 may be configured to execute the microservice access method by any other suitable means (e.g., by means of firmware).

[0133] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0134] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0135] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0136] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0137] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0138] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system. It addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability.

[0139] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.

[0140] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A microservice access method, characterized in that, include: Microservice access requests are obtained through the traffic management gateway; Through the traffic management gateway, the microservice access request is sent to the microservice access gateway corresponding to the traffic microservice registration information, based on the microservice access request and the traffic microservice registration information in the traffic management gateway. The microservice access gateway accesses the corresponding microservice in the container cluster based on the microservice access request. The microservices are deployed in the container cluster; The microservice access gateway is used to provide access interfaces for each of the microservices in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to access multiple microservice access gateways. The traffic management gateway obtains microservice access exception events reported by the microservice access gateway and records the number of such events; wherein, a microservice access exception event is an event in which the corresponding microservice cannot be accessed. When the number of microservice access anomaly events is greater than or equal to a preset threshold, the traffic management gateway obtains the access microservice registration information of each container cluster through each microservice access gateway and updates the traffic management gateway's traffic microservice registration information. Both the access microservice registration information and the traffic microservice registration information contain microservice access paths and corresponding microservice access gateways. The traffic microservice registration information includes all access microservice registration information uploaded by all microservice access gateways. The access microservice registration information also includes the microservice registration information of a single microservice access gateway. The access microservice registration information represents the registration information of the microservice in its corresponding microservice access gateway.

2. The method according to claim 1, characterized in that, The step of sending the microservice access request to the microservice access gateway corresponding to the microservice registration information through the traffic distribution management gateway, based on the microservice access request and the traffic distribution microservice registration information in the traffic distribution management gateway, includes: The microservice access request is parsed through the traffic management gateway to obtain the microservice access path; The traffic distribution management gateway is used to query the registration information of the traffic distribution microservices in the traffic distribution management gateway according to the microservice access path, and the query results are obtained. When the query result is not empty, the microservice access request is routed to the microservice access gateway corresponding to the query result through the traffic management gateway.

3. The method according to claim 2, characterized in that, After querying the traffic distribution microservice registration information in the traffic distribution management gateway according to the microservice access path and obtaining the query result, the process further includes: When the query result is empty, the microservice access request is diverted to the general microservice access gateway through the traffic management gateway.

4. The method according to claim 1, characterized in that, Also includes: The traffic distribution management gateway periodically accesses each of the microservice access gateways to obtain the access microservice registration information of each container cluster, and updates the traffic distribution microservice registration information in the traffic distribution management gateway.

5. The method according to claim 1, characterized in that, The step of accessing the corresponding microservice in the container cluster through the microservice access gateway according to the microservice access request includes: The microservice access gateway parses the microservice access request to obtain the microservice access path; Through the microservice access gateway, the corresponding microservice in the container cluster is accessed according to the microservice access path.

6. The method according to claim 1, characterized in that, Sending the microservice access request to the microservice access gateway corresponding to the traffic splitting microservice registration information includes: The number of microservice access requests received by each microservice access gateway in each container cluster is obtained through the traffic management gateway; each container cluster corresponds to at least two microservice access gateways. By using the traffic management gateway, based on the number of microservice access requests received by each microservice access gateway, the microservice access gateway with the fewer microservice access requests received is selected from the microservice access gateways corresponding to the traffic microservice registration information and determined as the target microservice access gateway. By using a traffic management gateway, the microservice access requests are sent to the target microservice access gateway, so that the number of microservice access requests processed by each microservice access gateway in the same container cluster can be load balanced.

7. A microservice access device, characterized in that, include: Traffic management gateway and microservice access gateway; The traffic management gateway is used to obtain microservice access requests; The traffic distribution management gateway is used to send the microservice access request to the microservice access gateway corresponding to the traffic distribution microservice registration information based on the microservice access request and the traffic distribution microservice registration information in the traffic distribution management gateway. The microservice access gateway is used to access the corresponding microservice in the container cluster according to the microservice access request. The microservices are deployed in the container cluster; The microservice access gateway is used to provide access interfaces for each microservice in the container cluster; the traffic management gateway is deployed outside the container cluster and is used to manage access to multiple microservice access gateways. The traffic management gateway is used to obtain microservice access exception events fed back by the microservice access gateway and record the number of microservice access exception events; wherein, the microservice access exception event is an event in which the corresponding microservice cannot be accessed. The traffic distribution management gateway is used to update the traffic distribution microservice registration information in the traffic distribution management gateway when the number of microservice access exception events is greater than or equal to a preset threshold for the number of access exception events, by obtaining the access microservice registration information of each container cluster through each microservice access gateway; wherein, both the access microservice registration information and the traffic distribution microservice registration information contain microservice access paths and corresponding microservice access gateways; the traffic distribution microservice registration information contains the access microservice registration information uploaded by all microservice access gateways; the access microservice registration information contains the microservice registration information of a single microservice access gateway; the access microservice registration information is the registration information of the microservice in the corresponding microservice access gateway.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the microservice access method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the microservice access method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Intra-city active-active system and method based on micro-service

    CN112671882A

  • Gateway traffic control method and device, electronic equipment and storage medium

    CN114827246A