Service providing system and method, and resource allocation method, control method, device, storage medium and program product
By dynamically configuring resource quotas and thread group management for service nodes, the problems of resource waste and rate limiting in service clusters are solved, and the rational allocation and efficient utilization of resources are achieved.
Patent Information
- Application Number
- PCT/CN2026/084835
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-13
- Filing Date
- 2026-03-20
- Publication Date
- 2026-11-19
AI Technical Summary
In existing technologies, the allocation of resource quotas in service clusters is unreasonable, leading to resource waste and rate limiting, especially when service nodes are expanded or malfunctioning, resources cannot be effectively utilized.
By detecting the running status of service nodes, the target resource quota is dynamically configured. Combined with thread group partitioning and master election operations, the rational allocation and use of resources can be achieved.
It improves the rationality and efficiency of resource quota allocation, avoids resource waste, and ensures the normal operation of the service cluster under expansion or abnormal conditions.
Smart Images

Figure CN2026084835_19112026_PF_FP_ABST
Abstract
Description
Service provision systems and methods, resource allocation methods, control methods, equipment, storage media and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202510618922.7, filed with the China Patent Office on May 13, 2025, entitled “Service Provision System and Method, Resource Allocation Method, Control Method, Apparatus, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of data processing, and more particularly to a service provision system and method, a resource allocation method, a control method, an apparatus, a storage medium, and a program product. Background Technology
[0003] Current service provisioning systems typically include multiple service clusters that perform different operations. A service cluster can process requests sent from other service clusters or computing nodes (collectively referred to as callers) to forward the requests to another service cluster or process them according to the instructions involved in the request.
[0004] In processing requests sent by the caller, the use of relevant resources is usually involved, such as database resources. Request forwarding is achieved by accessing metadata within the database. Since different service clusters may use resources simultaneously, a total resource quota is pre-allocated to each service cluster. This quota can be expressed as QPS (Queries Per Second) or OPS (Operations Per Second). In a distributed architecture cluster within a service provider system, each service node receives and processes requests. Current technology processes requests based on a fixed resource quota obtained by dividing the total resource quota by the total number of nodes in the service cluster. However, this approach fails to ensure efficient resource utilization. Summary of the Invention
[0005] This disclosure provides a service provisioning system and method, a resource allocation method, a control method, an apparatus, a storage medium, and a program product to improve the rationality of resource utilization.
[0006] In a first aspect, this disclosure provides a service provisioning system, including a first service cluster, the first service cluster including a plurality of first service nodes, the plurality of first service nodes including a first target service node;
[0007] The first target service node is used to detect the node operating status of the plurality of first service nodes; determine the number of at least one first service node whose node operating status is normal based on the node operating status; determine the target resource quota corresponding to each of the at least one first service node based on the number of nodes and the total resource quota; and notify the at least one first service node of the target resource quota; wherein, the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota.
[0008] Secondly, this disclosure provides a resource allocation method applied to a first target service node among multiple first service nodes in a first service cluster included in a service providing system, the method comprising:
[0009] Detect the node running status of the plurality of first service nodes;
[0010] Based on the node operating status, determine the number of at least one first service node whose operating status is normal.
[0011] Based on the number of nodes and the total resource quota, the target resource quota corresponding to each of the at least one first service node is determined;
[0012] The target resource quota is notified to the at least one first service node; wherein the target resource quota is used to instruct the at least one first service node to process the request according to the target resource quota.
[0013] Thirdly, this disclosure provides a service provision method, applied in a second service cluster included in a service provision system, wherein a second target service node, which serves as a second master node among multiple second service nodes, is included in the method.
[0014] Receive requests sent by the second caller;
[0015] Determine the request type of the request;
[0016] Determine the multiple threads pre-created by the second target service node and the multiple thread groups obtained by dividing the multiple threads;
[0017] From the plurality of thread groups, determine the target thread group corresponding to the request type;
[0018] Select a target thread from the target thread group;
[0019] The request is assigned to the target thread so that the target thread can process the request.
[0020] Fourthly, this disclosure provides a control method applied to a control node in a service providing system, the service providing system including a first service cluster, the first service cluster including a plurality of first service nodes, the plurality of first service nodes including a plurality of candidate nodes, the method including:
[0021] Receive the leader election requests sent by the multiple candidate nodes respectively;
[0022] The leader election operation is performed according to the leader election request to select one candidate node from the plurality of candidate nodes as the first target service node;
[0023] The first target service node is used to detect the node operating status of the plurality of first service nodes; determine the number of at least one first service node whose node operating status is normal based on the node operating status; determine the target resource quota corresponding to each of the at least one first service node based on the number of nodes and the total resource quota; and notify the at least one first service node of the target resource quota; wherein the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota.
[0024] Fifthly, this disclosure provides a computing device, including a storage component and a processing component; the storage component stores one or more computer program instructions, which are invoked and executed by the processing component, and the processing component executes the one or more computer program instructions to implement the resource allocation method as described in the second aspect, the service provision method as described in the third aspect, or the control method as described in the fourth aspect.
[0025] In a sixth aspect, this disclosure provides a computer-readable storage medium storing a computer program that is executed by a computer to implement the resource allocation method as described in the second aspect, the service provision method as described in the third aspect, or the control method as described in the fourth aspect.
[0026] In a seventh aspect, this disclosure provides a computer program product storing a computer program, which, when executed by a computer, implements the resource allocation method as described in the second aspect, the service provision method as described in the third aspect, or the control method as described in the fourth aspect.
[0027] The solution in this embodiment utilizes a first target service node to detect the node operating status of multiple first service nodes and determine the number of first service nodes in normal state. Based on the number of first service nodes in normal state and the total resource quota, it dynamically configures the target resource quota corresponding to each first service node in normal state. This solves the problems of fixed resource quotas for single service nodes, which can lead to missed evaluations and increased resource consumption when the first service cluster expands its first service nodes, affecting the accuracy of resource quota allocation. Furthermore, it addresses the issue of normal first service nodes still processing requests according to fixed resource quotas when an abnormal first service node exists, resulting in wasted resources and even when resources are available, request processing is impossible, leading to rate limiting. Therefore, by adopting dynamic configuration, the rationality of resource quota configuration is improved, maximizing resource utilization. In addition, by setting a first target service node, automatic detection of node operating status and automatic counting of node numbers are achieved, eliminating the need for manual detection and improving detection and counting efficiency, thereby improving the efficiency of dynamic resource quota configuration.
[0028] These or other aspects of this disclosure will become more apparent in the following description of embodiments. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 shows a schematic diagram of the structure of an embodiment of a service provisioning system provided in this disclosure;
[0031] Figure 2 shows a schematic diagram of another embodiment of a service provisioning system provided in this disclosure;
[0032] Figure 3 shows a schematic diagram of the structure of yet another embodiment of a service provisioning system provided in this disclosure;
[0033] Figure 4 shows a flowchart of an embodiment of a resource allocation method provided in this disclosure;
[0034] Figure 5 shows a flowchart of an embodiment of a control method provided in this disclosure;
[0035] Figure 6 shows a flowchart of an embodiment of a service provisioning method provided in this disclosure;
[0036] Figure 7 shows a schematic diagram of a structure of an embodiment of a resource allocation device provided in this disclosure;
[0037] Figure 8 shows a schematic diagram of a control device according to an embodiment of the present disclosure;
[0038] Figure 9 shows a schematic diagram of a service provisioning apparatus according to an embodiment of the present disclosure;
[0039] Figure 10 shows a schematic diagram of the structure of one embodiment of a computing device provided in this disclosure. Detailed Implementation
[0040] To enable those skilled in the art to better understand the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0041] In some of the processes described in this disclosure, the claims, and the accompanying drawings, multiple operations are included in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or may be executed in parallel. The operation numbers, such as 401, 402, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the terms "first," "second," etc., used herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0042] The technical solutions of this disclosure can be applied to service provision systems with multiple service nodes, such as distributed storage systems and distributed computing systems.
[0043] As described in the background section, the actual service provision process usually involves the use of relevant resources.
[0044] In a practical application, resource quotas are configured in a single-machine flow control manner. That is, the resource quota of a service node, such as the upper limit of QPS or OPS resource quota, is fixed. Requests can be processed when the used resources have not reached the quota; otherwise, rate limiting will be implemented.
[0045] However, the inventors discovered that this single-machine flow control method, when expanding the number of service nodes, if the resource quota of the service nodes is kept fixed, it is easy to miss the increase in actual resource consumption, thus affecting the accuracy of the allocation of the total resource quota of the service cluster.
[0046] Furthermore, this single-machine flow control method, when a service node is deleted, or the machine hosting the service node crashes or the data center fails, causing the service node to become abnormal and unable to process requests, will result in a waste of available resources in the service cluster if the resource quotas of the remaining normal service nodes are kept fixed. In other words, even if there are available resources in the service cluster, if a service node reaches its original quota, it will no longer be able to process requests and will enter a rate-limited state, failing to achieve reasonable and maximized use of resources.
[0047] Furthermore, in another practical application, for another type of service cluster in a service provision system, such as a service cluster using a master-slave mode, only the service node acting as the master node processes requests. Therefore, the service node pre-creates multiple threads to handle received requests. For each received request, a relatively idle thread is selected from among the multiple threads for processing. However, the inventors discovered that in practical applications, there may be requests of multiple request types. Since different request types share multiple threads for processing, it is easy for a sudden surge in requests of a certain type, such as batch creation or deletion of cloud disks, to cause multiple threads to be fully occupied. This will affect the thread allocation and processing of other types of requests, especially requests with high response time requirements, such as data access requests, resulting in a poor user experience.
[0048] Therefore, in order to make reasonable use of relevant resources, the technical solution of this disclosure is proposed. The service providing system includes a first service cluster, which includes multiple first service nodes, and the multiple first service nodes include a first target service node. The first target service node is used to detect the node running status of the multiple first service nodes; determine the number of at least one first service node whose node running status is normal based on the node running status; determine the target resource quota corresponding to each of the at least one first service node based on the number of nodes and the total resource quota; notify the at least one first service node of the target resource quota; and the first service node is used to receive requests sent by a first caller and process the requests according to the target resource quota.
[0049] The solution in this embodiment utilizes a first target service node to detect the node operating status of multiple first service nodes and determine the number of first service nodes in normal state. It then dynamically configures the target resource quota for each of the first service nodes in normal state based on the number of nodes and the total resource quota. This solves the problems associated with using a fixed resource quota for a single service node. When the first service cluster expands its first service nodes, it is easy to overlook the increased actual resource consumption, affecting the accuracy of the total resource quota allocation for the first service cluster. Furthermore, when a first service node in the first service cluster is abnormal, the first service nodes in normal state still process requests according to the fixed resource quota, resulting in a waste of usable resources in the first service cluster. This can lead to a situation where, even when usable resources exist in the first service cluster, requests cannot be processed and a rate-limiting state is entered. Therefore, by adopting a dynamic configuration method, the rationality of resource quota configuration and use is improved, maximizing resource utilization. In addition, by setting a first target service node, automatic detection of node operating status and automatic counting of node numbers are achieved, eliminating the need for manual monitoring and improving detection and counting efficiency, thereby improving the efficiency of dynamic resource quota configuration.
[0050] Furthermore, for the second service cluster included in the service providing system, the second target service node, which serves as the second master node in the second service cluster, can divide multiple pre-created threads into multiple thread groups. Based on the request type of the received request, it can determine the corresponding target thread group from the multiple thread groups, and then determine the target thread from the target thread group and allocate the request. This achieves thread isolation, avoids a large number of requests of a certain request type from suddenly filling multiple threads, affecting the thread allocation and processing of other request types, and improves the rationality of thread allocation and request processing efficiency.
[0051] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0052] The technical solutions of this disclosure can be applied to a service provisioning system architecture with multiple service nodes. In a practical application, the service provisioning system can be implemented as a distributed storage system.
[0053] Optionally, the system architecture may also include a control node, which establishes connections with multiple service nodes via a network. The network may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0054] Optionally, the system architecture may also include a caller, also known as a service seeker. The caller can establish connections with the service node and control node via a network.
[0055] Optionally, the caller can interact with the service node via the network to send requests or receive processing results, and the caller can also interact with the control node via the network to send requests or obtain the address information of the service node.
[0056] It should be noted that the embodiments disclosed herein may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country in which it is located (e.g., with the user's explicit consent, with the user being properly notified, etc.).
[0057] Figure 1 shows a schematic diagram of a service provisioning system according to an embodiment of the present disclosure. The system may include a first service cluster, which may include a plurality of first service nodes 101, and the plurality of first service nodes may include a first target service node 1011.
[0058] The first target service node 1011 can be used to detect the node operation status of multiple first service nodes 101; determine the number of at least one first service node 101 whose node operation status is normal based on the node operation status; determine the target resource quota corresponding to each of the at least one first service node 101 based on the number of nodes and the total resource quota; and notify the at least one first service node 101 of the target resource quota.
[0059] The target resource quota can be used to instruct the processing of requests according to the target resource quota, and the request received by the first service node can come from the first caller.
[0060] In this embodiment, the first target service node can be any one of a plurality of first service nodes. It can be determined randomly or based on a master election operation, which will be described in subsequent embodiments.
[0061] The primary target service node can detect the running status of multiple primary service nodes. Node running status can include normal or abnormal states. An abnormal state could be, for example, a machine crashing or experiencing a malfunction.
[0062] It should be noted that in this embodiment, the first service node in a normal state can process requests, while the first service node in an abnormal state cannot process requests, does not need to use resources, and does not need to be allocated resource quotas. In a practical application, resources can refer to database resources, which may include QPS (Queries Per Second), OPS (Operations Per Second), etc., and resource quotas can refer to the upper limit of usable database resources.
[0063] Based on this, the first target service node can determine the number of at least one first service node whose node operating status is normal, and determine the target resource quota corresponding to each of the at least one first service node based on the number of nodes and the total resource quota.
[0064] The total resource quota can refer to the upper limit of database resources that the first service cluster can use, and can be preset. In a practical application, the service providing system may also include other service clusters, such as a second service cluster. The first service cluster and the second service cluster can use the same database. They can be pre-allocated based on the total database resources to obtain their respective corresponding total resource quotas. The specific allocation process can be set according to actual needs, and this disclosure does not impose any restrictions on it.
[0065] Specifically, the number of nodes for determining the first target service node to be in a normal state can be implemented in various ways based on the node's operating status.
[0066] As an optional implementation, the first target service node can determine the number of at least one first service node whose node operating status is normal, provided that the node operating status of any other first service node is detected as abnormal. An abnormal node operating status could include, for example, real-world scenarios such as the machine hosting the first service node crashing or the first service cluster deleting a first service node.
[0067] As an alternative implementation, the first target service node can determine the number of at least one first service node whose node operating status is normal upon detecting the node operating status of a new first service node. For example, when the first service cluster expands its first service nodes, the first target service node can detect the node operating status of the newly added first service nodes.
[0068] Specifically, based on the determined number of nodes, the target resource quota for each of the first target service nodes can be determined according to the number of nodes and the total resource quota, even if the number of nodes differs from the initial number. It should be noted that the initial number refers to the number of nodes in the most recently determined normal state of the first service nodes; that is, if the determined number of nodes differs from the previously determined number, the target resource quota can be reallocated.
[0069] Based on the total resource quota and the number of nodes, the first target service node can determine its own target resource quota according to a certain allocation algorithm, such as average allocation, random allocation, or proportional allocation. In a practical application, the first target service node can distribute the total resource quota equally among at least one first service node according to the number of nodes, thus obtaining the target resource quota for each of the at least one first service node. By adopting an average allocation method, the rationality of the target resource quota allocation for each first service node in a normal state is improved.
[0070] Once the target resource quota is determined, the first target service node can notify the corresponding first service node of the target resource quota. Specifically, the first service node can receive requests from the first caller and process them according to the target resource quota. In a practical application, the target resource quota can be the number of requests. The first service node can rate-limit the received requests if the number of received requests reaches the target resource quota; otherwise, it can process the received requests.
[0071] In this embodiment, by utilizing a first target service node to detect the node operating status of multiple first service nodes and determine the number of first service nodes in a normal state, the target resource quota for each normal first service node is dynamically configured based on the number of normal first service nodes and the total resource quota. This solves the problems of using a fixed resource quota for a single service node, which can easily lead to underestimation of increased actual resource consumption when the first service cluster expands, affecting the accuracy of the total resource quota allocation for the first service cluster. Furthermore, it addresses the issue of normal first service nodes still processing requests according to a fixed resource quota when there are abnormal first service nodes in the first service cluster, resulting in wasted resources and preventing request processing even when resources are available, leading to rate limiting. Therefore, by adopting a dynamic configuration method, the rationality of resource quota configuration is improved, maximizing resource utilization. In addition, by setting a first target service node, automatic detection of node operating status and automatic counting of node numbers are achieved, eliminating the need for manual monitoring and improving detection and counting efficiency, thereby improving the efficiency of dynamic resource quota configuration.
[0072] In practical applications, the first target service node can be determined based on the master election operation. As shown in Figure 2, it is a schematic diagram of another embodiment of a service provisioning system provided in this disclosure. The system may include a first service cluster, which may include a control node 102 and a plurality of first service nodes 101. The plurality of first service nodes 101 may include a plurality of candidate nodes 1012, and the plurality of candidate nodes may include a first target service node 1011.
[0073] Among them, multiple candidate nodes 1012 can be used to send leader election requests to the control node 102 respectively.
[0074] The control node 102 can be used to perform a master election operation according to the master election request, and select a candidate node from multiple candidate nodes 1012 as the first target service node, which is the first master node.
[0075] The first target service node 1011 can be used to detect the node running status of multiple first service nodes 101 when it is acting as the first master node.
[0076] In this embodiment, multiple candidate nodes can be randomly determined from multiple first service nodes. In a practical application, multiple first service nodes can be deployed in multiple data centers, and multiple first service nodes can be deployed in one data center. Any service node in any data center can be configured as a candidate node. As shown in Figure 2, multiple first service nodes 101 are deployed in two data centers, namely data center 1 and data center 2. Both data center 1 and data center 2 include a candidate node 1012 (in this embodiment, the candidate node 1012 in data center 2 is used as the first master node based on the master election operation, that is, the first target service node 1011. Therefore, only the first target service node 1011 is shown in data center 2 in Figure 2, and the candidate node 1012 is not shown).
[0077] In a practical application, the control node can be a node that provides distributed locks and service discovery functionality.
[0078] In this context, the leader election process refers to multiple candidate nodes sending leader election requests to the control node based on their network connections, vying to become the leader. Only the candidate node selected as the leader can establish a session connection with the control node. The control node stores the session information with the leader and maintains this session connection through heartbeat data. In this paper, the network connection refers to the communication channel between the candidate node and the control node, while the session connection can be considered a continuous interactive state containing a series of related requests and responses used to maintain context information. In this paper, it can be understood as a specific channel between the control node and the leader node.
[0079] For ease of description and distinction, the first target service node that successfully elects a master in the first service cluster is referred to as the first master node, and the second target service node that successfully elects a master in the second service cluster involved in the subsequent embodiments is referred to as the second master node.
[0080] If the primary service node is successfully elected, the primary target service node can monitor the node operation status of multiple primary service nodes. It should be noted that when multiple primary service nodes are deployed in multiple data centers, the primary target service node can monitor the node operation status of multiple primary service nodes within its own data center, as well as multiple primary service nodes in other data centers.
[0081] By utilizing the control node to perform a master election operation based on multiple candidate nodes to determine the first target service node, the standardization of the determination of the first target service node is improved, which is beneficial to the detection of the subsequent node operation status.
[0082] In practical applications, the first target service node can detect the node's operating status based on its address information. Therefore, in some embodiments, the first target service node can also be used to obtain the address information corresponding to multiple first service nodes from the configuration information corresponding to the first service cluster. The address information can refer to the IP (Internet Protocol) address of the machine where the first service node resides.
[0083] Based on this, the first target service node's detection of the node operating status of multiple first service nodes may include:
[0084] Based on the address information, status acquisition requests are sent to multiple first service nodes at preset intervals;
[0085] Upon receiving response data from the first service node regarding the status acquisition request, the node operating status of the first service node is determined to be normal; otherwise, the node operating status of the first service node is determined to be abnormal.
[0086] By obtaining address information, the first target service node can send status acquisition requests to multiple first service nodes at preset intervals, thereby enabling automatic detection of the node operation status of multiple first service nodes.
[0087] Optionally, multiple first service nodes can also send heartbeat data to the first target service node based on the address information of the first target service node. Thus, if the first target service node does not receive heartbeat data within a certain period of time, it can determine that the node operation status of the corresponding first service node is abnormal; otherwise, it is determined to be normal.
[0088] Optionally, the node operating status of the first target service node can be detected based on the session connection between the control node and the first target service node. Specifically, if the control node cannot receive heartbeat data sent by the first target service node within a certain period of time during the establishment of a session connection with the first target service node, it can consider the node operating status of the first target service node to be abnormal, and will clear the session connection between the two and re-perform the leader election operation to determine a new first target service node.
[0089] In a practical application, the first service cluster may also include a request distribution node. As shown in Figure 2, the service providing system may include a request distribution node 103.
[0090] The request distribution node 103 can be used to receive the request from the first caller and distribute the request to any of the first service nodes 101, or distribute the request to one of the first service nodes 101 according to the load balancing mechanism.
[0091] The first service node 101 can be used to receive requests sent by the request distribution node 103 and process the requests according to the corresponding target resource quota.
[0092] In a practical application, the service-providing system may also include a database. As shown in Figure 1 or Figure 2, the system may include a database 30.
[0093] The first service node 101 can be used to receive requests sent by the request distribution node, access the database 30 to obtain the target data corresponding to the request, and process the request according to the corresponding target resource quota based on the target data.
[0094] In a practical application, the first service node can be a region-level management node. The service providing system may also include a second service cluster, which includes a second target service node. The second target service node can be an Availability Zone (AZ)-level management node.
[0095] Specifically, the first service node can be used to process the received request according to the corresponding target resource quota, so as to send the request to the second target service node in the second service cluster. The request comes from the first caller.
[0096] Figure 3 shows a schematic diagram of another embodiment of a service provisioning system provided in this disclosure. The system may include a second service cluster, which may include a plurality of second service nodes 201. Among the plurality of second service nodes 201, a second target service node 2011 may be used as a second master node.
[0097] The second target service node 2011 can be used to receive requests sent by the second caller; determine the request type; determine multiple threads pre-created by the second target service node 2011 and multiple thread groups obtained by dividing the multiple threads; determine the target thread group corresponding to the request type from the multiple thread groups; select a target thread from the target thread group; and assign the request to the target thread so that the target thread can process the request.
[0098] In this embodiment, the second target service node can be determined as the second master node based on the master election operation, and the other second service nodes can be determined as backup nodes based on the master election operation. The master election operation can be executed by the control node provided by the second service cluster (not shown in the figure). The specific master election process can be referred to the relevant description in the embodiment shown in Figure 2, and will not be repeated here.
[0099] It should be noted that in this embodiment of the disclosure, the second target service node, which is the second primary node, can receive and process the request sent by the second caller, while the second service node, which is the backup node, does not receive or process the request sent by the second caller.
[0100] The second target service node can pre-create multiple threads and divide them into multiple thread groups, with each thread group containing at least one thread. To reduce resource consumption, improve request response speed, and enhance thread manageability, a thread pool can be used. Therefore, in a practical application, the second target service node can pre-create a thread pool, which can contain multiple threads and be divided into multiple thread groups. The division of thread groups can be implemented in various ways, which will be described in subsequent embodiments.
[0101] During the actual request processing, the second target service node can determine the request type of the received request. In this embodiment, the request type may include, for example, a control request or a data access request. Control requests may include, for example, creating or deleting a cloud disk, while data access requests may include, for example, enabling or disabling a cloud disk. Optionally, the request type can also be categorized according to response time, for example, it may include requests with a response time greater than a preset time or requests with a response time less than a preset time.
[0102] Based on the request type, the second target service node can determine the target thread group corresponding to the request type from multiple thread groups. For example, the second target service node can determine the corresponding target thread group based on the pre-established mapping relationship between multiple thread groups and multiple request types, or there may be other implementation methods, which will be described in subsequent embodiments.
[0103] Once the target thread group is determined, the second target service node can select a target thread from the target thread group and assign the request to the target thread for processing.
[0104] The second target service node may select a target thread from the target thread group, including:
[0105] Select any thread from the target thread group that meets the idle requirement as the target thread.
[0106] Idle time requirements can be set according to actual needs. For example, they can be set to require all requests corresponding to a thread to be processed, or the number of unprocessed requests to be below a threshold. This can improve the rationality of thread allocation. In a practical application, the second target service node can select the thread with the lowest number of unprocessed requests from each thread in the target thread group as the target thread. By selecting the thread with the lowest number of unprocessed requests as the target thread, the rationality of thread allocation is improved.
[0107] Optionally, the second target service node can also update the number of unprocessed requests corresponding to a thread based on the request allocation operation and request processing operation of any thread.
[0108] In this embodiment, by dividing multiple pre-created threads into multiple thread groups, and determining the corresponding target thread group from the multiple thread groups according to the request type of the received request, and then determining the target thread from the target thread group and allocating the request, thread isolation is achieved. This avoids a large number of requests of a certain request type from suddenly filling multiple threads and affecting the thread allocation and processing of other request types, thereby improving the rationality of thread allocation and request processing efficiency.
[0109] The following explains the process of dividing thread groups and determining target thread groups, which can be implemented in multiple ways.
[0110] As an optional implementation, the multiple thread groups can include a first thread group and a second thread group. The first thread group can include multiple threads, and the second thread group can include M threads from the multiple threads, where M is an integer greater than or equal to 1.
[0111] The second target service node determines the target thread group corresponding to the request type from multiple thread groups, which may include:
[0112] When the request type is type 1, the first thread group is determined as the target thread group; when the request type is type 2, the second thread group is determined as the target thread group.
[0113] The response time requirement for the first type of request is higher than that for the second type of request.
[0114] For ease of description, the number of threads pre-created by the second target service node can be N, where N is an integer greater than M. Therefore, in this embodiment, N threads are used as the first thread group, and M threads are used as the second thread group. As shown in Figure 3, the first thread group 301 may include threads 1 to N, a total of N threads, and the second thread group 302 may include threads 1 to M, a total of M threads.
[0115] The second target service node can establish and store the mapping relationships between the first thread group and the first type of request, as well as between the second thread group and the second type of request. The higher response time requirement for the first type of request means that the response time for the first type of request is faster than that for the second type of request, and therefore the response result of the first type of request is returned to the second caller faster than that of the second type of request. In a practical application, the first type of request may include data access requests, and the second type of request may include control requests.
[0116] At this point, the second target service node can determine the first thread group as the target thread group if the received request is a first-type request, and select a target thread from it to assign to the request; similarly, if the received request is a second-type request, it can determine the second thread group as the target thread group, and select a target thread from it to assign to the request. This allows for the selection of target threads from the first thread group (which has a larger number of threads) to assign to requests with higher response time requirements, and from the second thread group (which has a smaller number of threads) to assign to requests with lower response time requirements, further improving the rationality of thread allocation and request processing.
[0117] By dividing all pre-created threads into a first thread group and some of the threads into a second thread group, the system selects target threads from the first thread group to allocate to first-type requests with higher response time requirements, and selects target threads from the second thread group with fewer threads to allocate to requests with lower response time requirements, thereby further improving the rationality of thread allocation and request processing.
[0118] As an alternative implementation method for thread group division and target thread group determination, multiple thread groups may include a second thread group and a third thread group. The second thread group may include M threads from multiple threads, and the third thread group may include threads other than the M threads from multiple threads, where M is an integer greater than or equal to 1.
[0119] The second target service node determines the target thread group corresponding to the request type from multiple thread groups, which may include:
[0120] If the request type is the first type, determine whether there is a thread in the second thread group that meets the idle requirement. If yes, determine the second thread group as the target thread group; otherwise, determine the third thread group as the target thread group.
[0121] If the request type is a second type of request, then the second thread group is determined as the target thread group.
[0122] The response time requirement for the first type of request is higher than that for the second type of request.
[0123] For ease of description, the number of threads pre-created by the second target service node can be N, where N is an integer greater than M. Therefore, in this embodiment, M threads are divided into a second thread group, and NM threads are divided into a third thread group. As shown in Figure 3, the second thread group 302 may include threads 1 to M, a total of M threads, and the third thread group 303 may include threads M+1 to N, a total of NM threads.
[0124] The second target service node, upon receiving a request of type 1, can first determine whether there are any threads in the second thread group that meet the idle requirements. Idle requirements may include, for example, that all requests have been processed and the number of unprocessed requests is below a preset number. If such a thread exists, the second thread group can be designated as the target thread group, and a target thread can be selected from it to be assigned to the request. If not, the third thread group can be designated as the target thread group.
[0125] If the received request is a type 2 request, the second thread group can be directly used as the target thread group, and a target thread can be selected from it to be assigned to the request.
[0126] By dividing some of the pre-created threads into a second thread group and the remaining threads into a third thread group, the second thread group is used as the target thread group for second-type requests with lower response time requirements. For first-type requests with higher response time requirements, it is first determined whether there are threads in the second thread group that meet the idle requirements. If so, the second thread group is directly used as the target thread group to utilize the unused threads in the third thread group to handle sudden request surges. If there are no threads in the second thread group that meet the idle requirements, the third thread group is used as the target thread group. This ensures the smooth response and processing of first-type requests and further improves the rationality of thread allocation and request processing.
[0127] In practical applications, the request type can be determined based on the interface's identification information. Therefore, in some embodiments, the second caller can store identification information for multiple interfaces provided by the second target service node. This identification information may include first identification information and second identification information. The first identification information may indicate that the corresponding interface is used to receive requests with high response time requirements, and the second identification information may indicate that the corresponding interface is used to receive requests with low response time requirements.
[0128] Based on this, the request type determined by the second target service node may include:
[0129] If the interface to be called corresponds to the first identifier information, the request type is determined to be a first type of request; if the interface to be called corresponds to the second identifier information, the request type is determined to be a second type of request.
[0130] In a practical application, the caller can integrate a target plugin, which can be implemented as an SDK (Software Development Kit). This target plugin can store the identification information of multiple interfaces. The caller can save the identification information and call the corresponding interface to send a request.
[0131] By judging the identification information of the called interface, the request type can be determined.
[0132] In a practical application, the service-providing system may also include a database. As shown in Figure 3, the system may include a database 30. In this case, the multiple threads created by the second target service node are database threads.
[0133] The second target service node assigns the request to the target thread so that the target thread can process the request, which may include:
[0134] The request is assigned to the target thread so that the target thread can access the database to obtain metadata information and process the request based on the metadata information.
[0135] Metadata information can refer to routing information, permission information, configuration information, etc. The second target service node distributes the request to the target thread, which can access the database to obtain the corresponding metadata information and process the request based on the metadata information. For example, it can combine metadata to perform operations such as request forwarding, permission verification, data splitting, and data location.
[0136] By accessing the database to obtain metadata information, the correctness of the obtained metadata information is ensured, thereby improving the correctness of request processing.
[0137] In a practical application, the second target service node can be a management node at the Availability Zone (AZ) level, while the first service node can be a management node at the Region level.
[0138] In addition, the service providing system may also include cluster-level management nodes and compute nodes, with the management nodes connecting to the storage cluster. In a practical application, the storage cluster can be a distributed storage system.
[0139] Based on this, the second target service node may receive requests sent by the second caller in the following ways:
[0140] Receive control requests sent by regional-level control nodes; or...
[0141] Receive data access requests sent by computing nodes.
[0142] The second target service node assigns the request to the target thread so that the target thread can process the request, which may include:
[0143] The control request is assigned to the target thread, which then sends the control request to the cluster-level management node. The cluster-level management node then sends the control request to the storage cluster, and the storage cluster executes the corresponding control operation, such as disk creation operation in a distributed storage system.
[0144] Alternatively, data access requests can be assigned to target threads, which then send the requests to cluster-level management nodes. These nodes then forward the requests to the storage cluster, which performs data access operations such as reading or writing.
[0145] This disclosure does not impose any restrictions on the specific implementation of control operations or data access operations performed on the storage cluster.
[0146] To facilitate understanding, the technical solutions disclosed herein will be explained below in different practical scenarios.
[0147] In a real-world scenario, multiple primary service nodes in the primary service cluster process requests according to their respective database resource quotas, such as the available QPS (Queries Per Second) and OPS (Operations Per Second) limits. Furthermore, database resource quotas are configured using a single-machine flow control approach; that is, each primary service node has a fixed database resource quota. Requests can be processed as long as the used database resources have not reached the quota; otherwise, rate limiting is implemented.
[0148] However, with this single-machine flow control method, when the first service node in the first service cluster is expanded, if the database resource quota of the first service node is kept fixed due to the increase in the number of first service nodes, it is easy to miss the increase in the actual consumption of database resources, thus affecting the accuracy of the allocation of the total database resource quota of the first service cluster.
[0149] Furthermore, this single-machine flow control method, when the first service node in the first service cluster is deleted, or the machine where the first service node is located crashes or the data center fails, causing the first service node to become abnormal and unable to process requests, if the database resource quota of the other normal first service nodes is kept fixed, it will result in a waste of available database resources in the first service cluster. In other words, even if there are available database resources in the first service cluster, if the first service node reaches its original quota, it will no longer be able to process requests and will enter a rate-limited state, thus failing to achieve reasonable and maximized use of database resources.
[0150] In this embodiment of the disclosure, referring to the system architecture diagram shown in Figure 2, the first target service node 1011 can detect the node operating status of multiple first service nodes 101, determine the number of at least one first service node 101 whose node operating status is normal based on the node operating status, and determine the target resource quota corresponding to each of the at least one first service node 101 based on the number of nodes and the total resource quota, and notify the at least one first service node 101 of the target resource quota. Specifically, the first service node 101 can receive requests sent by the first caller and process the requests according to the target resource quota.
[0151] By utilizing a primary target service node to monitor the operational status of multiple primary service nodes and determine the number of primary service nodes in a normal state, the system dynamically configures the target resource quota for each primary service node in a normal state based on the number of such nodes and the total resource quota. This improves the rationality of resource quota configuration and maximizes resource utilization. Furthermore, by setting a primary target service node, the system automatically detects node operational status and counts the number of nodes, eliminating the need for manual monitoring and improving detection and statistical efficiency, thereby enhancing the efficiency of dynamic resource quota configuration.
[0152] In another practical scenario, the second target service node, which acts as the second master node in the second service cluster, pre-creates a thread pool. Multiple threads in the thread pool are used to handle received requests. Typically, the second target service node receives requests of different types from different second callers. As shown in Figure 3, the second caller may include a region-level management node 304 or a cluster-level compute node 305. Requests sent by the region-level management node 304 may include control requests, such as disk creation requests in a distributed storage system, while requests sent by the compute node 305 may include data access requests, such as data read / write. Since different request types are handled by threads in a single thread pool, a surge in requests of a particular type, such as batch creation or deletion of cloud disks, can easily overwhelm the thread pool. This will affect the thread allocation and processing of other request types, especially requests with high response time requirements, such as data access requests, resulting in a poor user experience.
[0153] In this embodiment of the disclosure, referring to the system architecture diagram shown in Figure 3, the second target service node 2011 can divide the N threads in the thread pool into a first thread group and divide the M threads in the thread pool into a second thread group. Thus, for the first type of request with high response time requirements, the first thread group is used as the target thread group, and a target thread that meets the idle requirement is selected from it and the request is assigned to the target thread. For the first type of request with low response time requirements, the second thread group is used as the target thread group, and a target thread that meets the idle requirement is selected from it and the request is assigned to the target thread. The target thread will process the request and send the request to the cluster-level management node 306, so that the cluster-level management node 306 can send the request to the storage cluster (not shown in the figure).
[0154] By dividing all pre-created threads into a first thread group and some of the threads into a second thread group, the system selects target threads from the first thread group to allocate to first-type requests with higher response time requirements, and selects target threads from the second thread group with fewer threads to allocate to requests with lower response time requirements, thereby further improving the rationality of thread allocation and request processing.
[0155] Optionally, the second target service node 2011 can further divide the M threads in the thread pool into a second thread group and the NM threads into a third thread group. When the received request is a first-type request, it can be first determined whether there are threads in the second thread group that meet the idle requirements. Idle requirements may include, for example, all requests having been processed and the number of unprocessed requests being lower than a preset number. If such a thread exists, the second thread group can be used as the target thread group, and a target thread can be selected from it to be assigned to the request. If not, the third thread group can be used as the target thread group. When the received request is a second-type request, the second thread group can be directly used as the target thread group, and a target thread can be selected from it to be assigned to the request.
[0156] By dividing some pre-created threads into a second thread group and the remaining threads into a third thread group, for second-type requests with lower response time requirements, the second thread group is used as the target thread group. For first-type requests with higher response time requirements, it is first determined whether there are threads in the second thread group that meet the idle requirement. If so, the second thread group is directly used as the target thread group to utilize the unused threads in the third thread group to handle sudden request surges. If there are no threads in the second thread group that meet the idle requirement, the third thread group is used as the target thread group. This ensures the smooth response and processing of first-type requests and further improves the rationality of thread allocation and request processing.
[0157] Corresponding to the service provision system shown in Figure 1, as shown in Figure 4, this embodiment of the disclosure also provides a resource allocation method, which can be executed by a first target service node. The method may include the following steps:
[0158] 401: Detects the node running status of multiple first service nodes;
[0159] 402: Determine the number of first service nodes whose node operating status is normal, based on the node operating status.
[0160] 403: Based on the number of nodes and the total resource quota, determine the target resource quota corresponding to at least one first service node;
[0161] 404: Notify at least one primary service node of the target resource quota.
[0162] The target resource quota is used to instruct at least one first service node to process requests in accordance with the target resource quota.
[0163] By utilizing a primary target service node to detect the operational status of multiple primary service nodes and determine the number of primary service nodes in a normal state, the system dynamically configures the target resource quota for each primary service node in a normal state based on the number of such nodes and the total resource quota. This solves the problems associated with using a fixed resource quota for a single service node. When the primary service cluster expands its capacity, it may fail to assess the increased actual resource consumption, affecting the accuracy of the total resource quota allocation. Furthermore, when a primary service node in the cluster malfunctions, a normal primary service node may still process requests according to a fixed resource quota, resulting in wasted resources and potentially leading to rate limiting even when resources are available. Therefore, dynamic configuration improves the rationality of resource quota allocation and maximizes resource utilization. In addition, by setting a primary target service node, the system automatically detects the node's operational status and counts the number of nodes, eliminating the need for manual monitoring and improving detection and statistics efficiency, thereby enhancing the efficiency of dynamic resource quota allocation.
[0164] In some embodiments, the plurality of first service nodes may include a plurality of candidate nodes; the plurality of candidate nodes include a first target service node. Before detecting the node operating status of the plurality of first service nodes, the method may further include:
[0165] Send a leader election request to the control node so that the control node can perform the leader election operation to determine whether the first target service node should be the first master node;
[0166] Detecting the node running status of multiple first service nodes can include:
[0167] When the first target service node is the first master node, the node running status of multiple first service nodes is detected.
[0168] In some embodiments, when the first target service node is the first master node, detecting the node running status of multiple first service nodes may include:
[0169] Obtain the address information corresponding to multiple first service nodes from the configuration information corresponding to the first service cluster;
[0170] Based on the address information, status acquisition requests are sent to multiple first service nodes at preset intervals;
[0171] Upon receiving response data from the first service node regarding the status acquisition request, the node operating status of the first service node is determined to be normal; otherwise, the node operating status of the first service node is determined to be abnormal.
[0172] In some embodiments, determining the number of at least one first service node whose node operating status is normal based on the node operating status may include:
[0173] If the node operating status of any first service node is detected to be abnormal, determine the number of first service nodes whose node operating status is at least one normal; and / or,
[0174] If a new first service node is detected, determine the number of first service nodes whose node operating status is normal.
[0175] In some embodiments, determining the target resource quota for each of at least one first service node based on the number of nodes and the total resource quota includes:
[0176] If the number of nodes in the first service node is different from the initial number, the target resource quota corresponding to at least one first service node shall be determined according to the number of nodes and the total resource quota.
[0177] In some embodiments, the target resource quota is the number of requests;
[0178] The above methods may also include:
[0179] According to the target resource quota, if the number of received requests reaches the target resource quota, the received requests will be rate-limited; otherwise, the received requests will be processed.
[0180] The resource allocation method shown in Figure 4 can be executed by the first target service node shown in Figure 1 or Figure 2. Its implementation principle and technical effects will not be elaborated further. The specific methods of each embodiment of the resource allocation method described above have been described in detail in the embodiments related to the system, and will not be elaborated upon here.
[0181] Corresponding to the service provision system shown in Figure 2, as shown in Figure 5, this embodiment of the disclosure also provides a control method, which can be executed by a control node. The method may include the following steps:
[0182] 501: Receives leader election requests from multiple candidate nodes;
[0183] 502: Perform a leader election operation based on the leader election request to select a candidate node from multiple candidate nodes as the first target service node.
[0184] The first target service node can be used to detect the node operation status of multiple first service nodes; determine the number of at least one first service node whose node operation status is normal based on the node operation status; determine the target resource quota corresponding to each of the at least one first service node based on the number of nodes and the total resource quota; notify the at least one first service node of the target resource quota; wherein the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota.
[0185] By utilizing the control node to perform a master election operation based on multiple candidate nodes to determine the first target service node, the standardization of the determination of the first target service node is improved, which is beneficial to the detection of the subsequent node operation status.
[0186] The control method shown in Figure 5 can be executed by the control node shown in Figure 1 or Figure 2. Its implementation principle and technical effects will not be elaborated further. The specific methods of each embodiment of the control method described above have been described in detail in the embodiments related to the system, and will not be elaborated upon here.
[0187] Corresponding to the service provision system shown in Figure 3, as shown in Figure 6, this embodiment of the disclosure also provides a service provision method, which can be executed by a second target service node. The method may include the following steps:
[0188] 601: Received a request from a second caller;
[0189] 602: Determines the type of request;
[0190] 603: Determine the multiple threads pre-created by the second target service node and the multiple thread groups obtained by dividing the multiple threads;
[0191] 604: Determine the target thread group corresponding to the request type from multiple thread groups;
[0192] 605: Select the target thread from the target thread group;
[0193] 606: Distribute the request to the target thread so that the target thread can handle the request.
[0194] By dividing multiple pre-created threads into multiple thread groups, and determining the corresponding target thread group from among the multiple thread groups based on the request type of the received request, and then determining the target thread from the target thread group and allocating the request, thread isolation is achieved. This avoids a large number of requests of a certain type from suddenly filling multiple threads and affecting the thread allocation and processing of other request types, thereby improving the rationality of thread allocation and request processing efficiency.
[0195] In some embodiments, the multiple thread groups include a first thread group and a second thread group. The first thread group includes multiple threads, and the second thread group includes M threads from the multiple threads; M is an integer greater than or equal to 1.
[0196] Determining the target thread group corresponding to the request type from multiple thread groups can include:
[0197] When the request type is a Type 1 request, the first thread group is determined as the target thread group;
[0198] When the request type is the second type, the second thread group is determined as the target thread group; wherein, the response time requirement for the first type of request is higher than the response time requirement for the second type of request.
[0199] In some embodiments, the multiple thread groups include a second thread group and a third thread group. The second thread group includes M threads from the multiple threads, and the third thread group includes the threads other than the M threads from the multiple threads; M is an integer greater than or equal to 1.
[0200] Determining the target thread group corresponding to the request type from multiple thread groups can include:
[0201] If the request type is the first type, determine whether there is a thread in the second thread group that meets the idle requirement. If yes, determine the second thread group as the target thread group; otherwise, determine the third thread group as the target thread group.
[0202] When the request type is the second type, the second thread group is determined as the target thread group; where the response time requirement for the first type of request is higher than that for the second type of request.
[0203] In some embodiments, selecting a target thread from a target thread group may include:
[0204] Select any thread from the target thread group that meets the idle requirement as the target thread.
[0205] In some embodiments, selecting any thread from the target thread group that meets the idle requirement as the target thread may include:
[0206] Based on the number of unprocessed requests for each thread in the target thread group, select the thread with the lowest number of unprocessed requests as the target thread.
[0207] In some embodiments, the above method may further include:
[0208] Update the number of unprocessed requests for each thread based on its request allocation and processing operations.
[0209] In some embodiments, the second caller stores identification information of multiple interfaces provided by the second target service node, the identification information including first identification information and second identification information;
[0210] Determining the request type can include:
[0211] If the interface to be called corresponds to the first identifier information, the request type is determined to be a first type request;
[0212] If the interface to be called corresponds to the second identifier information, the request type is determined to be a second type of request.
[0213] In a practical application, multiple threads are database threads;
[0214] Assigning a request to a target thread so that the target thread can process the request can include:
[0215] The request is assigned to the target thread so that the target thread can access the database to obtain metadata information and process the request based on the metadata information.
[0216] In a practical application, the second target service node is an availability zone-level management node, the second caller is a region-level management node or compute node, and the service providing system also includes a cluster-level management node; the cluster-level management node connects to the cluster system.
[0217] Receiving a request from the second caller includes:
[0218] Receive control requests sent by regional-level control nodes; or...
[0219] Receive data access requests sent by compute nodes;
[0220] Assigning a request to a target thread so that the target thread can process the request can include:
[0221] The control request is assigned to the target thread, which then sends the control request to the cluster-level management node. The cluster-level management node then sends the control request to the cluster system, and the cluster system executes the corresponding control operation.
[0222] Alternatively, data access requests can be assigned to target threads, which then send the data access requests to cluster-level management nodes. These management nodes then forward the data access requests to the cluster system, which in turn performs the data access operations.
[0223] The service provision method shown in Figure 6 can be executed by the second target service node shown in Figure 3. Its implementation principle and technical effects will not be elaborated further. The specific methods of each embodiment of the service provision method described above have been described in detail in the embodiments related to the system, and will not be elaborated upon here.
[0224] It should be noted that some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear in this document, or they may be executed in parallel. The operation numbers, such as 401, 402, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should also be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a chronological order, nor do they limit "first" and "second" to different types.
[0225] Corresponding to the resource allocation method shown in Figure 4, as shown in Figure 7, this disclosure also provides a resource allocation device, which may include the following modules:
[0226] The detection module 701 is used to detect the node running status of multiple first service nodes;
[0227] The first determining module 702 is used to determine the number of at least one first service node whose node operating status is normal, based on the node operating status.
[0228] The second determining module 703 is used to determine the target resource quota corresponding to at least one first service node based on the number of nodes and the total resource quota.
[0229] The notification module 704 is used to notify at least one first service node of the target resource quota; wherein the target resource quota is used to instruct at least one first service node to process the request according to the target resource quota.
[0230] The resource allocation device shown in Figure 7 can be used to execute the resource allocation method shown in Figure 4. Its implementation principle and technical effects will not be elaborated further. One or more modules of the resource allocation device shown in Figure 7 can constitute the first target service node in the system architecture shown in Figures 1 and 2. The specific methods by which each module of the resource allocation device in the above embodiments performs its operations have been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0231] Corresponding to the control method shown in Figure 5, as shown in Figure 8, this disclosure also provides a control device, which may include the following modules:
[0232] The first receiving module 801 is used to receive the leader election requests sent by multiple candidate nodes respectively;
[0233] The first selection module 802 is used to perform a master selection operation according to the master selection request, so as to select a candidate node from multiple candidate nodes as the first target service node;
[0234] The first target service node is used to detect the node operation status of multiple first service nodes; based on the node operation status, it determines the number of at least one first service node whose node operation status is normal; based on the number of nodes and the total resource quota, it determines the target resource quota corresponding to each of the at least one first service node; and it notifies the at least one first service node of the target resource quota; wherein the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota.
[0235] The control device shown in Figure 8 can be used to execute the control method shown in Figure 5; its implementation principle and technical effects will not be elaborated further. One or more modules of the control device shown in Figure 8 can constitute the control node in the system architecture shown in Figure 2. The specific methods by which each module of the control device in the above embodiments performs its operations have been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0236] Corresponding to the service provision method shown in Figure 6, as shown in Figure 9, this disclosure also provides a service provision apparatus, which may include the following modules:
[0237] The second receiving module 901 is used to receive requests sent by the second caller;
[0238] The third determining module 902 is used to determine the request type of the request;
[0239] The fourth determining module 903 is used to determine the multiple threads pre-created by the second target service node and the multiple thread groups obtained by dividing the multiple threads;
[0240] The fifth determining module 904 is used to determine the target thread group corresponding to the request type from multiple thread groups;
[0241] The second selection module 905 is used to select a target thread from the target thread group;
[0242] The allocation module 906 is used to allocate requests to the target thread so that the target thread can process the requests.
[0243] The service providing device shown in Figure 9 can be used to execute the service providing method shown in Figure 6; its implementation principle and technical effects will not be elaborated further. One or more modules of the service providing device shown in Figure 9 can constitute the second target service node in the system architecture shown in Figure 3. The specific methods by which each module of the service providing device in the above embodiments performs its operations have been described in detail in the embodiments related to the method, and will not be elaborated further here.
[0244] Figure 10 is a schematic diagram of a computing device according to an embodiment of the present disclosure. As shown in Figure 10, in practical applications, the computing device may include a storage component 1001 and a processing component 1002.
[0245] Storage component 1001 is used to store computer programs and can be configured to store various other data to support operation on a computing device. Examples of this data include instructions for any application or method used to operate on the computing device, data structures, contact data, phone book data, messages, pictures, videos, etc.
[0246] Processing component 1002, coupled to storage component 1001, is used to execute computer programs in storage component 1001 to implement the resource allocation method shown in FIG4, or the control method shown in FIG5, or the service provision method shown in FIG6.
[0247] Furthermore, as shown in Figure 10, the computing device may also include other components such as a communication component 1003, a display component 1004, a power supply component 1005, and an audio component 1106. Figure 10 only schematically shows some components and does not imply that the computing device only includes the components shown in Figure 10. Additionally, the components within the dashed boxes in Figure 10 are optional, not mandatory, and their specific inclusion depends on the product form of the computing device. The computing device of this embodiment can be implemented as a desktop computer, laptop computer, smartphone, or IoT (Internet of Things) device, or as a server-side device such as a conventional server, cloud server, or server array. If the computing device of this embodiment is implemented as a desktop computer, laptop computer, smartphone, or other terminal device, it may include the components within the dashed boxes in Figure 10; if the computing device of this embodiment is implemented as a conventional server, cloud server, or server array, it may not include the components within the dashed boxes in Figure 10.
[0248] The processing component described above includes one or more processors to execute computer instructions to complete all or part of the steps in the method described above. Alternatively, the processing component may be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the method described above.
[0249] The aforementioned storage components can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0250] The aforementioned communication component is configured to facilitate wired or wireless communication between the device housing the communication component and other devices. The device housing the communication component can access wireless networks based on communication standards, such as mobile communication networks, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
[0251] The aforementioned display components may include a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0252] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0253] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0254] Accordingly, this disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.
[0255] Accordingly, this disclosure also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, cause the processor to implement the steps in the above-described method embodiments. It should be understood that each step or combination of steps in the above-described method flow can be implemented by the computer program or instructions. Furthermore, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, enabling the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to function as an apparatus for implementing the corresponding functions in the above-described method embodiments.
[0256] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0257] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0258] Finally, it should be noted that the above are merely embodiments of this disclosure and are not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.
Claims
1. A service providing system characterized by comprising: The first service cluster comprises a plurality of first service nodes, and the plurality of first service nodes comprise a first target service node; The first target service node is configured to detect node running states of the plurality of first service nodes; According to the node running states, a number of at least one first service node whose node running state is normal is determined; According to the number of at least one first service node whose node running state is normal and a total amount of resource quotas, a target resource quota corresponding to each of the at least one first service node is determined, and the target resource quota is notified to the at least one first service node; wherein the target resource quota is used to instruct the at least one first service node to perform request processing according to the target resource quota.
2. The system of claim 1, wherein, The first service cluster further comprises a control node, and the plurality of first service nodes comprise a plurality of candidate nodes, and the plurality of candidate nodes comprise the first target service node; The plurality of candidate nodes are configured to respectively send a master selection request to the control node; The control node is configured to perform a master selection operation according to the master selection request to determine one candidate node from the plurality of candidate nodes as a first target service node; The first target service node is a first master node; The first target service node is specifically configured to detect node running states of the plurality of first service nodes in a case of being a first master node.
3. The system of claim 1 or 2, wherein, The first target service node is further configured to obtain address information corresponding to the plurality of first service nodes from configuration information corresponding to the first service cluster; When detecting the node running states of the plurality of first service nodes, the first target service node is specifically configured to: based on the address information, send a state acquisition request to the plurality of first service nodes at intervals of a preset time; when receiving response data sent by the first service node and corresponding to the state acquisition request, determine that the node running state of the first service node is normal; otherwise, determine that the node running state of the first service node is abnormal. When determining the number of at least one first service node whose node running state is normal according to the node running states, the first target service node is specifically configured to:
4. The system according to any one of claims 1-3, characterized in that, In a case where the node running state of any first service node is determined to be abnormal, the number of at least one first service node whose node running state is normal is determined; And / or, In a case where the node running state of a new first service node is detected, the number of at least one first service node whose node running state is normal is determined. When determining the target resource quota corresponding to each of the at least one first service node according to the number of at least one first service node whose node running state is normal and the total amount of resource quotas, the first target service node is specifically configured to: in a case where the number of at least one first service node whose node running state is normal is different from an initial number corresponding to the plurality of first service nodes, determine the target resource quota corresponding to each of the at least one first service node according to the number of at least one first service node whose node running state is normal and the total amount of resource quotas.
5. The system according to any of claims 1-4, characterized in that, 6. The system according to any one of claims 1-5, characterized in that, The target resource quota is a number of requests; the first service node is configured to throttle the received request according to the target resource quota when the received request reaches the target resource quota, or process the received request otherwise, the received request of the first service node being from a first invoker.
7. The system according to any of claims 1-6, characterized in that, The service providing system further includes a second service cluster, the second service cluster including a plurality of second service nodes, the plurality of second service nodes including a second target service node as a second master node; The second target service node is configured to receive a request sent by a second invoker; Determine a request type of the request; Determine a plurality of threads pre-created by the second target service node and a plurality of thread groups obtained by dividing the plurality of threads; From the plurality of thread groups, determine a target thread group corresponding to the request type; Select a target thread from the target thread group; and assign the request to the target thread to process the request by using the target thread.
8. The system of claim 7, wherein, The second invoker includes any one of the first service nodes; the first service node is specifically configured to process the received request according to the target resource quota to send the request to the second target service node; the received request of the first service node is from a first invoker.
9. The system of claim 7 or 8, wherein, The plurality of thread groups include a first thread group and a second thread group, the first thread group including the plurality of threads, and the second thread group including M threads of the plurality of threads; M is an integer greater than or equal to 1; When determining the target thread group corresponding to the request type from the plurality of thread groups, the second target service node is specifically configured to: when the request type is a first type of request, determine the first thread group as the target thread group; and when the request type is a second type of request, determine the second thread group as the target thread group; wherein a response time requirement corresponding to the first type of request is higher than a response time requirement corresponding to the second type of request.
10. The system of claim 7 or 8, wherein, The plurality of thread groups include a second thread group and a third thread group, the second thread group including M threads of the plurality of threads, and the third thread group including threads of the plurality of threads except the M threads; M is an integer greater than or equal to 1; When determining the target thread group corresponding to the request type from the plurality of thread groups, the second target service node is specifically configured to: When the request type is a first type of request, determine whether there is a thread satisfying an idle requirement in the second thread group, if yes, determine the second thread group as the target thread group; if no, determine the third thread group as the target thread group; and when the request type is a second type of request, determine the second thread group as the target thread group; wherein a response time requirement corresponding to the first type of request is higher than a response time requirement corresponding to the second type of request. When selecting a target thread from the target thread group, the second target service node is specifically configured to: select any thread satisfying an idle requirement from the target thread group as the target thread.
11. The system according to any of claims 7-10, characterized in that, 12. The system of claim 11, wherein, The second target service node is specifically configured to: select any thread with the lowest number of unprocessed requests as the target thread according to the number of unprocessed requests corresponding to each thread in the target thread group.
13. The system according to any of claims 7-12, characterized in that, The service providing system further comprises a database; and the plurality of threads are database threads. The second target service node is specifically configured to: allocate the request to the target thread to access the database to obtain metadata information and process the request based on the metadata information.
14. The system according to any of claims 7-13, characterized in that, The second target service node is a management and control node at the availability zone level, and the first target service node is a management and control node at the region level; the service providing system further comprises a cluster level management and control node and a computing node; and the cluster level management and control node is connected to a storage cluster. The second target service node is specifically configured to: receive a control request sent by a management and control node at the region level; or receive a data access request sent by a computing node. The second target service node is specifically configured to: allocate the control request to the target thread to send the control request to the cluster level management and control node, so that the cluster level management and control node sends the control request to the storage cluster and the storage cluster performs a corresponding control operation; or allocate the data access request to the target thread to send the data access request to the cluster level management and control node, so that the cluster level management and control node sends the data access request to the storage cluster and the storage cluster performs a data access operation. The method is applied to a first target service node in a first service cluster included in a service providing system, and comprises:
15. A method of resource allocation, characterized by, detecting node running states of the plurality of first service nodes; determining a node quantity of at least one first service node with a normal node running state according to the node running states; determining a target resource quota corresponding to each of the at least one first service node according to the node quantity and a total resource quota; notifying the at least one first service node of the target resource quota; and wherein the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota. The method is applied to a second target service node as a second master node in a second service cluster included in a service providing system, and comprises:
16. A service providing method characterized by comprising: receiving a request sent by a second invoker; determining a request type of the request; determining a plurality of threads pre-created by the second target service node and a plurality of thread groups obtained by dividing the plurality of threads; determining a target thread group corresponding to the request type from the plurality of thread groups; selecting a target thread from the target thread group; allocating the request to the target thread to process the request by using the target thread.
17. A control method characterized by, A method applied to a control node in a service providing system, the service providing system comprising a first service cluster, the first service cluster comprising a plurality of first service nodes, the plurality of first service nodes comprising a plurality of candidate nodes, the method comprising: receiving a master election request sent by each of the plurality of candidate nodes; performing a master election operation according to the master election request to select one candidate node from the plurality of candidate nodes as a first target service node; wherein the first target service node is configured to detect node running states of the plurality of first service nodes, determine a node number of at least one first service node with a normal node running state according to the node running states, determine a target resource quota corresponding to each of the at least one first service node according to the node number and a total resource quota, and notify the at least one first service node of the target resource quota, wherein the target resource quota is used to instruct the at least one first service node to process requests according to the target resource quota.
18. A computing device, comprising: A computer readable storage medium storing one or more computer program instructions, the one or more computer program instructions being configured to be executed by a processor to implement the resource allocation method of claim 15, or the service providing method of claim 16, or the control method of claim 17.
19. A computer-readable storage medium, characterized in that, A computer readable storage medium storing one or more computer program instructions, the one or more computer program instructions being configured to be executed by a processor to implement the resource allocation method of claim 15, or the service providing method of claim 16, or the control method of claim 17.
20. A computer program product, characterised in that, A computer readable storage medium storing one or more computer program instructions, the one or more computer program instructions being configured to be executed by a processor to implement the resource allocation method of claim 15, or the service providing method of claim 16, or the control method of claim 17.
