Method for realizing gate dynamic load current-limiting fusing through single application

By adopting the overall microservice docking solution of nacos and sentinel components in single-unit applications, the flexible configuration of dynamic load and current limit fuse strategies is achieved, which solves the shortcomings of Nginx in load balancing and fuse functions, and improves the stability of the system and performance, support dynamic adjustment of strategies to cope with complex scenarios.

CN119316470APending Publication Date: 2025-01-14BEIYIN FINANCIAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411372006.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

When traditional Nginx implements load balancing, current limiting and fuse functions, there are problems such as complex configuration, insufficient real-time response capabilities, poor adaptability, high risk of single point failures, and slow update processes, which are difficult to meet the needs of complex traffic management and governance.

Method used

Adopt the overall microservice docking solution, nacos as the configuration center, combined with sentinel components to realize dynamic load service configuration and current limit fuse, use sentinel-dashboard for policy display and monitoring, and customize the ServiceInstanceListSupplier interface for custom registration of service entity classes and Management, regularly detect service availability, and flexibly configure current limiting circuit breaker strategies.

Benefits of technology

It realizes the addition of dynamic load and current limiting fuse strategies to the existing single-unit application architecture without changing it, which improves the stability and performance of the system, supports dynamic configuration, and enhances the flexibility and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316470A_ABST
    Figure CN119316470A_ABST
Patent Text Reader

Abstract

The invention discloses a method for realizing gateway dynamic load current-limiting fusing by a single application. The current-limiting fusing method comprises the following steps: configuring a load loading service; dynamically updating the service load; and a current-limiting fusing strategy is flexibly configured. Through a bilateral adaptation mode, on the premise that an existing single application architecture is not changed, a gate load and a current-limiting fusing strategy are added for the single application architecture. The characteristics of single application are fully utilized, and meanwhile, the advantages of gateway in the aspect of load current limiting in a micro-service scene are used for reference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software development, and in particular to a method for implementing a gateway dynamic load current limiting and fusing method using a single application. Background Art

[0002] In today's software development field, microservices architecture has become the preferred architecture model for many enterprises and applications. Microservices architecture is favored for its flexibility, scalability and fault tolerance. However, traditional monolithic applications are still widely used in many occasions, especially in projects with specific requirements in terms of resource constraints, development costs and system complexity.

[0003] Monolithic applications usually mean that the entire application runs as a single executable file, which is in contrast to the microservice architecture, which decomposes the application into a series of independent services. In a microservice environment, APIGateway plays a vital role as the unified entrance of the system. It is not only responsible for request routing, but also for key functions such as load balancing, current limiting and circuit breaking of services.

[0004] Nginx is often used to implement load balancing, current limiting and circuit breaking functions. The following are the shortcomings:

[0005] The complexity of Nginx configuration requires administrators to have relevant knowledge, and usually requires restarting or reloading the configuration to take effect, which limits its dynamic response to real-time traffic changes. Centralized traffic management increases the risk of single point failures and affects the overall availability of applications.

[0006] Nginx's current limiting strategy lacks adaptive capabilities and may not fully protect services when traffic patterns change. Its circuit breaker mechanism is simple and does not support complex recovery strategies such as probability-based attempts or automatic decay. In addition, Nginx is not as integrated with modern microservice monitoring tools as dedicated microservice components, and is usually managed by the operation and maintenance team rather than developers, resulting in a slow update process and not conducive to rapid iteration.

[0007] Although Nginx is a high-performance web server and reverse proxy, it is insufficient in meeting complex traffic management and governance requirements. Summary of the invention

[0008] In view of the above problems, the present invention is proposed to provide a method for implementing gateway dynamic load current limiting and fusing in a single application, which overcomes the above problems or at least partially solves the above problems.

[0009] According to one aspect of the present invention, a method for implementing gateway dynamic load current limiting and fusing by a single application is provided, and the current limiting and fusing method comprises:

[0010] Configure the load service;

[0011] Dynamically update service load;

[0012] Flexible configuration of current limiting and circuit breaking strategies.

[0013] Optionally, the configuration loading service specifically includes:

[0014] Configure the loading load service. The gateway service adopts the overall microservice docking solution. The configuration center uses nacos, and the current limiting and fusing uses the sentinel component. In order to facilitate the observation of the current limiting and fusing strategy display diagram, the sentinel-dashboard component is used. The gateway customizes the ServiceInstanceListSupplier interface, which is used for the gateway module to customize the registration service entity class related parameters and complete the instance loading.

[0015] Optionally, the dynamic update service load specifically includes:

[0016] Based on the registered service-related information, the availability of the target service is checked every 1 second, including whether the telnet service port or the health interface of the downstream single service can return normally. If an abnormality is found, the service instance registration information in the first step is updated, and the unreachable service mark is set. When the service request is forwarded, this service will no longer be forwarded;

[0017] At the same time, this service will periodically check whether unreachable services are restored to reachable state. If so, the service forwarding load will be restored to normal after the mark is modified to be reachable.

[0018] Optionally, the flexible configuration of the current limiting and fusing strategy specifically includes:

[0019] Gateway integrates nacos, sentinel and its sentinel-dashboard components. System administrators can flexibly configure gateway's current limiting and circuit breaking strategies based on the nacos configuration center interface, and relevant strategy information will be displayed in real time on the sentinel-dashboard control console interface.

[0020] Optionally, the configuration loading service specifically includes:

[0021] When building a gateway service, choose an overall microservice docking solution;

[0022] The core of the solution is the configuration center and the current limiting and fuse mechanism;

[0023] In order to achieve efficient management of the configuration center, nacos is used as the solution for the configuration center;

[0024] Nacos is a dynamic service discovery, configuration management and service management platform;

[0025] In terms of current limiting and fusing, the Sentinel component was selected to ensure high availability of the service. By using Sentinel, current limiting or fusing operations are automatically performed when encountering sudden traffic or service failures.

[0026] In order to realize the customized registration and management of service entity classes, the ServiceInstanceListSupplier interface is customized and implemented in the gateway module to load the relevant parameters of the service instance.

[0027] Optionally, the relevant parameters for loading the service instance include service name, address and port information.

[0028] Optionally, the dynamic update service load specifically includes:

[0029] The operation is performed every 1 second to check the availability of the target service;

[0030] It includes two aspects: one is to detect whether the service is reachable through the telnet service port; the other is to check whether the health interface of the downstream single service can return results normally;

[0031] If any exception is found during the live detection process, such as the service is unreachable or the health interface cannot be returned normally, the system will immediately update the service instance registration information in the first step;

[0032] Mark the problematic service as unreachable;

[0033] In the subsequent service request forwarding process, avoid forwarding requests to unreachable services to ensure the normal operation of the service;

[0034] Regularly check services marked as unreachable to determine whether they have been restored.

[0035] If a service is restored from an unreachable state to a reachable state, the system will modify its tag accordingly and mark it as reachable;

[0036] When the service request is forwarded, the service will be taken into consideration again to achieve load balancing and ensure the stable operation of the service.

[0037] The present invention provides a method for implementing dynamic load current limiting and fusing of a gateway in a single application, and the method includes: configuring a load loading service; dynamically updating the service load; and flexibly configuring a current limiting and fusing strategy. Through the bilateral adaptation mode, it is possible to increase the load and current limiting and fusing strategy of the gateway without changing the existing single application architecture. The characteristics of the single application are fully utilized, while the advantages of the gateway in load current limiting in the microservice scenario are learned.

[0038] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0040] Figure 1 A flowchart of a configuration loading service provided by an embodiment of the present invention;

[0041] Figure 2 A flow chart of dynamically updating service load provided by an embodiment of the present invention;

[0042] Figure 3 A flow chart of a flexible configuration of current limiting and fusing strategies provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0044] The terms "comprises" and "having" and any variations thereof in the description embodiments, claims and drawings of the present invention are intended to cover non-exclusive inclusions, for example, including a series of steps or units.

[0045] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0046] A method for implementing gateway dynamic load current limiting and fusing by a single application, comprising:

[0047] The first step is to configure the load service, the second step is to dynamically update the service load, and the third step is to flexibly configure the current limiting and circuit breaking strategy.

[0048] The first step is to configure the load loading service. The gateway service adopts the overall microservice docking solution, in which the configuration center uses nacos, and the current limiting and fusing uses the sentinel component. In order to facilitate the observation of the current limiting and fusing strategy display diagram, the sentinel-dashboard component is used.

[0049] The gateway customizes the ServiceInstanceListSupplier interface, which is used by the gateway module to customize the registration service entity class related parameters and complete the instance loading.

[0050] The second step is to dynamically update the service load, mainly based on the service-related information registered in the first step, and check the availability of the target service every 1 second, including whether the telnet service port or the healthy interface of the downstream single service can return normally. If an abnormality is found, the service instance registration information in the first step is updated, and the unreachable service is marked. When the service request is forwarded, this service will no longer be forwarded. At the same time, this service will also regularly check whether the unreachable services have been restored to reachable. If restored, the service forwarding load will be restored to normal after the mark is modified to be reachable.

[0051] The third step is to flexibly configure the current limiting and fuse strategies. Because the gateway integrates nacos, sentinel and its sentinel-dashboard components, the system administrator can flexibly configure the gateway's current limiting and fuse strategies based on the nacos configuration center interface, and the relevant strategy information will be displayed in real time on the sentinel-dashboard control console interface.

[0052] like Figure 1 As shown, configure the load service:

[0053] When building the gateway service, choose the overall microservice docking solution. The core of the solution is the configuration center and the current limiting fuse mechanism. In order to achieve efficient management of the configuration center, nacos is used as the solution for the configuration center. nacos is a dynamic service discovery, configuration management, and service management platform that helps to easily manage and maintain the configuration information of microservices.

[0054] In terms of current limiting and fusing, the Sentinel component was selected. It provides functions such as current limiting, fusing, and degradation to ensure high availability of services. By using Sentinel, when encountering sudden traffic or service failures, current limiting or fusing operations are automatically performed to protect the service from being affected.

[0055] In order to better observe and analyze the effects of current limiting and circuit breaking policies, the sentinel-dashboard component is introduced. Sentinel-dashboard is a web-based real-time monitoring platform that displays various real-time data in sentinel, such as the execution of current limiting, circuit breaking and other policies. Through sentinel-dashboard, you can intuitively understand the service operation status and discover and handle problems in a timely manner.

[0056] In order to realize the customized registration and management of service entity classes, the ServiceInstanceListSupplier interface is customized and implemented in the gateway module. This interface is mainly used to load the relevant parameters of the service instance, including the service name, address, and port information. By implementing this interface, the registration process of the service instance can be flexibly controlled.

[0057] like Figure 2 As shown, dynamically update the service load:

[0058] Depends on the service-related information registered in the first step. It will perform an operation every 1 second to check the availability of the target service. This includes two aspects: one is to detect whether the service is reachable through the telnet service port; the other is to check whether the health interface of the downstream single service can return results normally.

[0059] If any anomalies are found during the live detection process, such as unreachable services or the health interface cannot be returned normally, the system will immediately update the service instance registration information in the first step, marking these problematic services as unreachable. In the subsequent service request forwarding process, avoid forwarding requests to these unreachable services, thereby ensuring the normal operation of the service.

[0060] Regularly check services marked as unreachable to determine whether they have been restored to reachable status. If a service is restored from an unreachable state to a reachable state, the system will modify its mark accordingly and mark it as reachable. When service requests are forwarded, this service will be taken into consideration again, thus achieving load balancing and ensuring stable operation of the service.

[0061] like Figure 3 As shown, flexibly configure the current limiting and fusing strategy:

[0062] Since gateway has integrated nacos, sentinel and sentinel-dashboard components, system administrators can flexibly configure gateway's current limiting and circuit breaking policies through the nacos configuration center interface. Relevant policy information will be displayed in real time on the sentinel-dashboard control console interface.

[0063] Through the Nacos and Sentinel integrated in the gateway and its Sentinel-Dashboard components, system administrators can flexibly configure the gateway's current limiting and circuit breaking strategies, and view relevant policy information in real time through the Sentinel-Dashboard's control console interface to ensure high availability and stability of the system.

[0064] Beneficial effects: Bilateral adaptation mode: Through the bilateral adaptation mode, it is possible to add gateway load and current limiting circuit breaking strategies without changing the existing monolithic application architecture. This mode makes full use of the characteristics of monolithic applications and draws on the advantages of gateway in load limiting in microservice scenarios.

[0065] It provides gateway load and current limiting functions for monolithic applications without accessing the microservice architecture. It adds gateway load and current limiting strategies without changing the existing monolithic application architecture, thereby achieving higher system stability and performance.

[0066] Supports dynamic configuration, allowing users to adjust load and current limiting strategies at any time according to actual needs, further improving the flexibility and scalability of the system. It provides a non-intrusive way for single applications to have the load and current limiting fusing strategies of the gateway, so as to better cope with various complex application scenarios.

[0067] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The current limiting fusing method comprises: Configure the load service; Dynamically update service load; Flexible configuration of current limiting and circuit breaking strategies.

2. According to claim 1, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The configuration loading service specifically includes: Configure the loading load service. The gateway service adopts the overall microservice docking solution. The configuration center uses nacos, and the current limiting and fusing uses the sentinel component. In order to facilitate the observation of the current limiting and fusing strategy display diagram, the sentinel-dashboard component is used. The gateway customizes the ServiceInstanceListSupplier interface, which is used for the gateway module to customize the registration service entity class related parameters and complete the instance loading.

3. According to claim 1, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The dynamic update service load specifically includes: Based on the registered service-related information, the availability of the target service is checked every 1 second, including whether the telnet service port or the health interface of the downstream single service can return normally. If an abnormality is found, the service instance registration information in the first step is updated, and the unreachable service mark is set. When the service request is forwarded, this service will no longer be forwarded; At the same time, this service will periodically check whether unreachable services are restored to reachable state. If so, the service forwarding load will be restored to normal after the mark is modified to be reachable.

4. According to claim 1, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The flexible configuration of current limiting and fusing strategies specifically includes: Gateway integrates nacos, sentinel and its sentinel-dashboard components. System administrators can flexibly configure gateway's current limiting and circuit breaking strategies based on the nacos configuration center interface, and relevant strategy information will be displayed in real time on the sentinel-dashboard control console interface.

5. According to claim 1, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The configuration loading service specifically includes: When building a gateway service, choose an overall microservice docking solution; The core of the solution is the configuration center and the current limiting and fuse mechanism; In order to achieve efficient management of the configuration center, nacos is used as the solution for the configuration center; Nacos is a dynamic service discovery, configuration management and service management platform; In terms of current limiting and fusing, the Sentinel component was selected to ensure high availability of the service. By using Sentinel, current limiting or fusing operations are automatically performed when encountering sudden traffic or service failures. In order to realize the customized registration and management of service entity classes, the ServiceInstanceListSupplier interface is customized and implemented in the gateway module to load the relevant parameters of the service instance.

6. According to claim 5, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The relevant parameters for loading the service instance include service name, address and port information.

7. According to claim 1, a method for implementing gateway dynamic load current limiting and fusing by a single application, characterized in that: The dynamic update service load specifically includes: The operation is performed every 1 second to check the availability of the target service; It includes two aspects: one is to detect whether the service is reachable through the telnet service port; the other is to check whether the health interface of the downstream single service can return results normally; If any exception is found during the live detection process, such as the service is unreachable or the health interface cannot be returned normally, the system will immediately update the service instance registration information in the first step; Mark the problematic service as unreachable; In the subsequent service request forwarding process, avoid forwarding requests to unreachable services to ensure the normal operation of the service; Regularly check services marked as unreachable to determine whether they have been restored. If a service is restored from an unreachable state to a reachable state, the system will modify its tag accordingly and mark it as reachable; When the service request is forwarded, the service will be taken into consideration again to achieve load balancing and ensure the stable operation of the service.