A service mesh based distributed computing method and system
By employing a service mesh-based distributed computing approach, and utilizing a grid management center and agents to achieve automatic management and fault recovery of service instances, the scalability and availability issues of traditional systems are resolved, and the reliability and observability of the system are improved.
Patent Information
- Application Number
- CN202410877039.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2044-07-02
AI Technical Summary
Traditional distributed computing systems cannot meet rapidly changing business needs, and centralized service governance is not conducive to horizontal scaling and high availability.
The grid management center is used as the central controller. Service registration and discovery, request routing, traffic control, load balancing and monitoring logs are realized through the grid agent. It supports a variety of routing rules and load balancing algorithms, and provides automatic service instance management and a fast fault recovery mechanism.
It enables dynamic access and deletion of service instances, ensuring system robustness and reliability, providing detailed observability and fault recovery capabilities, and improving system availability and observability.
Smart Images

Figure CN118573680B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of containerization, in particular to a distributed computing method and system based on a service mesh. BACKGROUND
[0002] With the rapid development of cloud computing, containerization and other technologies, distributed computing systems have become one of the important development trends in today's computing field. A distributed computing system is a system in which a large computing task is divided into multiple small tasks and executed on multiple computing resources. The main benefits of this approach are twofold. First, it can distribute the computing task and thus speed up the computation. Second, it can distribute the system pressure and single point failure problem, thereby reducing the system maintenance and operation cost.
[0003] Although traditional distributed computing systems effectively solve the problem of distributed management of data and computing resources, they cannot meet the rapidly changing business requirements due to their complexity and scalability limitations. At the same time, with the rise of microservice architecture, the importance of service reuse and service governance has become increasingly prominent. Traditional service governance methods are mostly based on centralized solutions, i.e., service discovery and request routing are performed by a centralized scheduler. However, this approach is not conducive to horizontal scaling and high availability requirements. SUMMARY
[0004] The present application aims to provide a distributed computing method and system based on a service mesh to solve the problems raised in the background.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical solution: a distributed computing method based on a service mesh, the method comprising the following steps:
[0006] The grid management center is used as the central controller of the entire service mesh to manage and control the functions of the service network.
[0007] The grid proxy is used to handle service requests and responses, implement request routing and traffic control.
[0008] Preferably, the grid management center includes service registration and discovery, request routing, service monitoring and traffic control.
[0009] Configuration management is used to manage and configure various core functions in the service mesh. The relevant configurations of each function are defined by a yaml file. The configuration management module listens to changes in the relevant file and generates configuration information for the corresponding components according to the file content, which is finally sent to the grid proxy.
[0010] Service registration and discovery, for registering service instances to the service mesh, and exposing a query interface, through which the mesh agent establishes a long link with the management center when it starts, and pulls the latest service instance information; after the service instance starts, it registers its information to the management center, and when the service instance changes, it updates the service instance information in real time, and pushes the latest service instance information to the mesh agent through the long link established, supporting dynamic access and deletion of service instances.
[0011] Preferably, through the mesh agent, for taking over service requests and responses, implementing request routing and traffic control, specifically including:
[0012] Service discovery, the mesh agent obtains the latest service information from the management center and updates the local cache, and performs health detection on the service instance information in the cache, and removes unhealthy service instances from the cache to ensure that only healthy service instances that can be accessed normally are in the cache;
[0013] Request routing, the mesh agent routes requests to application instances according to routing rules issued by the management center to implement service request distribution;
[0014] Load balancing, the mesh agent distributes requests evenly to multiple service instances through load balancing algorithms, supporting multiple load balancing algorithms;
[0015] Traffic control, the management center issues traffic control-related rules, and the mesh agent controls the passing request traffic according to the rules;
[0016] Monitoring logs, through this module, the observability of the entire application system is realized, and the current system running status is clearly understood;
[0017] Access control, when a request arrives, it can be judged whether the request should be allowed or denied;
[0018] Exception handling, through the exception handling module, the characteristics of fast recovery from faults are provided, and the local fault cascade is prevented from affecting the whole, to improve the reliability and availability of application services.
[0019] Preferably, request routing includes the following routing functions:
[0020] a) Support routing requests to different service instances based on weight percentage, implement gray release or blue-green release;
[0021] b) Support routing requests to different service instances based on url, request header and cookie matching methods;
[0022] c) Support rewriting the url or request header of the request, and support redirecting the request to other service instances;
[0023] d) Support traffic mirroring function, copy the real-time traffic of the request through the mirror configuration, and send the copied part to the target service of the mirror, while supporting the configuration of the percentage of the mirror traffic, and deciding whether to mirror all the request traffic through the percentage configuration.
[0024] Preferably, load balancing specifically includes:
[0025] a) Round-robin algorithm, sending requests to each healthy service instance in turn in order;
[0026] b) Random algorithm, sending requests to a healthy service instance randomly;
[0027] c) Least connection algorithm, sending requests to the service instance with the least number of connections.
[0028] A service mesh-based distributed computing system, the system is composed of a mesh management center module and a mesh agent module;
[0029] Mesh management center module, using mesh management center as the central controller of the whole service mesh, for managing and controlling the functions of service network;
[0030] Mesh agent module, through the mesh agent, for taking over the request and response of the service, realizing the routing and traffic control of the request.
[0031] Preferably, the mesh management center module includes service registration and discovery, request routing, service monitoring and traffic control;
[0032] Configuration management, for managing and configuring various core functions in the service mesh, defining the related configurations of each function through a yaml file, listening to the changes of the related file by the configuration management module, and generating the configuration information of the corresponding components according to the file content, and finally issuing to the mesh agent;
[0033] Service registration and discovery, for registering service instances to the service mesh and exposing query interfaces, the mesh agent establishes a long link with the management center when starting, and pulls the latest service instance information; after the service instance starts, it registers its own information to the management center, and when the service instance changes, it updates the service instance information in real time, and pushes the latest service instance information to the mesh agent through the established long link, supporting dynamic access and deletion of service instances.
[0034] Preferably, the mesh agent module, through the mesh agent, for taking over the request and response of the service, realizing the routing and traffic control of the request specifically includes:
[0035] Service discovery, the grid agent obtains the latest service information from the management center and updates the local cache, probes the service instance information in the cache, and removes unhealthy service instances from the cache to ensure that only healthy service instances that can be normally accessed are in the cache;
[0036] Request routing, the grid agent routes requests to instances of the application according to routing rules issued by the management center to implement distribution of service requests;
[0037] Load balancing, the grid agent distributes requests to multiple service instances through a load balancing algorithm, supporting multiple load balancing algorithms;
[0038] Traffic control, the management center issues traffic control-related rules, and the grid agent controls the passing request traffic according to the rules;
[0039] Monitoring logs, the entire application system is observable through this module, and the current system operation is clearly understood;
[0040] Access control, when a request arrives, it can be determined whether the request should be allowed or denied;
[0041] Exception handling, the exception handling module provides the feature of fast recovery from faults, prevents local faults from cascading to the global, and improves the reliability and availability of application services.
[0042] Preferably, the grid agent module, request routing includes the following routing functions:
[0043] a) Support routing requests to different service instances based on weight percentage to achieve gray release or blue-green release;
[0044] b) Support routing requests to different service instances based on url, request header, and cookie matching methods;
[0045] c) Support rewriting the url or request header of the request, and support redirecting the request to other service instances;
[0046] d) Support traffic mirroring function, copy real-time traffic of requests through mirroring configuration, and send the copied part to the target service of the mirror simultaneously, and support configuring the percentage of mirror traffic to determine whether all request traffic needs to be mirrored.
[0047] Preferably, the grid agent module, load balancing specifically includes:
[0048] a) Round-robin algorithm, sequentially send requests to each healthy service instance;
[0049] b) Random algorithm, randomly send the request to a healthy service instance;
[0050] c) Minimum connection number algorithm, send the request to the service instance with the least number of connections.
[0051] Compared with the prior art, the present application has the beneficial effects that:
[0052] The service grid-based distributed computing method and system provided by the present application can automatically register and discover services, and the grid management center can monitor the creation and deletion of service instances in real time, and automatically distribute the latest service instance information to the grid agent. The entire process is transparent and non-perceptual to the service instance. Complete traffic control is achieved, supporting various routing rules and load balancing algorithms, supporting flow limiting and fusing strategies, and access control strategies to ensure the robustness and reliability of the entire distributed system. Observability is achieved, providing good observability, and collecting and displaying more detailed metrics, logs and tracking information to help diagnose problems and optimize system performance. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 A flowchart of the novel method of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution of the present application clear, complete and more clear and obvious, it should be understood that the specific embodiments described herein are part of the embodiments of the present application, not all embodiments, and are used to explain the embodiments of the present application, and do not limit the embodiments of the present application. All other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.
[0055] Embodiment one
[0056] The present application provides a technical solution: a service grid-based distributed computing method, the method comprising:
[0057] The grid management center is used as the central controller of the entire service grid, which is used to manage and control the functions of the service network;
[0058] The grid agent is used to take over the request and response of the service, and realize the routing and traffic control of the request;
[0059] Specifically, (1) the grid management center
[0060] The grid management center is the central controller of the entire service grid, which is used to manage and control various core functions of the service network, including service registration and discovery, request routing, service monitoring and traffic control. It has the following functional modules:
[0061] (1) Configuration management module, used for managing and configuring various core functions in the service mesh. The relevant configurations of each function can be defined through a yaml file. The configuration management module listens to changes in the relevant file and generates configuration information for the corresponding components according to the file content, which is finally issued to the mesh agent.
[0062] (2) Service registration and discovery module, used for registering service instances to the service mesh and exposing query interfaces. The mesh agent establishes a long link with the management center when it starts and pulls the latest service instance information through the interface. After the service instance starts, it will register its information to the management center. When the service instance changes, the module can update the service instance information in real time and push the latest service instance information to the mesh agent through the established long link. It supports dynamic access and deletion of service instances.
[0063] (II) Mesh agent
[0064] The mesh agent is another core component of the service mesh, located on each service host, used to handle service requests and responses, implement request routing and traffic control, and be transparent and unaware to the service host and application. The mesh agent has the following functional modules:
[0065] (1) Service discovery module, the mesh agent can obtain the latest service information from the management center and update the local cache. The service instance information in the cache is health probed, and unhealthy service instances are removed from the cache to ensure that only healthy service instances can be accessed in the cache.
[0066] (2) Request routing module, the mesh agent routes requests to application instances according to the routing rules issued by the management center to achieve service request distribution. The following routing functions are included:
[0067] a) Support for routing requests to different service instances based on weight percentage to achieve gray release or blue-green release;
[0068] b) Support for routing requests to different service instances based on url, request header, and cookie matching methods;
[0069] c) Support for rewriting the url or request header of the request and redirecting the request to other service instances.
[0070] d) Support for traffic mirroring function, which copies real-time traffic of requests through mirror configuration and synchronously sends the copied part to the target service of the mirror. It also supports configuring the percentage of mirror traffic to determine whether all request traffic needs to be mirrored.
[0071] (3) Load Balancing Module: The mesh proxy can distribute requests evenly across multiple service instances using load balancing algorithms. It supports various load balancing algorithms, including:
[0072] a) Round-robin algorithm: Requests are sent sequentially to each healthy service instance.
[0073] b) A random algorithm will randomly send requests to a healthy service instance.
[0074] c) The least connections algorithm sends requests to the service instance with the fewest connections.
[0075] (4) Traffic Control Module: The management center issues traffic control rules, and the grid proxy can control the request traffic according to the rules. By limiting the number of requests through rate limiting rules, the backend service is protected and the system crashes due to instantaneous high load on the service is avoided; by using circuit breaking rules, the call request fails and returns quickly without trying to connect to an overloaded or faulty application service, thereby avoiding possible service call avalanche and improving system stability.
[0076] (5) Monitoring Log Module: This module enables the observability of the entire application system, providing a clear understanding of the current system operation status. It mainly includes the following three aspects:
[0077] a) A mesh proxy can collect runtime metrics for services, facilitating anomaly handling and debugging. It can collect metrics such as CPU, memory, and network speeds for service instances and hosts, as well as metrics related to the total number of forwarded requests, the number of normal requests, and the number of erroneous requests. It also exposes a metrics interface for monitoring systems like Prometheus to collect monitoring information.
[0078] b) The grid agent can collect logs from various services, manage and statistically analyze them, and focus on monitoring specified error logs. It supports defining log alerts, and when logs that meet the alert rules are collected, alert information will be pushed to alerting systems such as AlertManager.
[0079] c) A grid proxy can achieve distributed tracing of the entire application system. When a request is forwarded through the grid proxy, the grid proxy will automatically generate a request ID and tracing headers and add this information to the request. The tracing context information is propagated along with the incoming and outgoing requests, and finally the entire request chain is connected, so that the chain of each request call in the entire application system can be seen completely.
[0080] (6) Access control module: when a request arrives, it can judge whether the request should be allowed or rejected. It supports defining according to request header, request method, request path, source ip, etc. dimensions, and indicates whether to allow or reject, when the request comes, it will be matched according to these dimensions, if the matching is successful, it will be allowed or rejected according to the definition. And it can be defined that when the matching is unsuccessful, the default is to allow or reject.
[0081] (7) Exception handling module: through the exception handling module, the characteristics of fault rapid recovery are provided, and the local fault cascade is prevented from affecting the whole, so as to improve the reliability and availability of application service. The exception handling provides the following functions:
[0082] a) Timeout, through timeout configuration, it is ensured that the request will not be trapped in indefinite waiting, if the request is not responded within the timeout time, the request will be interrupted and returned to failure. Different application services may require different timeout times, it is impossible to determine a unified timeout time, but the system supports easy dynamic adjustment of timeout time for different application services, without modifying the business code of the application service.
[0083] b) Retry, through retry configuration, when the request application service call fails, timeout exception or error response code occurs, the maximum number of automatic attempts to request the application service is specified. The retry function can ensure that the request application service will not fail due to temporary short-term problems, such as sudden temporary network overload or application service overload. Like timeout, the number of retries can also be personalized for different application services without modifying the business code of the application service, and the timeout time of each retry can be specified to further refine the behavior of retry.
[0084] c) Fault injection, after configuring the fault recovery capabilities such as timeout and retry, the fault injection function can be used to test the fault recovery capability of the entire application service system. By actively introducing errors into the system, it tests whether the application system can withstand the impact of errors and recover from error conditions. It supports two fault injection methods of delay and error response code, increases the request response time through delay, simulates an overloaded upstream service by increasing network delay; by configuring a custom error response code to simulate the failure of the calling application service.
[0085] Embodiment two
[0086] On the basis of embodiment one, a distributed computing system based on service grid is proposed, which is composed of grid management center module and grid agent module;
[0087] The grid management center module uses the grid management center as the central controller for the entire service grid, and is used to manage and control the functions of the service network, including service registration and discovery, request routing, service monitoring, and traffic control.
[0088] Configuration management is used to manage and configure the core functions in the service mesh. The configuration of each function is defined through YAML files. The configuration management module listens for changes in the relevant files and generates the configuration information of the corresponding components based on the file content, and finally distributes it to the mesh agent.
[0089] Service registration and discovery is used to register service instances to the service mesh and expose query interfaces. When the mesh agent starts, it establishes a long connection with the management center through the interface to pull the latest service instance information. After the service instance starts, it registers its own information with the management center. When the service instance changes, it updates the service instance information in real time and pushes the latest service instance information to the mesh agent through the established long connection. It supports dynamic access and deletion of service instances.
[0090] The grid proxy module, through grid proxying, is used to take over service requests and responses, implementing request routing and traffic control. Specifically, this includes:
[0091] Service discovery involves the grid agent retrieving the latest service information from the management center and updating the local cache. It performs health checks on the service instance information in the cache and removes unhealthy service instances from the cache, ensuring that the cache contains only healthy service instances that are accessible.
[0092] Request routing involves the grid proxy routing requests to application instances according to the routing rules issued by the management center, thereby distributing service requests. Request routing includes the following routing functions:
[0093] a) Supports routing requests to different service instances based on weight percentages, enabling canary releases or blue-green releases;
[0094] b) Supports routing requests to different service instances based on URL, request headers, and cookie matching methods;
[0095] c) Supports rewriting the request URL or request headers, and supports redirecting requests to other service instances;
[0096] d) Supports traffic mirroring, which allows real-time traffic of requests to be copied through mirroring configuration and the copied copy to be synchronously sent to the target service of the mirror. It also supports configuring the percentage of traffic to be mirrored, which determines whether all request traffic needs to be mirrored.
[0097] Load balancing, the grid agent distributes the requests to multiple service instances by load balancing algorithm, supports multiple load balancing algorithms; load balancing specifically includes:
[0098] a) Round robin algorithm, sends requests to each healthy service instance in turn in order;
[0099] b) Random algorithm, sends requests to a healthy service instance randomly;
[0100] c) Least connections algorithm, sends requests to the service instance with the least connections.
[0101] Traffic control, the management center issues rules related to traffic control, and the grid agent controls the passing request traffic according to the rules;
[0102] Monitoring log, through the module, the observability of the entire application system is realized, and the running condition of the current system is clearly understood;
[0103] Access control, when the request arrives, it can be judged whether the request should be allowed or refused;
[0104] Exception handling, the exception handling module is used to provide the characteristics of fast recovery of faults, and prevent the local fault cascade from affecting the whole, so as to improve the reliability and availability of application service.
[0105] Although the embodiments of the present application have been shown and described, it can be understood by those skilled in the art that various changes, modifications, replacements and variations can be made to the embodiments without departing from the principles and spirits of the present application, and the scope of the present application is defined by the appended claims and their equivalents.
Claims
1. A distributed computing method based on service mesh, characterized in that: The method includes: A grid management center is used as the central controller for the entire service grid to manage and control the functions of the service network; The grid proxy is used to take over service requests and responses, and to implement request routing and traffic control; the grid management center includes service registration and discovery, request routing, service monitoring and traffic control; Configuration management is used to manage and configure the core functions in the service mesh. The configuration of each function is defined through YAML files. The configuration management module listens for changes in the relevant files and generates the configuration information of the corresponding components based on the file content, and finally distributes it to the mesh agent. Service registration and discovery is used to register service instances to the service mesh and expose query interfaces. When the mesh agent starts, it establishes a long connection with the management center through the interface to pull the latest service instance information. After the service instance starts, it registers its own information with the management center. When the service instance changes, it updates the service instance information in real time and pushes the latest service instance information to the mesh agent through the established long connection. It supports the dynamic access and deletion of service instances. A mesh proxy is used to take over service requests and responses, and to implement request routing and traffic control, specifically including: Service discovery involves the grid agent retrieving the latest service information from the management center and updating the local cache. It performs health checks on the service instance information in the cache and removes unhealthy service instances from the cache, ensuring that the cache contains only healthy service instances that are accessible. Request routing: The grid proxy will route requests to application instances according to the routing rules issued by the management center in order to distribute service requests. Load balancing: The mesh proxy uses load balancing algorithms to distribute requests evenly across multiple service instances, supporting a variety of load balancing algorithms. Traffic control: The management center issues traffic control rules, and the grid agent controls the request traffic passing through according to the rules; Monitoring logs enable the observability of the entire application system, providing a clear understanding of the current system's operational status. Access control determines whether to allow or deny a request when it arrives. Exception handling provides the ability to quickly recover from failures and prevents local failures from cascading and affecting the whole system, thereby improving the reliability and availability of application services.
2. The distributed computing method based on service mesh according to claim 1, characterized in that: Request routing includes the following routing functions: a) Supports routing requests to different service instances based on weight percentages, enabling canary releases or blue-green releases; b) Supports routing requests to different service instances based on URL, request headers, and cookie matching methods; c) Supports rewriting the request URL or request headers, and supports redirecting requests to other service instances; d) Supports traffic mirroring, which allows real-time traffic of requests to be copied through mirroring configuration and the copied copy to be synchronously sent to the target service of the mirror. It also supports configuring the percentage of traffic to be mirrored, which determines whether all request traffic needs to be mirrored.
3. The distributed computing method based on service mesh according to claim 1, characterized in that: Load balancing specifically includes: a) A round-robin algorithm that sends requests sequentially to each healthy service instance; b) A random algorithm that sends requests to a healthy service instance at random; c) The least connections algorithm sends requests to the service instance with the fewest connections.
4. A service-mesh-based distributed computing system according to any one of claims 1-3, characterized in that: The system consists of a grid management center module and a grid agent module; The grid management center module uses the grid management center as the central controller for the entire service grid, and is used to manage and control the functions of the service network. The grid proxy module, through the grid proxy, is used to take over service requests and responses, and to implement request routing and traffic control.
5. A service mesh-based distributed computing system according to claim 4, characterized in that: The grid management center module includes service registration and discovery, request routing, service monitoring, and traffic control; Configuration management is used to manage and configure the core functions in the service mesh. The configuration of each function is defined through YAML files. The configuration management module listens for changes in the relevant files and generates the configuration information of the corresponding components based on the file content, and finally distributes it to the mesh agent. Service registration and discovery is used to register service instances to the service mesh and expose query interfaces. When the mesh agent starts, it establishes a long connection with the management center through the interface to pull the latest service instance information. After a service instance starts up, it registers its information with the management center. When a service instance changes, it updates the service instance information in real time and pushes the latest service instance information to the grid agent through an established long link, supporting dynamic access and deletion of service instances.
6. A service mesh-based distributed computing system according to claim 4, characterized in that: The grid proxy module, through the grid proxy, is used to take over service requests and responses, and to implement request routing and traffic control, specifically including: Service discovery involves the grid agent retrieving the latest service information from the management center and updating the local cache. It performs health checks on the service instance information in the cache and removes unhealthy service instances from the cache, ensuring that the cache contains only healthy service instances that are accessible. Request routing: The grid proxy will route requests to application instances according to the routing rules issued by the management center in order to distribute service requests. Load balancing: The mesh proxy uses load balancing algorithms to distribute requests evenly across multiple service instances, supporting a variety of load balancing algorithms. Traffic control: The management center issues traffic control rules, and the grid agent controls the request traffic passing through according to the rules; Monitoring logs enable the observability of the entire application system, providing a clear understanding of the current system's operational status. Access control determines whether to allow or deny a request when it arrives. Exception handling provides the ability to quickly recover from failures and prevents local failures from cascading and affecting the whole system, thereby improving the reliability and availability of application services.
7. A service mesh-based distributed computing system according to claim 4, characterized in that: The grid proxy module includes the following routing functions for request routing: a) Supports routing requests to different service instances based on weight percentages, enabling canary releases or blue-green releases; b) Supports routing requests to different service instances based on URL, request headers, and cookie matching methods; c) Supports rewriting the request URL or request headers, and supports redirecting requests to other service instances; d) Supports traffic mirroring, which allows real-time traffic of requests to be copied through mirroring configuration and the copied copy to be synchronously sent to the target service of the mirror. It also supports configuring the percentage of traffic to be mirrored, which determines whether all request traffic needs to be mirrored.
8. A service mesh-based distributed computing system according to claim 5, characterized in that: The grid proxy module, specifically for load balancing, includes: a) A round-robin algorithm that sends requests sequentially to each healthy service instance; b) A random algorithm that sends requests to a healthy service instance at random; c) The least connections algorithm sends requests to the service instance with the fewest connections.
Citation Information
Patent Citations
Proxy application for host system with service container and system
CN106331065A
Workload preheating method and device based on service grid
CN114244898A