Micro-service-based high-availability gateway and fault-tolerant system, method, equipment and medium

By introducing a collaborative mechanism of service registration and discovery, load balancing, circuit breakers and monitoring and alarm modules in the microservice architecture, the problems of poor fault tolerance and low availability in traditional single architectures are solved, and the system is high availability and stability is achieved. Adapt to the complex needs of modern applications.

CN119135512APending Publication Date: 2024-12-13INSPUR FINANCIAL INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410959411.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When traditional monolithic architectures face the complexity, high availability, high scalability and fast iteration requirements of modern applications, they have problems such as poor fault tolerance and low availability, making it difficult to cope with communication complexity, network failure and service crashes between microservices. system instability.

Method used

A highly available gateway and fault-tolerant system based on microservices is designed, including service registration and discovery modules, load balancing modules, circuit breaker modules and monitoring and alarm modules. Through the collaboration of these modules, they automatically detect problems, respond to failures and try to recover services. , ensure that only healthy service instances are selected and improve system availability and stability.

Benefits of technology

Improve system availability and stability, reduce service interruption time due to microservice failure, improve performance and load balancing capabilities, adapt to high concurrency and large traffic requests, reduce system maintenance costs and management complexity, and enhance Availability and fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119135512A_ABST
    Figure CN119135512A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service-based high-availability gateway and fault-tolerant system, method, equipment and medium, and the system comprises a service registration and discovery module, a load balancing module, a circuit breaker module, a fault automatic recovery module and a monitoring alarm module, the service registration and discovery module is used for micro-service registration, and the load balancing module is used for load balancing. The load balancing module is used for distributing the requests to different service instances; the circuit breaker module is used for temporarily stopping a request for micro-service, and the fault automatic recovery module is used for automatically recovering a fault; and the monitoring and alarming module is used for monitoring the operation condition and the system performance index of the micro-service in real time. The system has the advantages that the modules cooperate with one another, so that the availability and stability of the system are improved, and the service interruption time is shortened; the performance and the load balancing capacity of the system are improved, and the method adapts to high-concurrency and large-flow requests; the maintenance cost and the management complexity of the system are reduced, and the development and operation efficiency is improved, so that the availability and the fault tolerance are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a microservice-based high-availability gateway and fault-tolerant system, method, device and medium. Background Art

[0002] With the popularity of Internet applications, microservice architecture has become increasingly popular in application development. Microservice architecture splits an application into a series of independent services, each of which can be deployed and expanded independently, thereby improving the flexibility and scalability of the system. However, microservice architecture also faces some challenges, such as the complexity of communication between services, network failures, and system instability that may be caused by service crashes. Traditional monolithic architecture has some obvious shortcomings and deficiencies in dealing with modern application needs:

[0003] 1. Single point of failure: The entire application is deployed and run as a single unit. Once a failure occurs, the entire application will be affected, resulting in system unavailability.

[0004] 2. Poor scalability: Monolithic applications often cannot flexibly expand a functional module or service on demand, which limits the system's horizontal scalability.

[0005] 3. Technology stack binding: Monolithic applications usually use the same technology stack and development framework, which limits the flexibility of technology selection and makes it difficult to choose the most suitable technology and tools according to business needs.

[0006] 4. Deployment Complexity: The deployment of a monolithic application is usually a complex process that requires consideration of the dependencies and configurations of multiple components, making the deployment process cumbersome and time-consuming.

[0007] 5. Difficult to maintain and evolve: The code of a monolithic application is usually a huge code base. As time goes by and business needs change, the code becomes difficult to understand, maintain, and evolve, reducing development efficiency and code quality.

[0008] 6. Poor flexibility: Monolithic applications have a high degree of coupling, and the dependencies between various functional modules are complex, making it difficult to replace modules and customize functions.

[0009] 7. Difficult to achieve continuous delivery and deployment: Monolithic applications usually require overall deployment, making it difficult to achieve rapid continuous delivery and deployment, limiting the flexibility and responsiveness of the system.

[0010] In summary, traditional monolithic architecture has problems of poor fault tolerance and low availability when facing the complexity, high availability, high scalability and rapid iteration requirements of modern applications. Therefore, people are gradually turning to more flexible and scalable architectural models, such as microservice architecture, to cope with ever-changing business needs and technical challenges.

[0011] In view of this, it is necessary to provide a high-availability gateway and fault-tolerant system, method, device and medium based on microservices. Summary of the invention

[0012] The present invention provides a microservice-based high-availability network fault-tolerant system, method, device and medium, which effectively solves the problems of low availability and poor fault tolerance of microservices under the existing monolithic architecture.

[0013] The technical solution adopted by the present invention is:

[0014] A high-availability gateway and fault-tolerant system based on microservices, including a service registration and discovery module, a load balancing module, a circuit breaker module, a fault automatic recovery module and a monitoring and alarm module, wherein the service registration and discovery module is used for microservice registration, the load balancing module is used to distribute requests to different service instances; the circuit breaker module is used to temporarily block requests for microservices, the fault automatic recovery module is used to automatically recover from faults; the monitoring and alarm module is used to monitor the operation of microservices and system performance indicators in real time.

[0015] Furthermore, when the monitoring alarm module detects an abnormality in a service instance, it notifies the operation and maintenance team through an alarm.

[0016] Furthermore, when the monitoring alarm module detects an abnormality in a service instance, it feeds back the health status of the service instance to the service registration and discovery module, thereby affecting the service registration and discovery module process and ensuring that only healthy service instances are selected by the load balancing module.

[0017] Furthermore, the load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances according to the load balancing algorithm. When the load balancing module finds that the response time of a service instance exceeds the preset time or fails to respond when sending a request, it can trigger the circuit breaker module to temporarily stop the request to the service instance.

[0018] Furthermore, when the circuit breaker module detects that the automatic fault recovery module fails in its attempt to recover the service, the circuit breaker module notifies the automatic fault recovery module, and the automatic fault recovery module attempts to restart the service instance.

[0019] Furthermore, when the automatic fault recovery module attempts to restore the service, it will rely on the data provided by the monitoring alarm module to determine the health status of the service.

[0020] Furthermore, after accepting the registration of the service instance, the service registration and discovery module periodically receives the heartbeat of the service instance to obtain the survival status of the service instance.

[0021] A high-availability gateway and fault-tolerant method based on microservices, which uses a high-availability gateway and fault-tolerant system based on microservices. The service instance registers with the service registration and discovery module at startup and sends heartbeats regularly to indicate its survival status; the load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances; when the load balancing module distributes requests, if it finds that the response time of a service instance exceeds a predetermined time or fails to respond, the circuit breaker module can be triggered to run; the circuit breaker module temporarily blocks the request of the service instance, transfers the traffic to the backup service or returns to the default service. The circuit breaker module can respond to service failures quickly, and the automatic fault recovery module is responsible for trying to restore services after service failures. The automatic fault recovery module can receive information about service failures detected by the circuit breaker module, and the automatic fault recovery module will try to restart the service instance or take other recovery measures. When trying to restore services, the automatic fault recovery module will rely on the data provided by the monitoring and alarm module to determine the health status of the service. The monitoring and alarm module can detect the health status of service instances and issue an alarm when service instances are abnormal, ensuring that only healthy service instances are selected by the load balancing module.

[0022] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the microservice-based high-availability gateway and fault-tolerant method are implemented.

[0023] A computer device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein:

[0024] The memory is used to store computer programs;

[0025] The processor is used to execute the steps of the microservice-based high-availability gateway and fault-tolerant method by running the program stored in the memory.

[0026] The beneficial effects of the invention are as follows: the mutual cooperation between various modules forms a closed-loop system, which can automatically detect problems, respond to failures and try to restore services, thereby improving the availability and stability of the system and reducing the service interruption time caused by microservice failures; improving the system's performance and load balancing capabilities to adapt to high concurrency and large-volume requests; reducing the system's maintenance costs and management complexity, improving development and operation efficiency, and thus enhancing availability and fault tolerance. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1A flowchart of a microservice-based high-availability gateway and fault-tolerant system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0029] like Figure 1 As shown, the present application provides a first embodiment, which is a high-availability gateway and fault-tolerant system based on microservices, including a service registration and discovery module, a load balancing module, a circuit breaker module, a fault automatic recovery module and a monitoring and alarm module, wherein the service registration and discovery module is used for microservice registration, the load balancing module is used to distribute requests to different service instances; the circuit breaker module is used to temporarily block requests for microservices, the fault automatic recovery module is used to automatically recover faults; the monitoring and alarm module is used to monitor the operation status of microservices and system performance indicators in real time.

[0030] In actual use, between the service registration and discovery module and the load balancing module, the service registration and discovery module is the premise of the load balancing module. The service instance registers with the service registration and discovery module center when it starts, and sends heartbeats regularly to indicate its survival status. The load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the request to different service instances. Between the load balancing module and the circuit breaker module, when the load balancer module distributes requests, if it finds that a service instance takes too long to respond or fails, it can trigger the circuit breaker module. The circuit breaker module temporarily blocks requests to the service instance, transfers traffic to the backup service or returns the default response, thereby avoiding system overload and fault propagation. Between the fault automatic recovery module and the monitoring and alarm module, when the fault automatic recovery module tries to restore the service, it will rely on the data provided by the monitoring and alarm module to judge the health status of the service. At the same time, the monitoring and alarm module can monitor the operation of the service instance in real time. When an abnormality is detected, an alarm will be triggered to notify the operation and maintenance team to intervene, which may include manually triggering the fault automatic recovery mechanism. Between the monitoring alarm module and the service registration and discovery module, the monitoring alarm module can detect the health status of the service instance and notify the operation and maintenance team through an alarm when an abnormality occurs in the service instance. Alternatively, the monitoring alarm module can also feed back the health status of the service instance to the service registration and discovery module, thereby affecting the service registration and discovery process and ensuring that only healthy service instances are selected by the load balancer.

[0031] In the above design, the mutual cooperation between various modules forms a closed-loop system, which can automatically detect problems, respond to failures and try to restore services, thereby improving the availability and stability of the system and reducing the service interruption time caused by microservice failures; improving the system's performance and load balancing capabilities to adapt to high concurrency and large-volume requests; reducing the system's maintenance costs and management complexity, improving development and operation efficiency, and thus enhancing availability and fault tolerance.

[0032] Specifically: when the monitoring alarm module detects an abnormality in a service instance, it notifies the operation and maintenance team through an alarm.

[0033] In the above design, the monitoring alarm module notifies the operation and maintenance team after discovering an abnormality in the service instance, and the operation and maintenance team can eliminate the abnormality in time.

[0034] Specifically: when the monitoring alarm module detects an abnormality in a service instance, it feeds back the health status of the service instance to the service registration and discovery module, thereby affecting the service registration and discovery module process and ensuring that only healthy service instances are selected by the load balancing module.

[0035] In the above design, the abnormal conditions of service instances are automatically accepted by the service registration and discovery module, so that only healthy service instances are selected by the load balancing module, improving the stability and availability of the system.

[0036] Specifically: the load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances according to the load balancing algorithm. When sending a request, if the load balancing module finds that the response time of a service instance exceeds the preset time or fails to respond, it can trigger the circuit breaker module to temporarily stop the request to the service instance.

[0037] In the above design, the parameters of the load balancing module can be polling, random, least connection, etc. Implementing load balancing through the load balancing module can effectively improve the performance and scalability of the system.

[0038] Specifically: when the circuit breaker module detects that the automatic fault recovery module fails in its attempt to recover the service, the circuit breaker module notifies the automatic fault recovery module, and the automatic fault recovery module attempts to restart the service instance.

[0039] In the above design, when a microservice fails or times out, the circuit breaker module will quickly switch to the backup service to ensure the stability and availability of the system.

[0040] Specifically: when the automatic fault recovery module attempts to restore the service, it will rely on the data provided by the monitoring alarm module to determine the health status of the service.

[0041] In the above design, the health status of the service is determined by monitoring the data provided by the alarm module, so that the fault automatic recovery module can perform subsequent analysis after attempting to automatically restore the service.

[0042] Specifically: after accepting the registration of a service instance, the service registration and discovery module periodically receives the heartbeat of the service instance to obtain the survival status of the service instance.

[0043] In the above design, it can be ensured that the service instances registered by the service registration and discovery module are in a live state.

[0044] The present application also discloses a second embodiment, which is a high-availability gateway and fault-tolerant method based on microservices, and adopts a high-availability gateway and fault-tolerant system based on microservices: the service instance registers with the service registration and discovery module at startup, and periodically sends heartbeats to indicate its survival status; the load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances accordingly; when allocating requests, if the load balancing module finds that the response time of a service instance exceeds a predetermined time or fails to respond, it can trigger the circuit breaker module to run; the circuit breaker module will temporarily block the request of the service instance and transfer the traffic Transfer to the backup service or return the default response to avoid system overload and fault spread; the circuit breaker module can respond to service failures quickly, and the automatic fault recovery module is responsible for trying to restore the service after the service fails; the automatic fault recovery module can receive the information that the circuit breaker module detects service failure, and the automatic fault recovery module will try to restart the service instance or take other recovery measures; when trying to restore the service, the automatic fault recovery module will rely on the data provided by the monitoring and alarm module to determine the health status of the service; the monitoring and alarm module can detect the health status of the service instance and issue an alarm when the service instance is abnormal, ensuring that only healthy service instances are selected by the load balancing module.

[0045] The present application also discloses a third embodiment, which is a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the microservice-based high-availability gateway and fault-tolerant method are implemented.

[0046] In addition, the computer-readable storage medium of this embodiment may adopt any combination of one or more computer-readable storage media, wherein the computer-readable storage medium includes electrical, optical, electromagnetic, infrared or semiconductor systems, devices or components, or any combination thereof.

[0047] The present application also discloses a fourth embodiment, which is a computer device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein:

[0048] The memory is used to store computer programs;

[0049] The processor is used to execute the steps of the microservice-based high-availability gateway and fault-tolerant method by running the program stored in the memory.

[0050] As an embodiment of the present invention, the communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0051] As an implementation mode of the present invention, the communication interface is used for communication between the above-mentioned terminal and other devices.

[0052] As an embodiment of the present invention, the memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0053] As an embodiment of the present invention, the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0054] To further explain in detail, it should be understood that the above is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A high-availability gateway and fault-tolerant system based on microservices, characterized by: It includes a service registration and discovery module, a load balancing module, a circuit breaker module, a fault automatic recovery module and a monitoring and alarm module, wherein the service registration and discovery module is used for microservice registration, the load balancing module is used to distribute requests to different service instances; the circuit breaker module is used to temporarily block requests for microservices, the fault automatic recovery module is used to automatically recover from faults; the monitoring and alarm module is used to monitor the operation of microservices and system performance indicators in real time.

2. According to the microservice-based high-availability gateway and fault-tolerant system of claim 1, it is characterized by: When the monitoring alarm module detects an abnormality in a service instance, it notifies the operation and maintenance team through an alarm.

3. According to the microservice-based high-availability gateway and fault-tolerant system of claim 1, it is characterized by: When the monitoring alarm module detects an abnormality in a service instance, it feeds back the health status of the service instance to the service registration and discovery module, thereby affecting the service registration and discovery module process and ensuring that only healthy service instances are selected by the load balancing module.

4. According to the microservice-based high-availability gateway and fault-tolerant system of claim 1, it is characterized by: The load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances according to the load balancing algorithm. When sending a request, if the load balancing module finds that the response time of a service instance exceeds the preset time or fails to respond, it can trigger the circuit breaker module to temporarily stop the request to the service instance.

5. The high-availability gateway and fault-tolerant system based on microservices according to claim 1, characterized in that: When the circuit breaker module detects that the automatic fault recovery module fails in its attempt to recover the service, the circuit breaker module notifies the automatic fault recovery module, and the automatic fault recovery module attempts to restart the service instance.

6. The high-availability gateway and fault-tolerant system based on microservices according to claim 1, characterized in that: When the automatic fault recovery module attempts to restore the service, it will rely on the data provided by the monitoring alarm module to determine the health status of the service.

7. The high-availability gateway and fault-tolerant system based on microservices according to claim 1, characterized in that: After accepting the service instance registration, the service registration and discovery module periodically receives the heartbeat of the service instance to obtain the survival status of the service instance.

8. A high-availability gateway and fault-tolerant method based on microservices, using the high-availability gateway and fault-tolerant system based on microservices according to any one of claims 1 to 7, characterized in that: The service instance registers with the service registration and discovery module when it starts, and sends heartbeats periodically to indicate its survival status; The load balancing module obtains a list of all available service instances by querying the service registration and discovery module, and then distributes the requests to different service instances. When distributing requests, if the load balancing module finds that the response time of a service instance exceeds the preset time or the response fails, the circuit breaker module can be triggered to run. The circuit breaker module will temporarily block the request of the service instance, transfer the traffic to the backup service or return the default response, thereby avoiding system overload and fault propagation. The circuit breaker module can respond quickly to service failures, and the automatic fault recovery module is responsible for trying to restore services after service failures; the automatic fault recovery module can receive information about service failures detected by the circuit breaker module, and the automatic fault recovery module will try to restart the service instance or take other recovery measures; when trying to restore services, the automatic fault recovery module will rely on the data provided by the monitoring and alarm module to determine the health status of the service; the monitoring and alarm module can detect the health status of service instances and issue an alarm when service instances are abnormal, ensuring that only healthy service instances are selected by the load balancing module.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the microservice-based high-availability gateway and fault-tolerant method described in claim 8 are implemented.

10. A computer device, characterized in that: The method comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: The memory is used to store computer programs; The processor is used to execute the steps of the microservice-based high-availability gateway and fault-tolerant method according to claim 8 by running the program stored in the memory.