Micro-service fusing method and device and storage medium

By using plug-ins in Kubernetes to intercept and detect business requests between microservices, it provides a non-intrusive circuit breaker function, which solves the development complexity and stability problems of the circuit breaker function in the microservice architecture and achieves low development volume and high stability. fuse mechanism.

CN118689708APending Publication Date: 2024-09-24GUANGZHOU QUYAN NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410723697.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In a microservice architecture, call delays, errors or failures between microservices may lead to an avalanche phenomenon. Existing technology requires the circuit breaker function code to be written independently in each microservice, resulting in increased development volume, redundant workload and design Intrusive, highly complex, affecting stability.

Method used

In the container orchestration engine Kubernetes, plug-ins are used to intercept business requests between microservices, perform circuit breaker detection, and prevent request transmission when circuit breakers are detected, providing a non-intrusive circuit breaker function. Multiple microservices can share plug-ins to reduce redundancy. I code development.

Benefits of technology

It achieves low development volume and non-intrusive fuse function, reduces operational complexity, maintains the stability of microservices, and reduces redundant workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689708A
    Figure CN118689708A
Patent Text Reader

Abstract

The invention discloses a micro-service fusing method, device and equipment and a storage medium, and the method comprises the steps: a container arrangement engine Kubernetes is provided with a plug-in and a container, the container is loaded with a micro-service, and the plug-in is called to intercept a business request sent by the current micro-service to other micro-services; calling the plug-in to perform fusing detection on the current micro-service according to the service request to obtain a detection result; if the detection result is fusing, the plug-in is called to prohibit the business request from being transmitted to other micro-services, and error information representing fusing is sent to the current micro-service; and if the detection result is that the service request is not fused, calling the plug-in to transmit the service request to other micro-services. According to the technical scheme, the multiple micro-services can share the plug-in to achieve the fusing function, codes of the fusing function are not independently developed, a large amount of redundant workloads are reduced, the development amount can be effectively reduced, the plug-in is of a non-intrusive design, the micro-services have the fusing function, the operation complexity is low, and the stability of the micro-services is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of container clusters, and in particular to a fusing method, device and storage medium for microservices. Background Art

[0002] In the microservice architecture, there are calling relationships between certain microservices. Due to various reasons such as network failure and service overload, the calls between microservices may be delayed, erroneous or fail.

[0003] Currently, during the development of microservices, the code for the circuit breaker function is added to the code of the microservices, so that the call will be circuit-broken when there is a delay, error or failure in the call, preventing the erroneous call from continuing to spread and forming an avalanche, thereby ensuring the stability and reliability of the system.

[0004] However, different microservices need to independently write circuit breaker codes during development, which will increase the amount of development and result in a large amount of redundant work. In addition, the circuit breaker code is an intrusive design, that is, the circuit breaker code is injected into the process memory of the microservice so that the microservice process has the circuit breaker function. The operation is complex and affects the stability of the microservice. Summary of the invention

[0005] The present invention provides a microservice fusing method, device, equipment and storage medium, so as to provide a microservice with a low development effort and non-intrusive fusing function and ensure the stability of the microservice.

[0006] According to one aspect of the present invention, a microservice fusing method is provided, which is applied to a container orchestration engine Kubernetes, wherein the container orchestration engine Kubernetes has a plug-in and a container, and the microservice is loaded in the container, and the method includes:

[0007] Calling the plug-in to intercept the business request sent by the current microservice to other microservices;

[0008] Call the plug-in to perform a fuse test on the current microservice according to the business request to obtain a test result;

[0009] If the detection result is a blown circuit, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a blown circuit is sent to the current microservice;

[0010] If the detection result is that the fuse is not blown, the plug-in is called to pass the business request to other microservices.

[0011] According to another aspect of the present invention, a microservice fuse device is provided, which is applied to a container orchestration engine Kubernetes, wherein the container orchestration engine Kubernetes has a plug-in and a container, wherein the microservice is loaded in the container, and the device comprises:

[0012] A business request interception module, used to call the plug-in to intercept business requests sent by the current microservice to other microservices;

[0013] A fuse detection module is used to call the plug-in to perform a fuse detection on the current microservice according to the business request to obtain a detection result;

[0014] A fuse processing module, for invoking the plug-in to prohibit the business request from being transmitted to other microservices if the detection result is a fuse, and sending an error message indicating a fuse to the current microservice;

[0015] The unbroken processing module is used to call the plug-in to transfer the business request to other microservices if the detection result is unbroken.

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

[0017] at least one processor; and

[0018] a memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice fusing method described in any embodiment of the present invention.

[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the microservice fusing method described in any embodiment of the present invention when executed.

[0021] In this embodiment, the container orchestration engine Kubernetes has plug-ins and containers, and microservices are loaded in the container. The plug-in is called to intercept the business request sent by the current microservice to other microservices; the plug-in is called to perform a fuse test on the current microservice based on the business request to obtain the test result; if the test result is a fuse, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a fuse is sent to the current microservice; if the test result is not a fuse, the plug-in is called to pass the business request to other microservices. Multiple microservices can share plug-ins to implement the fuse function, and do not develop the code for the fuse function separately, which reduces a lot of redundant workload and can effectively reduce the amount of development. The plug-in is a non-intrusive design that allows microservices to have a fuse function, with low operational complexity and maintains the stability of microservices.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 This is a flow chart of a microservice fusing method provided according to Embodiment 1 of the present invention;

[0025] Figure 2 This is an architecture diagram of a deployment plug-in provided according to Embodiment 1 of the present invention;

[0026] Figure 3 This is a flow chart of a microservice fusing method provided according to Embodiment 2 of the present invention;

[0027] Figure 4 This is a flow chart of a microservice fusing method provided according to Embodiment 3 of the present invention;

[0028] Figure 5 This is a schematic diagram of the structure of a fuse device for a microservice provided according to Embodiment 4 of the present invention;

[0029] Figure 6 It is a schematic diagram of the structure of an electronic device provided according to Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] Embodiment 1

[0033] Figure 1 This is a flowchart of a microservice fusing method provided in the first embodiment of the present invention. This embodiment is applicable to the case where a microservice is provided with a fusing function in the form of a plug-in in the container orchestration engine Kubernetes. The method can be executed by a microservice fusing device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0034] Step 101: Call a plug-in to intercept business requests sent by the current microservice to other microservices.

[0035] This embodiment can be applied to the container orchestration engine Kubernetes. The container orchestration engine Kubernetes is a platform for automated container operations, providing functions such as application deployment, maintenance, and expansion mechanisms, and can be used to manage containerized applications running across clusters.

[0036] The container orchestration engine Kubernetes contains a group of nodes, which can be physical machines or virtual machines, on which the Kubernetes platform is installed.

[0037] Generally speaking, the container orchestration engine Kubernetes has the following structure:

[0038] 1. Master: A container orchestration engine Kubernetes has a master node Master, which has a series of components with different functions, such as API Server (Application Programming Interface Server, interface service), etc. API Server provides REST (Representational State Transfer) endpoints that can be used to interact with the container orchestration engine Kubernetes. The master node Master can be used to create and replicate the RC (Replication Controller) of the instance Pod, and RC can be used to ensure the number of copies of the instance Pod running at any time, so as to ensure that the instance Pod is always available.

[0039] 2. Node: A node is a physical machine or a virtual machine. As a worker, a node is also commonly called a deployment Minion. Each node can run components such as Kubelet, Kube-proxy, Docker, or Rocket.

[0040] Kubelet: Master node agent.

[0041] Kube-proxy: Used by Services to route connections to instance Pods.

[0042] Docker or Rocket: The technology used by the container orchestration engine Kubernetes to create containers.

[0043] 3. Pod (instance): An instance pod is the smallest or simplest basic unit created or deployed by the container orchestration engine Kubernetes. An instance Pod represents a process running on the container orchestration engine Kubernetes. An instance Pod encapsulates one or more containers, storage resources, an independent IP (Internet Protocol) address, and policy options for managing and controlling how containers run.

[0044] Among them, the container is an abstraction of program code and its dependencies at the application layer. Multiple containers run as independent processes in the user space on the same machine and share the operating system kernel.

[0045] In this embodiment, microservices with different functions are loaded in the container, and some microservices have calling relationships between them. For example, the microservice responsible for login will call the microservice responsible for checking the legitimacy of the user, and so on.

[0046] Microservices are a cloud-native architecture approach that includes many loosely coupled and independently deployable small components or services in a single application. These services usually have their own technology stack, including databases and data management models; they communicate with each other through REST APIs, event streams, and message brokers, and are organized according to business capabilities.

[0047] Microservices are easy to update code, and new features or functions can be added directly without having to update the entire application. Users can use different technology stacks and different programming languages ​​for different components. Components can be scaled independently of each other, reducing the waste and cost associated with having to scale the entire application.

[0048] 4. Plug-ins: Plug-ins in the container orchestration engine Kubernetes are a way to extend the functions of the container orchestration engine Kubernetes. It supports various custom functions and can add new functions or modify existing functions through plug-ins. It can be a containerized application or a standalone binary file. The plug-in can communicate with the container orchestration engine Kubernetes through the container orchestration engine Kubernetes's API or webhook (web hook).

[0049] In this embodiment, a plug-in with a fuse function is written and deployed in the container orchestration engine Kubernetes. That is, the plug-in in the container orchestration engine Kubernetes provides a fuse function for the microservice. Then, Figure 2 As shown, during the operation of microservices in the container orchestration engine Kubernetes, if the current microservice calls other microservices, that is, the business requests sent by the current microservice to other microservices, such as HTTP requests (Hypertext Transfer Protocol), gRPC (a remote procedure call framework) requests, etc., the plug-in can intercept the business requests sent by the current microservice to other microservices.

[0050] Step 102: Call the plug-in to perform a fuse test on the current microservice according to the business request to obtain the test result.

[0051] In this embodiment, if Figure 2 As shown, when the plug-in intercepts a business request, it can perform a fuse detection on the current microservice based on the business request to detect whether the call to the current microservice is fused, thereby obtaining a detection result, wherein the detection result includes fused and not fused.

[0052] In the specific implementation, the plug-in can parse the structure of the business request, query the path of the source of the business request, record it as the service path, and identify the current microservice with the service path.

[0053] The plug-in can locally search for the business label annotated on the service path. The business label is a label generated by the fuse detection of the current microservice.

[0054] If the business tag indicates a circuit breaker, the detection result generated for the current microservice is a circuit breaker.

[0055] If the business tag indicates that the circuit is not blown, the detection result generated for the current microservice is not blown.

[0056] Step 103: If the detection result is a blown circuit, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a blown circuit is sent to the current microservice.

[0057] If the result of the fuse detection on the current microservice is a fuse, the plug-in can prohibit the business request from being passed to other microservices, end the current business request, and send an error message indicating a fuse to the current microservice.

[0058] Step 104: If the detection result is not blown, the plug-in is called to pass the business request to other microservices.

[0059] like Figure 2 As shown, if the result of the fuse detection on the current microservice is not blown, the plug-in can continue the current business request and pass the business request to other microservices according to the instructions of the business request.

[0060] In this embodiment, the container orchestration engine Kubernetes has plug-ins and containers, and microservices are loaded in the container. The plug-in is called to intercept the business request sent by the current microservice to other microservices; the plug-in is called to perform a fuse test on the current microservice based on the business request to obtain the test result; if the test result is a fuse, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a fuse is sent to the current microservice; if the test result is not a fuse, the plug-in is called to pass the business request to other microservices. Multiple microservices can share plug-ins to implement the fuse function, and do not develop the code for the fuse function separately, which reduces a lot of redundant workload and can effectively reduce the amount of development. The plug-in is a non-intrusive design that allows microservices to have a fuse function, with low operational complexity and maintains the stability of microservices.

[0061] Embodiment 2

[0062] Figure 3 This is a flow chart of a microservice fusing method provided in Embodiment 2 of the present invention. This embodiment adds a processing method for business response based on the previous embodiment. Figure 3 As shown, the method includes:

[0063] Step 301: Call a plug-in to intercept business requests sent by the current microservice to other microservices.

[0064] Step 302: Call the plug-in to perform a fuse test on the current microservice according to the business request to obtain the test result.

[0065] Step 303: If the detection result is a blown circuit, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a blown circuit is sent to the current microservice.

[0066] Step 304: If the detection result is not blown, the plug-in is called to pass the business request to other microservices.

[0067] Step 305: Call the plug-in to intercept the business response sent by other microservices to the current microservice.

[0068] like Figure 2 As shown, during the operation of microservices in the container orchestration engine Kubernetes, if the current microservice calls other microservices, and other microservices have completed processing and feedback business responses to the current microservice, such as HTTP responses, gRPC responses, etc., the plug-in can intercept business responses sent by other microservices to the current microservice.

[0069] Step 306: If the current microservice has been configured with fuse detection, the plug-in is called to perform fuse statistics on the business request corresponding to the business response to obtain statistical results.

[0070] In this embodiment, the plug-in can query whether the current microservice has been configured with fuse detection to protect the current microservice. If the current microservice has been configured with fuse detection, the plug-in can perform fuse statistics for the business request corresponding to the business response to obtain statistical results.

[0071] In the specific implementation, the plug-in can parse the structure of the business response, query the path of the source of the business request corresponding to the business response, record it as the service path, and identify the current microservice with the service path.

[0072] The plugin checks whether the service path has been configured with circuit breaker rules for circuit breaker detection.

[0073] If the service path has been configured with circuit breaking rules suitable for circuit breaking detection, the plug-in can perform circuit breaking statistics on the business requests corresponding to the business responses according to the circuit breaking rules to obtain statistical results.

[0074] For example, count the delay between business requests and business responses, count the number of business requests sent and received by the current microservice within a period of time, count the error rate corresponding to business requests, and so on.

[0075] Step 307: Call the plug-in to mark the current microservice with a business tag suitable for fuse detection based on the statistical results, and pass the business response to the current microservice.

[0076] In this embodiment, the plug-in performs a circuit breaker test on the current microservice based on the statistical results, determines whether to perform a circuit breaker on the current microservice, and records the result of the circuit breaker test with a business tag. At the same time, the plug-in can continue to pass the business response and pass the business response to the current microservice according to the instructions of the business response.

[0077] In a specific implementation, if the statistical result meets the circuit breaking rule, the plug-in can mark the service path with a service tag suitable for circuit breaking detection as circuit breaking.

[0078] If the statistical results do not meet the circuit breaking rules, the plug-in can mark the service path with a business label suitable for circuit breaking detection as not blown.

[0079] Generally speaking, since the running status of a microservice changes in real time, a microservice is labeled with a dynamically changing business label. In some time periods, the business label labeled with the microservice may be blown, and in some time periods, the business label labeled with the microservice may be changed to unblown.

[0080] Step 308: If the current microservice is not configured with fuse detection, the plug-in is called to pass the business response to the current microservice.

[0081] If the current microservice is not configured with fuse detection, the plug-in can continue to pass the business response directly and pass the business response to the current microservice according to the instructions of the business response.

[0082] In this embodiment, if the business operation is divided into business request and business response, then the plug-in performs circuit breaking statistics in the process of microservice delivering business response, and performs circuit breaking according to the results of circuit breaking statistics in the process of microservice delivering business request. When the circuit breaking is not performed, the business request responds normally to the business and completes the corresponding business operation. When the circuit breaking is performed, new business requests are blocked and the corresponding business operation is blocked. When the circuit breaking function is implemented, the normal execution of business operations is guaranteed, and the time consumption of intercepting business requests and business responses is relatively short, which can effectively reduce the impact of circuit breaking on business operations. The power consumption of calling the plug-in for interception and circuit breaking in the container orchestration engine Kubernetes is relatively low, which can effectively reduce the impact on the container orchestration engine Kubernetes.

[0083] Embodiment 3

[0084] Figure 4 This is a flow chart of a microservice fusing method provided in Embodiment 3 of the present invention. This embodiment adds the operation of injecting a plug-in based on the previous embodiment. Figure 4As shown, the method includes:

[0085] Step 401: Inject a plug-in into the proxy service.

[0086] In this embodiment, the container orchestration engine Kubernetes has a proxy service Proxy, and a plug-in for implementing the fuse function is injected into the proxy service. The plug-in is injected into the proxy service without intrusion into the code or process of the microservice.

[0087] Generally, the proxy service is a network proxy, which is a component in the container orchestration engine Kubernetes and is responsible for providing network proxy services for the instance Pod in the container orchestration engine Kubernetes. In the container orchestration engine Kubernetes, each instance Pod has an IP (Internet Protocol) address and port number, but they may not be able to directly access the external network. Therefore, access to the external network can be achieved through a network proxy.

[0088] The following is an example of configuring a network proxy in the container orchestration engine Kubernetes:

[0089] 1. Install ProxySQL

[0090] Install ProxySQL (Proxy Structured Query Language) in the container orchestration engine Kubernetes as a network proxy server to meet the access requirements of the container orchestration engine Kubernetes.

[0091] 2. Configure ProxySQL

[0092] After installing ProxySQL, configure ProxySQL, including the proxy server port, certificate, authentication, etc.

[0093] 3. Configure in the container orchestration engine Kubernetes

[0094] After configuring ProxySQL, configure the container orchestration engine Kubernetes, including pointing the DNS (Domain Name System) resolution of the instance Pod in the container orchestration engine Kubernetes to ProxySQL and forwarding requests from the external network to ProxySQL.

[0095] 4. Test network proxy

[0096] Test whether the network proxy in the container orchestration engine Kubernetes is working properly. You can verify this by accessing the external network in the instance Pod.

[0097] In one embodiment of the present invention, step 401 may include the following steps:

[0098] Step 4011: Determine the proxy service type as Envoy proxy.

[0099] When using the Envoy proxy as a proxy service in the container orchestration engine Kubernetes, the Envoy proxy can be deployed as a Sidecar container and run in the same instance Pod with the backend service.

[0100] Among them, Envoy proxy is a high-performance edge and service proxy that can serve as a communication bus for microservices across the cloud, enabling microservices to communicate with each other in a fast, secure and efficient manner.

[0101] The Envoy proxy abstracts networking and security from the application layer to the infrastructure layer, which helps developers simplify plugin development by saving time spent on configuring networking and security logic.

[0102] The Envoy proxy provides advanced load balancing and traffic routing capabilities that help run large, complex distributed plug-ins and intercept business requests and responses. In addition, the modular architecture of the Envoy proxy helps customize and extend its functionality, and implements plug-ins with fuse functions in the Envoy proxy.

[0103] Step 4012: Determine a plug-in whose type is the instruction set WebAssembly.

[0104] In practical applications, the instruction set WebAssembly is a portable, high-performance compilation target that can run in a web browser.

[0105] Generally speaking, running WebAssembly workloads on the container orchestration engine Kubernetes relies on the following two components:

[0106] 1. Worker nodes booted using the WebAssembly runtime. This setup can be achieved by integrating high-level container runtimes such as containerd and CRI-O with low-level runtimes that support WebAssembly such as crun and youki.

[0107] 2. A RuntimeClass object that maps to a node with an instruction set WebAssembly runtime. The RuntimeClass object handles the problem of multiple container runtimes in the container orchestration engine Kubernetes, where some nodes may support the instruction set WebAssembly runtime and other nodes may support regular container runtimes. At this point, the RuntimeClass object can be used to schedule the instruction set WebAssembly workload specifically to a node with an instruction set WebAssembly runtime.

[0108] Step 4013: Configure the filter EnvoyFilter to inject a plug-in of the instruction set WebAssembly type into the proxy service of the Envoy proxy type.

[0109] In actual applications, the proxy service of type Envoy proxy has a filter EnvoyFilter. The filter EnvoyFilter is a resource type used to configure the Envoy proxy in the container orchestration engine Kubernetes. It supports user-defined modification of the Envoy proxy configuration and provides a flexible way to implement various custom proxy behaviors.

[0110] The filter EnvoyFilter is configured according to the running requirements of the instruction set WebAssembly as a plug-in for implementing the fuse function, so as to inject the plug-in of the instruction set WebAssembly into the proxy service of the type Envoy proxy.

[0111] Furthermore, according to the batch deployment requirements of the instruction set WebAssembly as a plug-in for implementing the fuse function, the matching rules in the filter EnvoyFilter can be configured to batch inject plug-ins of the instruction set WebAssembly into the proxy service of the type Envoy proxy, thereby improving the efficiency of injecting plug-ins.

[0112] In addition, the matching rules in the filter EnvoyFilter can be configured according to the running requirements of each deployed microservice in the container orchestration engine Kubernetes to batch limit the microservices whose plug-ins are effective for the instruction set WebAssembly, thereby improving the efficiency of managing microservice fuses.

[0113] In another embodiment of the present invention, step 401 may further include the following steps:

[0114] Step 4014: Modify the plug-in path of the plug-in of the instruction set WebAssembly for the filter EnvoyFilter to update the plug-in of the instruction set WebAssembly.

[0115] Step 4015, control the instance Pod where the microservice that meets the matching rules in the filter EnvoyFilter is located to update the plug-in type of the instruction set WebAssembly.

[0116] The container orchestration engine Kubernetes has an instance Pod, and the instance Pod has one or more containers.

[0117] When modifying a plug-in of the instruction set WebAssembly type, you can query the path of the plug-in of the instruction set WebAssembly type, record it as the plug-in path, modify the plug-in path of the plug-in of the instruction set WebAssembly type for the filter EnvoyFilter, and modify the plug-in path of the old version of the plug-in of the instruction set WebAssembly type to the plug-in path of the new version of the plug-in of the instruction set WebAssembly type.

[0118] In addition, the instance Pod where the microservice that meets the matching rules in the filter EnvoyFilter is located is controlled to update the plug-in of the instruction set WebAssembly type, so that the plug-in of the instruction set WebAssembly type takes effect, and the dynamic update of the plug-in of the instruction set WebAssembly type is realized.

[0119] Step 402: Add a fuse rule applicable to fuse detection in the configuration service.

[0120] Step 403: Call the plug-in to synchronize the fuse rules to the configuration service.

[0121] In this embodiment, the container orchestration engine Kubernetes has a configuration service, such as Figure 2 As shown, the circuit breaker rules applicable to circuit breaker detection can be configured in the service, and the circuit breaker rules can be dynamically updated.

[0122] The plug-in that implements the circuit breaker function (i.e., the plug-in whose type is the instruction set WebAssembly) can associate the configuration service through the environment variables of the instance Pod, so as to synchronize the circuit breaker rules to the configuration service regularly or irregularly.

[0123] Step 404: A plug-in whose calling type is the instruction set WebAssembly intercepts a business request sent by the current microservice to other microservices.

[0124] Step 405: The plug-in whose calling type is the instruction set WebAssembly performs a fuse detection on the current microservice according to the business request and the business label to obtain a detection result.

[0125] Step 406: If the detection result is a blown circuit, the plug-in whose calling type is the instruction set WebAssembly is prohibited from passing the business request to other microservices, and an error message indicating a blown circuit is sent to the current microservice.

[0126] Step 407: If the detection result is not blown, a plug-in whose instruction set type is WebAssembly is called to pass the business request to other microservices.

[0127] Step 408: The plug-in whose calling type is the instruction set WebAssembly intercepts the business response sent by other microservices to the current microservice.

[0128] Step 409: If the current microservice has been configured with fuse detection, the plug-in whose calling type is the instruction set WebAssembly performs fuse statistics on the business request corresponding to the business response according to the fuse rule to obtain the statistical results.

[0129] Step 410: The plug-in whose calling type is the instruction set WebAssembly marks the current microservice with a business label suitable for fuse detection according to the statistical results, and transmits the business response to the current microservice.

[0130] Step 411: If the current microservice is not configured with fuse detection, a plug-in whose instruction set type is WebAssembly is called to pass the business response to the current microservice.

[0131] In this embodiment, a proxy service injection plug-in is added to the container orchestration engine Kubernetes, and a plug-in that provides a circuit breaker function is implemented non-invasively using a mechanism supported by the container orchestration engine Kubernetes. The circuit breaker rules can be adaptively configured for the plug-in according to business needs, and the plug-in is decoupled from the circuit breaker rules, which can effectively improve the flexibility of implementing the circuit breaker function, reduce modifications to the plug-in, and reduce operation and maintenance costs.

[0132] Embodiment 4

[0133] Figure 5 A schematic diagram of the structure of a microservice fuse device provided in Embodiment 4 of the present invention. The device is applied to a container orchestration engine Kubernetes, wherein the container orchestration engine Kubernetes has a plug-in and a container, wherein the container is loaded with a microservice, such as Figure 5 As shown, the device comprises:

[0134] A service request interception module 501 is used to call the plug-in to intercept the service request sent by the current microservice to other microservices;

[0135] A fuse detection module 502 is used to call the plug-in to perform a fuse detection on the current microservice according to the business request to obtain a detection result;

[0136] The fuse processing module 503 is used to call the plug-in to prohibit the business request from being transmitted to other microservices if the detection result is a fuse, and send an error message indicating a fuse to the current microservice;

[0137] The unbroken processing module 504 is used to call the plug-in to transfer the business request to other microservices if the detection result is unbroken.

[0138] In one embodiment of the present invention, the fuse detection module 502 includes:

[0139] A first service path query module, used to query the service path of the source of the business request;

[0140] A service label search module, used to search for the service label marked on the service path;

[0141] A fuse generation module, configured to generate a detection result of a fuse for the current microservice if the service tag indicates a fuse;

[0142] The un-fuse generating module is used to generate a detection result of un-fuse for the current microservice if the service tag indicates un-fuse.

[0143] In one embodiment of the present invention, the device further comprises:

[0144] A business response interception module, used to call the plug-in to intercept business responses sent by other microservices to the current microservice;

[0145] A fuse statistics module is used to call the plug-in to perform fuse statistics on the business request corresponding to the business response to obtain statistical results if the current microservice has been configured with fuse detection;

[0146] A business label marking module is used to call the plug-in to mark the business label suitable for fuse detection on the current microservice according to the statistical result, and transmit the business response to the current microservice;

[0147] The business response delivery module is used to call the plug-in to deliver the business response to the current microservice if the current microservice is not configured with fuse detection.

[0148] In one embodiment of the present invention, the fuse statistics module includes:

[0149] A second service path query module, used to query the service path of the service request source corresponding to the service response;

[0150] A fuse rule processing module, configured to, if the service path has been configured with a fuse rule applicable to fuse detection, perform fuse statistics on the service request corresponding to the service response according to the fuse rule to obtain a statistical result;

[0151] The business label marking module includes:

[0152] A fuse marking module, configured to mark the service path with a service label applicable to fuse detection as fuse if the statistical result meets the fuse rule;

[0153] The un-fuse marking module is used to mark the service path with a service label applicable to the fuse detection as un-fuse if the statistical result does not meet the fuse rule.

[0154] In one embodiment of the present invention, the container orchestration engine Kubernetes has a proxy service and a configuration service, and the device further includes:

[0155] A plug-in injection module, used to inject plug-ins into the proxy service;

[0156] A fuse rule adding module, used to add a fuse rule applicable to fuse detection in the configuration service;

[0157] A circuit breaker rule synchronization module is used to call the plug-in to synchronize the circuit breaker rule to the configuration service.

[0158] In one embodiment of the present invention, the plug-in injection module includes:

[0159] A proxy service determination module, used to determine a proxy service of type Envoy proxy; the proxy service of type Envoy proxy has a filter EnvoyFilter;

[0160] A plug-in determination module is used to determine plug-ins whose type is the instruction set WebAssembly;

[0161] An injection configuration module is used to configure the filter EnvoyFilter to inject the plug-in of the instruction set WebAssembly type into the proxy service of the Envoy proxy type.

[0162] In one embodiment of the present invention, the injection configuration module includes:

[0163] A batch configuration module, used to configure the matching rules in the filter EnvoyFilter, so as to batch inject the plug-in of the instruction set WebAssembly into the proxy service of the type Envoy proxy;

[0164] The effectiveness configuration module is used to configure the matching rules in the filter EnvoyFilter to batch limit the microservices in which the plug-in with the instruction set WebAssembly is effective.

[0165] In one embodiment of the present invention, the container orchestration engine Kubernetes has an instance Pod, the instance Pod has one or more containers, and the plug-in injection module further includes:

[0166] A plug-in path modification module, used to modify the plug-in path of the plug-in of the instruction set WebAssembly for the filter EnvoyFilter, so as to update or replace the plug-in of the instruction set WebAssembly;

[0167] The instance update module is used to control the instance Pod where the microservice that meets the matching rule in the filter EnvoyFilter is located to update a plug-in whose instruction set WebAssembly is the type.

[0168] The microservice fusing device provided in the embodiment of the present invention can execute the microservice fusing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the microservice fusing method.

[0169] Embodiment 5

[0170] Figure 6 A schematic diagram of an electronic device 10 that can be used to implement an embodiment 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 components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0171] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0172] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0173] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the fuse method of microservices.

[0174] In some embodiments, the fusing method of the microservice may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the fusing method of the microservice described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the fusing method of the microservice in any other appropriate manner (e.g., by means of firmware).

[0175] Various implementations 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 chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0176] Computer programs for implementing 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, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0177] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0178] To provide interaction with a user, the systems and techniques described herein may 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0179] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0180] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0181] Embodiment 6

[0182] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the microservice fusing method provided by any embodiment of the present invention.

[0183] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0184] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0185] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A microservice fusing method, characterized in that: Applied to a container orchestration engine Kubernetes, the container orchestration engine Kubernetes has a plug-in and a container, and the container is loaded with a microservice, and the method includes: Calling the plug-in to intercept the business request sent by the current microservice to other microservices; Call the plug-in to perform a fuse test on the current microservice according to the business request to obtain a test result; If the detection result is a blown circuit, the plug-in is called to prohibit the business request from being passed to other microservices, and an error message indicating a blown circuit is sent to the current microservice; If the detection result is that the fuse is not blown, the plug-in is called to pass the business request to other microservices.

2. The method according to claim 1, characterized in that The calling of the plug-in performs a fuse detection on the current microservice according to the business request to obtain a detection result, including: Query the service path of the source of the business request; Finding a service tag marked on the service path; If the service tag indicates a circuit breaker, a detection result generated for the current microservice is a circuit breaker; If the service tag indicates that the fuse is not blown, the detection result generated for the current microservice is that the fuse is not blown.

3. The method according to claim 1, characterized in that Also includes: Calling the plug-in to intercept business responses sent by other microservices to the current microservice; If the current microservice has been configured with fuse detection, the plug-in is called to perform fuse statistics on the business request corresponding to the business response to obtain statistical results; Call the plug-in to mark the current microservice with a service tag suitable for fuse detection according to the statistical result, and pass the service response to the current microservice; If the current microservice is not configured with fuse detection, the plug-in is called to pass the business response to the current microservice.

4. The method according to claim 3, characterized in that If the current microservice has been configured with fuse detection, the plug-in is called to perform fuse statistics on the business request corresponding to the business response to obtain statistical results, including: Query the service path of the source of the business request corresponding to the business response; If the service path has been configured with a fuse rule applicable to fuse detection, then fuse statistics are performed on the service request corresponding to the service response according to the fuse rule to obtain a statistical result; The calling of the plug-in to label the current microservice with a service label suitable for fuse detection according to the statistical result includes: If the statistical result meets the fuse rule, marking the service path with a service tag applicable to fuse detection as fuse; If the statistical result does not comply with the fuse rule, the service path is marked with a service label applicable to fuse detection as not blown.

5. The method according to any one of claims 1 to 4, characterized in that The container orchestration engine Kubernetes has a proxy service and a configuration service, and the method further includes: Injecting a plug-in into the proxy service; Adding a circuit breaker rule applicable to circuit breaker detection in the configuration service; The plug-in is called to synchronize the circuit breaker rules to the configuration service.

6. The method according to claim 5, characterized in that The injecting of the plug-in into the proxy service comprises: Determine a proxy service of type Envoy proxy; the proxy service of type Envoy proxy has a filter EnvoyFilter; Determine the plugin type as the instruction set WebAssembly; The filter EnvoyFilter is configured to inject the plug-in of the instruction set WebAssembly type into the proxy service of the Envoy proxy type.

7. The method according to claim 6, characterized in that The configuring the filter EnvoyFilter to inject the plug-in of the instruction set WebAssembly type into the proxy service of the Envoy proxy type includes: Configure the matching rules in the filter EnvoyFilter to batch inject the plug-in of the instruction set WebAssembly into the proxy service of the type Envoy proxy; The matching rules in the filter EnvoyFilter are configured to batch limit the microservices for which the plug-in whose instruction set WebAssembly is effective.

8. The method according to claim 6, characterized in that The container orchestration engine Kubernetes has an instance Pod, and the instance Pod has one or more containers. The injecting of the plug-in into the proxy service also includes: Modify the plug-in path of the plug-in of the instruction set WebAssembly for the filter EnvoyFilter to update the plug-in of the instruction set WebAssembly; Control the instance Pod where the microservice that meets the matching rule in the filter EnvoyFilter is located to update a plug-in of the instruction set WebAssembly.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the fusing method of the microservice described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the fusing method of the microservice according to any one of claims 1 to 8 when executed.