Cluster scheduling components and methods applicable to isolation devices

By using cluster scheduling components and a sliding window mechanism, the problem of service requests continuously falling to the faulty device after the isolation device fails was solved, realizing dynamic scheduling and management of the isolation device and improving the system's reliability and fault tolerance.

CN115827366BActive Publication Date: 2026-06-02STATE GRID ELECTRIC POWER RES INST

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
STATE GRID ELECTRIC POWER RES INST
Filing Date
2022-09-26
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In a SaaS architecture, if the isolation device fails, business requests will still fall on the faulty device, causing the failure rate to continue to increase and making it impossible to achieve 100% reliability.

Method used

A cluster scheduling component is adopted, including a Nacos configuration center, a monitoring service module, and a liveness detection service module. Dynamic scheduling and management of isolation devices are achieved through interceptors and data source connection pools. The circuit breaker and recovery window mechanism based on the sliding window concept is used to dynamically adjust the data source connection status.

Benefits of technology

It improved the service reliability of the business system, enabled dynamic scheduling and management of isolation devices, reduced dependence on load balancing equipment, and enhanced the system's fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115827366B_ABST
    Figure CN115827366B_ABST
Patent Text Reader

Abstract

This invention discloses a cluster scheduling component and method suitable for isolation devices, including a configuration center, a third-party database, a monitoring service module, and a liveness detection service module. The second-party database includes a data source connection pool and an interceptor. Each data source connection in the data source connection pool connects the business system to the database via its corresponding isolation device. The interceptor is connected to the data source connection pool and the isolation device, sending data obtained from the database to the business system, or sending a failure heartbeat to the monitoring service module when the isolation device is determined to be in a faulty state. The liveness detection service module connects to the test database through data source connections marked as offline and their corresponding isolation devices. When it detects that the isolation device has recovered, it sends a success heartbeat to the monitoring service. The monitoring service module modifies the configuration file in the configuration center to mark the status of each data source connection. This invention enables dynamic scheduling and management of isolation devices, improving service reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of isolation equipment technology, specifically relating to a cluster scheduling component and method suitable for isolation devices. Background Technology

[0002] In certain specific industries, databases are often deployed in isolated networks. When a business system needs to connect to the database, it first needs to connect to a load balancer, and then penetrate the isolation device to connect to the internal network. Because load balancers have session persistence mechanisms, when an isolation device goes down, it cannot be immediately removed from the network. Business requests will continue to fall on the downed isolation device, leading to a continuous increase in failures. With the development of SaaS architecture, users have increasingly higher requirements for the quality of service. Since isolation device failures or network anomalies cannot be completely avoided, existing services inevitably cannot achieve 100% reliability. Summary of the Invention

[0003] To address the aforementioned issues, this invention proposes a cluster scheduling component and method suitable for isolation devices, which enables easy access for business systems, dynamic scheduling and management of isolation devices, and effectively improves service reliability.

[0004] To achieve the above-mentioned technical objectives and effects, the present invention is implemented through the following technical solution:

[0005] In a first aspect, the present invention provides a cluster scheduling component suitable for isolation devices, including a Nacos configuration center, and a second-party library, a monitoring service module, and a liveness detection service module connected to the Nacos configuration center;

[0006] The second-party database includes a data source connection pool and an interceptor. The data source connection pool includes several data source connectors, each of which is used to connect the business system to the database via a corresponding isolation device. One end of the interceptor is connected to the data source connection pool, and the other end is used to connect to the isolation device. It sends the data obtained from the database to the business system, or sends a failure heartbeat to the monitoring service module when it is determined that the isolation device is in a faulty state.

[0007] The liveness detection service module connects to the test database through the data source connection pieces marked as offline in the data source connection pool and their corresponding isolation devices. When it detects that the isolation device has returned to normal, it sends a success heartbeat to the monitoring service.

[0008] The monitoring service module modifies the configuration file in the Nacos configuration center based on the received failure or success heartbeats to mark the status of each data source connection.

[0009] Optionally, both the monitoring service module and the liveness detection service module are registered in the Nacos configuration center and can be scheduled by the Nacos configuration center.

[0010] Optionally, the interceptor is a Mybatis plugin, employing the chain of responsibility pattern, with multiple plugins organized by dynamic proxies; when the isolation device throws a specified exception, it is considered that the isolation device has failed, and a failure heartbeat is sent to the monitoring service module through the API interface provided by the monitoring service module.

[0011] Optionally, the monitoring service module includes a circuit breaker window and a recovery window;

[0012] For the circuit breaker window, when the number of failed heartbeats per unit time reaches the critical value, the monitoring service module triggers configuration modification, which in turn modifies the status of each data source connection in the Nacos configuration center configuration item. Then, the Nacos configuration center notifies the business system to perform data source switching operation to help the business system achieve fault transfer of the isolation device.

[0013] For the recovery window, when the number of successful heartbeats within a unit of time reaches a critical value, the monitoring service module triggers a configuration modification, which in turn modifies the status of each data source connection in the Nacos configuration center configuration item. Then, the Nacos configuration center notifies the business system to perform a data source recovery operation, helping the business system to restore the connection of the isolation device.

[0014] Optionally, the threshold values ​​of the circuit breaker window and the recovery window are designed based on the sliding window concept.

[0015] Optionally, the monitoring service module implements the sliding window concept based on the reactive programming framework RxJava.

[0016] Optionally, the monitoring service module provides two API interfaces, which are used to receive failure heartbeats and success heartbeats, respectively.

[0017] Optionally, the core number of connections, maximum number of connections, and waiting time in the data source connection pool are all configured by the Nacos configuration center.

[0018] Optionally, when the number of business requests issued by the business system exceeds the number of data source connections in the data source connection pool, each business request is placed in a request queue to wait.

[0019] In a second aspect, the present invention provides a scheduling method for a cluster scheduling component suitable for an isolation device based on any one of the first aspects, comprising:

[0020] Utilize a third-party library to receive business requests sent by the business system;

[0021] Select a suitable data source connection from the data source connection pool in the second-party library, and use the data source connection to connect the business system to the database via the corresponding isolation device;

[0022] When the interceptor determines that the isolation device is in normal condition, it will send the data obtained from the database to the business system;

[0023] When the interceptor determines that the isolation device is in a faulty state, it sends a failure heartbeat to the monitoring service module;

[0024] The liveness detection service module periodically connects to the test database through data source connections marked as offline in the data source connection pool and their corresponding isolation devices. When the isolation device is detected to have returned to normal, a success heartbeat is sent to the monitoring service.

[0025] The monitoring service module modifies the configuration file in the configuration center based on the received failure or success heartbeats to mark the status of each data source connection.

[0026] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0027] This invention proposes a cluster scheduling component and method suitable for isolation devices, which can enable easy access of business systems, dynamic scheduling and management of isolation devices, and effectively improve service reliability. Attached Figure Description

[0028] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein:

[0029] Figure 1 This is a schematic diagram illustrating the workflow of a cluster scheduling component for an isolation device according to an embodiment of the present invention.

[0030] Figure 2 The following are the sliding window operation steps of the monitoring service module according to one embodiment of the present invention. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the scope of protection of the invention.

[0032] The application principle of the present invention will be described in detail below with reference to the accompanying drawings.

[0033] Example 1

[0034] This invention provides a cluster scheduling component suitable for isolation devices, such as... Figure 1As shown, it includes a Nacos configuration center, as well as a third-party library, a monitoring service module, and a liveness detection service module connected to the Nacos configuration center.

[0035] The second-party database includes a data source connection pool and an interceptor. The data source connection pool includes several data source connectors, each of which is used to connect the business system to the database via a corresponding isolation device. One end of the interceptor is connected to the data source connection pool, and the other end is used to connect to the isolation device. It sends the data obtained from the database to the business system, or sends a failure heartbeat to the monitoring service module when it is determined that the isolation device is in a faulty state.

[0036] The liveness detection service module connects to the test database through the data source connection pieces marked as offline in the data source connection pool and their corresponding isolation devices. When it detects that the isolation device has returned to normal, it sends a success heartbeat to the monitoring service.

[0037] The monitoring service module modifies the configuration file in the Nacos configuration center based on the received failure or success heartbeats to mark the status of each data source connection.

[0038] Based on the cluster scheduling component in this embodiment of the invention, business systems can easily access the system, and the isolation device can be dynamically scheduled and managed, effectively improving service reliability. In practical implementation, business systems using the isolation device import the third-party library via Maven dependencies or other methods. The business system connects to the scheduling isolation device cluster hardware through this library. The third-party library is provided as a JAR file for other business systems in the Kubernetes cluster to reference, ensuring network connectivity between containers within the cluster. The monitoring service module and the liveness detection service module are both deployed in the Kubernetes cluster, effectively resolving the business system's dependency on load balancing devices and masking the differences between different versions of the isolation device.

[0039] Database connections are a critical, limited, and expensive resource, especially prominent in business systems with frequent user interactions. Each database connection object corresponds to a physical database connection. If a physical connection is opened for every operation and closed after use, the performance of the business system will be degraded. To address this, this invention proposes a database connection pool. Sufficient database connection objects are created when the business system starts, and these objects are grouped into a connection pool. The business system dynamically requests, uses, and releases database connection objects from the pool. When the number of requests sent by the business system exceeds the number of connections in the pool, requests should be queued in the request queue. Furthermore, the business system can dynamically increase or decrease the number of connections in the pool based on the usage rate of the connection objects. Connection pool technology securely and efficiently reuses database resources, avoiding the resource overhead of frequent database connection establishment and destruction, improving the service efficiency of the business system, and supporting more customer services. By flexibly configuring the core number of connections, maximum number of connections, waiting time, and other settings of the connection pool, the tolerance and adaptability of third-party libraries can be adjusted.

[0040] In this invention, the third-party library uses a round-robin strategy to achieve load balancing to each data source node, replacing hardware load balancing with software load balancing, thus saving expensive equipment costs. Furthermore, it eliminates the need to focus on data source configuration information, saving development manpower costs.

[0041] In one specific embodiment of this invention, the interceptor is a Mybatis plugin. The Mybatis plugin employs the chain-of-responsibility pattern, allowing multiple interceptors to be dynamically woven in. These interceptors can modify the default behavior during Mybatis execution. Mybatis allows the use of interceptors to intercept method calls, including: intercepting executor methods, intercepting parameter processing, intercepting result set processing, intercepting SQL syntax, and processing session construction. In this way, the business system can intercept at a certain point in the execution of the mapping statement to perform its own business processing. The third-party library of this invention is configured with methods for intercepting executors. If the isolation device throws a specified exception during execution, it is considered that the isolation device has failed, and then a failure heartbeat is sent to the monitoring service module through the API interface provided by the monitoring service module.

[0042] In one specific embodiment of this invention, the Nacos configuration center serves as a unified service registration and configuration center. During business system initialization, it reads the data source configuration from the Nacos configuration center, initializes the data source connection pool, and monitors for modifications to the configuration files in the Nacos configuration center during normal operation. If any configuration is modified, the data source connection pool is dynamically refreshed in real time. The Nacos configuration center also acts as a registration center, responsible for supporting service registration and scheduling among the business system, monitoring service module, and activity detection service module.

[0043] In one specific embodiment of the present invention, the monitoring service module develops a threshold system based on the sliding window concept (e.g., Figure 2 As shown), it internally maintains a circuit breaker window (10s) and a recovery window (1min), mainly providing two API interfaces, used to receive failure heartbeats from the business system and success heartbeats from the liveness detection service module, respectively. The monitoring service module has a circuit breaker window and a recovery window;

[0044] For the circuit breaker window, when the number of requests per unit time reaches a preset fixed value and the failure rate (number of failed heartbeats divided by the total number of requests) reaches a threshold, the isolation device is considered to have returned to normal. The monitoring service module then triggers configuration modification, thereby modifying the status of each data source connection in the Nacos configuration center configuration item. After that, the Nacos configuration center notifies the business system to perform data source switching operations to help the business system achieve fault transfer of the isolation device.

[0045] For the recovery window, when the number of requests per unit time reaches a preset fixed value and the success rate (successful heartbeats divided by the total number of requests) reaches a threshold, the isolation device is considered to have returned to normal. The monitoring service module triggers configuration modification, which in turn modifies the status of each data source connection in the Nacos configuration center configuration item. Then, the Nacos configuration center notifies the business system to perform data source recovery operations, helping the business system to restore the connection of the isolation device.

[0046] The threshold values ​​for both the circuit breaker window and the recovery window are designed based on the sliding window concept. The basic principle of the sliding window mechanism is that at any given time, the sender maintains a continuous sequence of allowed-to-send frames, called the sending window; simultaneously, the receiver also maintains a continuous sequence of allowed-to-receive frames, called the receiving window. The upper and lower bounds of the sequence numbers for the sending and receiving windows do not necessarily have to be the same, and their sizes can even differ. The sequence numbers within the sender's window represent frames that have been sent but not yet acknowledged, or frames that can be sent.

[0047] The sliding window mechanism was originally a technique used to improve throughput. In this embodiment of the invention, it is used to control the number of times the receiving window receives data in any unit of time as time passes, and to trigger the data source (i.e., the isolation device) to go offline when a certain threshold is reached.

[0048] The monitoring service module implements the sliding window concept based on the reactive programming framework RxJava. Reactive programming is a programming pattern based on the concept of asynchronous data streams. The core of reactive programming is event response, and a stream is a sequence of events ordered by time. Events in RxJava are based on the observer pattern; the event stream flows from top to bottom, from the subscriber to the observer. If a fixed threshold is exceeded, the data source connection is considered invalid, and an immediate failover operation is performed to ensure the business system returns to normal operation.

[0049] Example 2

[0050] Based on the same inventive concept as Embodiment 1, this embodiment of the invention provides a scheduling method for a cluster scheduling component suitable for an isolation device based on any one of Embodiment 1, comprising the following steps:

[0051] (1) Use a third-party library to receive business requests sent by the business system;

[0052] (2) Select a suitable data source connection from the data source connection pool in the second-party database, and use the data source connection to connect the business system to the database through the corresponding isolation device;

[0053] (3) When the interceptor determines that the isolation device is in normal condition, it will send the data obtained from the database to the business system;

[0054] (4) When the interceptor determines that the isolation device is in a faulty state, it sends a failure heartbeat to the monitoring service module;

[0055] (5) Use the liveness detection service module to periodically connect to the test database through the data source connection pieces marked as offline in the data source connection pool and their corresponding isolation devices. When the isolation device is detected to be back to normal, a success heartbeat is sent to the monitoring service.

[0056] (6) Using the monitoring service module, based on the received failure heartbeat or success heartbeat, modify the configuration file in the configuration center to mark the status of each data source connection.

[0057] The basic principles, main features, and advantages of this invention have been described above. Those skilled in the art should understand that this invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to this invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A cluster scheduling component suitable for isolation devices, characterized in that: It includes the Nacos configuration center, as well as a third-party library, a monitoring service module, and a liveness detection service module connected to the Nacos configuration center; The second-party database includes a data source connection pool and an interceptor. The data source connection pool includes several data source connectors, each of which is used to connect the business system to the database via a corresponding isolation device. One end of the interceptor is connected to the data source connection pool, and the other end is used to connect to the isolation device. It sends the data obtained from the database to the business system, or sends a failure heartbeat to the monitoring service module when it is determined that the isolation device is in a fault state. The liveness detection service module connects to the test database through the data source connection pieces marked as offline in the data source connection pool and their corresponding isolation devices. When it detects that the isolation device has returned to normal, it sends a success heartbeat to the monitoring service. The monitoring service module modifies the configuration file in the Nacos configuration center based on the received failure or success heartbeats to mark the status of each data source connection. The monitoring service module includes a circuit breaker window and a recovery window; For the circuit breaker window, when the number of failed heartbeats per unit time reaches the critical value, the monitoring service module triggers configuration modification, which in turn modifies the status of each data source connection in the Nacos configuration center configuration item. Then, the Nacos configuration center notifies the business system to perform data source switching operation to help the business system achieve fault transfer of the isolation device. For the recovery window, when the number of successful heartbeats within a unit of time reaches a critical value, the monitoring service module triggers a configuration modification, which in turn modifies the status of each data source connection in the Nacos configuration center configuration item. Then, the Nacos configuration center notifies the business system to perform a data source recovery operation, helping the business system to restore the connection of the isolation device.

2. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: Both the monitoring service module and the activity detection service module are registered in the Nacos configuration center and are scheduled by the Nacos configuration center.

3. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: The interceptor is a Mybatis plugin that uses the chain of responsibility pattern and dynamic proxy to organize multiple plugins. When the isolation device throws a specified exception, it is considered that the isolation device has failed, and a failure heartbeat is sent to the monitoring service module through the API interface provided by the monitoring service module.

4. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: The threshold values ​​for both the circuit breaker window and the recovery window are designed based on the sliding window concept.

5. A cluster scheduling component suitable for isolation devices according to claim 4, characterized in that: The monitoring service module implements the sliding window concept based on the reactive programming framework RxJava.

6. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: The monitoring service module provides two API interfaces, which are used to receive failure heartbeats and success heartbeats, respectively.

7. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: The core number of connections, maximum number of connections, and waiting time in the data source connection pool are all configured by the Nacos configuration center.

8. A cluster scheduling component suitable for isolation devices according to claim 1, characterized in that: When the number of business requests issued by the business system exceeds the number of data source connections in the data source connection pool, each business request will be placed in the request queue to wait.

9. A scheduling method based on a cluster scheduling component suitable for an isolation device according to any one of claims 1-8, characterized in that, include: Utilize a third-party library to receive business requests sent by the business system; Select a suitable data source connection from the data source connection pool in the second-party library, and use the data source connection to connect the business system to the database via the corresponding isolation device; When the interceptor determines that the isolation device is in normal condition, it will send the data obtained from the database to the business system; When the interceptor determines that the isolation device is in a faulty state, it sends a failure heartbeat to the monitoring service module; The liveness detection service module periodically connects to the test database through data source connections marked as offline in the data source connection pool and their corresponding isolation devices. When the isolation device is detected to have returned to normal, a success heartbeat is sent to the monitoring service. The monitoring service module modifies the configuration file in the configuration center based on the received failure or success heartbeats to mark the status of each data source connection.