Resource management method, device, storage medium and program product

By monitoring and adjusting the concurrent processing volume of distributed services in real time, the resource allocation problem caused by the sudden increase in concurrent requests is solved, and the rational utilization of resources and system stability are achieved.

CN114675973BActive Publication Date: 2025-06-06INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210462597.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-28
Publication Date
2025-06-06
Estimated Expiration
2042-04-28

AI Technical Summary

Technical Problem

In the prior art, when the concurrent requests increase suddenly, distributed services are likely to cause blockage of the entire link nodes, affecting the call of other services, resulting in the performance of the service cluster deterioration or unavailability, and insufficient resource allocation or waste of resources cannot be effectively solved.

Method used

By obtaining the initial concurrent processing volume of each service and the number of threads in the thread pool, the concurrent request volume and reference volume are monitored in real time, and whether the difference is within the preset range. If not, the concurrent processing volume will be adjusted to ensure reasonable resource allocation.

Benefits of technology

It realizes reasonable management and control of resources from an overall perspective, ensures reasonable concurrent processing volume of each service, avoids insufficient resource allocation or waste, and ensures system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675973B_ABST
    Figure CN114675973B_ABST
Patent Text Reader

Abstract

The present application provides a resource management method, device, storage medium and program product, which obtains the initial concurrent processing volume of each service and the number of threads in the thread pool; obtains the real-time concurrent request volume and the concurrent request reference volume of each service; if the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within the preset range, controls each service to process concurrent requests with the corresponding initial concurrent processing volume; if the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within the preset range, sums the real-time concurrent request volume of each service to obtain the total real-time concurrent request volume, sets the concurrent processing volume of each service according to the comparison result between the total real-time concurrent request volume and the number of threads, and controls each service to process concurrent requests with the set concurrent processing volume. Reasonable management and control of resources from an overall perspective makes the concurrent processing volume of each service more reasonable, ensures the stable use of resources while making full use of resources, and ensures system stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a resource management method, device, storage medium and program product. Background Art

[0002] Distributed service calls are remote calls. Each service should run lightweight, that is, the service takes a short time to run. If the service takes a long time to run, it will occupy thread pool resources for a long time. When the service call concurrency increases suddenly, it is easy to cause full-link node congestion, thereby affecting the calls of other services and further causing the performance of the entire service cluster to degrade or even become unavailable as a whole.

[0003] In the prior art, each service in a distributed service may have concurrent call requests, and in concurrency management, a single service is usually configured with a concurrent processing capacity, that is, the maximum number of requests that can be processed simultaneously. When the number of concurrent requests exceeds the concurrent processing capacity, the excess concurrent requests are directly rejected, thereby avoiding the pressure on the use of critical resources.

[0004] In the prior art, the concurrent processing capacity of a single service is usually manually configured to meet certain critical resource management requirements. However, there may be problems such as insufficient resource allocation or resource waste for some core services, making it impossible to fully utilize resources. Summary of the invention

[0005] The present application provides a resource management method, device, storage medium and program product to reasonably control resources from an overall perspective, so that the concurrent processing volume of each service is more reasonable.

[0006] In a first aspect, the present application provides a resource management method, comprising:

[0007] Get the initial concurrent processing capacity of each service and the number of threads in the thread pool;

[0008] Get the real-time concurrent request volume of each service and the reference volume of concurrent requests of each service;

[0009] Compare the real-time concurrent request volume of each service with the corresponding concurrent request reference volume;

[0010] If the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within a preset range, each service is controlled to process concurrent requests with the corresponding initial concurrent processing volume;

[0011] If the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within a preset range, the real-time concurrent request volumes of each service are summed to obtain the total real-time concurrent request volume, and the total real-time concurrent request volume is compared with the number of threads. The concurrent processing volume of each service is set according to the comparison result, and each service is controlled to process concurrent requests with the set concurrent processing volume.

[0012] In a second aspect, the present application provides a resource management device, including:

[0013] A first acquisition unit is used to acquire the initial concurrent processing volume of each service and the number of threads in the thread pool;

[0014] A second acquisition unit is used to acquire the real-time concurrent request volume of each service and the concurrent request reference volume of each service;

[0015] A comparison unit, used to compare the real-time concurrent request amount of each service with the corresponding concurrent request reference amount;

[0016] A control unit, configured to control each service to process concurrent requests with a corresponding initial concurrent processing amount if the difference between the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within a preset range;

[0017] a configuration unit, configured to sum the real-time concurrent request amounts of each service to obtain a total real-time concurrent request amount, compare the total real-time concurrent request amount with the number of threads, and set the concurrent processing amount of each service according to the comparison result, if the difference between the real-time concurrent request amount of at least one service and the corresponding concurrent request reference amount is not within a preset range;

[0018] The control unit is also used to control each service to process concurrent requests with a set concurrent processing volume.

[0019] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0020] The memory stores computer-executable instructions;

[0021] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect.

[0022] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0023] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0024] The resource management method, device, storage medium and program product provided by the present application obtain the initial concurrent processing volume of each service and the number of threads in the thread pool; obtain the real-time concurrent request volume of each service and the concurrent request reference volume of each service; compare the real-time concurrent request volume of each service with the corresponding concurrent request reference volume; if the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within the preset range, then control each service to process concurrent requests with the corresponding initial concurrent processing volume; if the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within the preset range, then sum the real-time concurrent request volume of each service to obtain the total real-time concurrent request volume, and compare the total real-time concurrent request volume with the number of threads, set the concurrent processing volume of each service according to the comparison result, and control each service to process concurrent requests with the set concurrent processing volume. This embodiment reasonably controls resources from an overall perspective, making the concurrent processing volume of each service more reasonable, ensuring the stable use of resources while making full use of resources, avoiding insufficient resource allocation or waste of resources, and ensuring the stability of the system to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0026] Figure 1 A schematic diagram of a resource management method scenario provided in an embodiment of the present application;

[0027] Figure 2 A flowchart of a resource management method provided in one embodiment of the present application;

[0028] Figure 3 A flowchart of a resource management method provided by another embodiment of the present application;

[0029] Figure 4 A structural diagram of a resource management device provided in one embodiment of the present application;

[0030] Figure 5 A structural diagram of an electronic device provided in one embodiment of the present application.

[0031] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0033] First, the terms involved in this application are explained:

[0034] Distributed system: A software system built on a network with a high degree of cohesion and transparency. In layman's terms, it is a system composed of multiple stand-alone machines with the same performance specifications and code meanings.

[0035] Critical resources: There are many processes in a multiprogramming system, and they share various resources. However, many resources can only be used by one process at a time. Resources that are only allowed to be used by one process at a time are called critical resources. Many physical devices are critical resources, such as input machines, printers, tape drives, etc. The critical resources in this article are described from the perspective of the number of software threads. The underlying restrictions are also hardware. For example, when multiple threads connect to a database, the upper limit of the number of connections is the critical resource boundary of the database.

[0036] Distributed service calls are remote calls. Each service should run lightweight, that is, the service takes a short time to run. If the service takes a long time to run, it will occupy thread pool resources for a long time. When the service call concurrency increases suddenly, it is easy to cause full-link node congestion, thereby affecting the calls of other services and further causing the performance of the entire service cluster to degrade or even become unavailable as a whole.

[0037] In the prior art, each service in a distributed service may have concurrent call requests, and in concurrency management, a single service is usually configured with a concurrent processing capacity, that is, the maximum number of requests that can be processed simultaneously. When the number of concurrent requests exceeds the concurrent processing capacity, the excess concurrent requests are directly rejected, thereby avoiding the pressure on the use of critical resources.

[0038] In the prior art, the concurrent processing capacity of a single service is usually manually configured to meet certain critical resource management requirements. However, there may be problems such as insufficient resource allocation or resource waste for some core services, making it impossible to fully utilize resources.

[0039] In order to solve the above technical problems, an embodiment of the present application provides a resource management method to reasonably control resources from an overall perspective for the critical resources of a distributed system. Specifically, by obtaining the initial concurrent processing volume of each service and the number of threads in the thread pool; obtaining the real-time concurrent request volume of each service and the concurrent request reference volume of each service; comparing the real-time concurrent request volume of each service with the corresponding concurrent request reference volume; if the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within a preset range, then controlling each service to process concurrent requests with the corresponding initial concurrent processing volume; if the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within the preset range, then summing the real-time concurrent request volumes of each service to obtain the total real-time concurrent request volume, and comparing the total real-time concurrent request volume with the number of threads, setting the concurrent processing volume of each service according to the comparison result, and controlling each service to process concurrent requests with the set concurrent processing volume. This embodiment reasonably manages and controls resources from an overall perspective, making the concurrent processing volume of each service more reasonable, ensuring stable use of resources while making full use of resources, avoiding insufficient resource allocation or waste of resources, and ensuring the stability of the system to a certain extent.

[0040] The specific application scenarios of this application are as follows Figure 1 As shown, it includes multiple distributed services 101 to be managed, a server 102, and a concurrent database 105, and may also include a management platform 103 and / or a registration center 104; the server 102 may obtain the initial concurrent processing volume of each service and the number of threads in the thread pool by scanning the code annotation information or the target file, and / or from the management platform 103 and the registration center 104; obtain the real-time concurrent request volume of each service from the distributed service 101, and obtain the concurrent request reference volume of each service from the concurrent database 105; compare the real-time concurrent request volume of each service with the corresponding concurrent request volume If the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within the preset range, each service is controlled to process concurrent requests with the corresponding initial concurrent processing volume; if the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within the preset range, the real-time concurrent request volume of each service is summed to obtain the total real-time concurrent request volume, and the total real-time concurrent request volume is compared with the number of threads, and the concurrent processing volume of each service is set according to the comparison result, and each service is controlled to process concurrent requests with the set concurrent processing volume.

[0041] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0042] Figure 2 This is a flow chart of the resource management method provided in the embodiment of the present application. This embodiment provides a resource management method, the execution subject of which is an electronic device such as a server, and the specific steps of the resource management method are as follows:

[0043] S201. Obtain the initial concurrent processing capacity of each service and the number of threads in the thread pool.

[0044] In this embodiment, the concurrent processing capacity is the maximum number of service call requests that the service can process simultaneously. The initial concurrent processing capacity of each service is the initial concurrent processing capacity of each service. The initial concurrent processing capacity can be a preset concurrent processing capacity, such as the concurrent processing capacity of one or some services pre-set in the code annotation information or a certain file, which can be obtained through scanning and parsing; it can also be the concurrent processing capacity set by the user at any time, such as setting the concurrent processing capacity of one or some services through the management platform; it can also be the concurrent processing capacity pre-stored in the registration center, where the pre-stored concurrent processing capacity is the initial concurrent processing capacity of each service finally determined by the last resource management process.

[0045] The thread pool is a form of multithreaded processing, in which tasks are added to a queue during processing, and then automatically started after creating a thread. In this embodiment, the thread pool includes multiple threads, and for any service, one thread is started when processing one request, and multiple threads need to be started if multiple requests are processed at the same time.

[0046] More specifically, when obtaining the initial concurrent processing capacity of each service and the number of threads in the thread pool, the following may be included:

[0047] Obtain the initial concurrent processing capacity of each service and the number of threads in the thread pool by scanning code annotation information or target files; and / or

[0048] Receive the initial concurrent processing capacity of each service and the number of threads in the thread pool pushed by the management platform or registration center.

[0049] In this embodiment, the initial concurrent processing volume of each service and the number of threads in the thread pool can be obtained from different sources to provide data support for subsequent processing.

[0050] If the concurrent processing capacity of one or some services is pre-set in the code annotation information or target file, the code annotation information or target file can be scanned and parsed to obtain the initial concurrent processing capacity of each service; similarly, the number of threads in the thread pool can also be pre-set in the code annotation information or target file, and the number of threads in the thread pool can be obtained by scanning the code annotation information or target file.

[0051] In addition, if the user can set the concurrent processing capacity and / or the number of threads in the thread pool of one or some services through the management platform at any time, for example, it can be set in some emergency situations, the management platform can push the concurrent processing capacity and / or the number of threads in the thread pool of one or some services; if the concurrent processing capacity and / or the number of threads in the thread pool of each service is pre-stored in the registration center, where the pre-stored concurrent processing capacity is the initial concurrent processing capacity of each service finally determined by the last resource management process, the registration center can push the pre-stored concurrent processing capacity and / or the number of threads in the thread pool of each service.

[0052] It should be noted that if the initial concurrent processing volume of any service or the number of threads in the thread pool has multiple sources and are not equal, one can be selected according to the priority, among which the management platform has the highest priority, the registration center is the second, and the code annotation information or target file has the lowest priority. In addition, in the absence of conflicts, the sources of the initial concurrent processing volume of different services can have different combinations. For example, the initial concurrent processing volume of some services comes from scanning code annotation information, the initial concurrent processing volume of some services comes from scanning target files, the initial concurrent processing volume of some services comes from the management platform push, and the initial concurrent processing volume of some services comes from the registration center push. The combinations are not listed here one by one.

[0053] S202: Obtain the real-time concurrent request volume of each service and the concurrent request reference volume of each service.

[0054] In this embodiment, any service may receive multiple user requests at the same time during operation, and the number of requests is also the real-time concurrent request volume. The real-time concurrent request volume of the service can be calculated based on the transaction volume and TPS (Transaction Per Second). For example, the concurrent request volume of each device of the service at a certain moment can be counted and summarized, and the concurrent request volume at different moments can be averaged. The calculation frequency can be customized by the user, such as calculating once every half an hour. The real-time concurrent request volume of each service is stored in the concurrent number library.

[0055] The concurrent request reference volume of each service is a reference value for measuring the real-time concurrent request volume, and judging whether there is a sudden change in the real-time concurrent request volume. The concurrent request reference volume of any service can be the median, average or maximum value of the historical concurrent request volume of the service in the historical time period. The historical concurrent request volume in the historical time period can be obtained from the concurrent database, and the median, average or maximum value can be calculated. Of course, other values ​​can also be used to reflect the level of historical concurrent request volume, so as to provide a reference for judging whether there is a sudden change in the real-time concurrent request volume.

[0056] It should be noted that the order of S201 and S202 is not limited in this embodiment, and S201 and S202 can be executed simultaneously or in any order.

[0057] S203: Compare the real-time concurrent request volume of each service with the corresponding concurrent request reference volume.

[0058] In this embodiment, the real-time concurrent request amount is compared with the corresponding concurrent request reference amount. If the real-time concurrent request amount of each service is close to the corresponding concurrent request reference amount, S204 is executed. Otherwise, if the real-time concurrent request amount of at least one service is significantly different from the corresponding concurrent request reference amount, S205 is executed. Whether the real-time concurrent request amount is close to the corresponding concurrent request reference amount can determine whether the difference between the real-time concurrent request amount of the service and the corresponding concurrent request reference amount is within a preset range.

[0059] S204: If the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within a preset range, control each service to process concurrent requests with the corresponding initial concurrent processing volume.

[0060] In this embodiment, if the real-time concurrent request volume of each service is close to the corresponding concurrent request reference volume, it means that the real-time concurrent request volume of each service has not changed suddenly, and the concurrent processing volume of each service does not need to be adjusted, and the initial concurrent processing volume can be used to process concurrent requests.

[0061] S205. If the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within a preset range, the real-time concurrent request volumes of each service are summed to obtain the total real-time concurrent request volume, and the total real-time concurrent request volume is compared with the number of threads. The concurrent processing volume of each service is set according to the comparison result, and each service is controlled to process concurrent requests with the set concurrent processing volume.

[0062] In this embodiment, if the real-time concurrent request volume of at least one service is significantly different from the corresponding concurrent request reference volume, it means that the real-time concurrent request volume of at least one service has suddenly changed, and it is necessary to adjust the concurrent processing volume of each service to optimize the concurrent processing volume of each service as a whole, adapt to the sudden change in the real-time concurrent request volume of at least one service, and avoid insufficient resource allocation or waste of resources for core services.

[0063] Specifically, the real-time concurrent request volume of each service is summed up to obtain the total real-time concurrent request volume, and the total real-time concurrent request volume is compared with the number of threads in the thread pool. Since one thread in the thread pool can process one request and the number of threads in the thread pool is limited, the concurrent processing volume of each service can be reasonably allocated based on the comparison result of the total real-time concurrent request volume and the number of threads in the thread pool.

[0064] Optional, such as Figure 3As shown, the total amount of real-time concurrent requests is compared with the number of threads, and the concurrent processing amount of each service is set according to the comparison result, specifically including:

[0065] S301, comparing the total amount of real-time concurrent requests with the number of threads;

[0066] S302: If the total amount of real-time concurrent requests is not equal to the number of threads, the ratio of the real-time concurrent requests of each service is obtained, and the concurrent processing amount of each service is adjusted according to the ratio of the real-time concurrent requests of each service;

[0067] S303: If the total amount of real-time concurrent requests is equal to the number of threads, control each service to process concurrent requests with a corresponding initial concurrent processing amount.

[0068] In this embodiment, when the total amount of real-time concurrent requests is equal to the number of threads in the thread pool, the concurrent processing capacity of each service does not need to be adjusted, and the initial concurrent processing capacity is used to process concurrent requests. Of course, the concurrent processing capacity of each service can also be reconfigured according to the proportion of the real-time concurrent request capacity of each service to make full use of resources.

[0069] In the case where the total amount of real-time concurrent requests is not equal to the number of threads, that is, the total amount of real-time concurrent requests may be greater than or less than the number of threads, the concurrent processing volume of each service can be adjusted according to the proportion of the real-time concurrent request volume of each service, so as to reasonably manage resources from an overall perspective, make the concurrent processing volume of each service more reasonable, and fully utilize resources.

[0070] Specifically, if the total amount of real-time concurrent requests is less than the number of threads, the concurrent processing capacity of each service is increased in the same proportion according to the proportion of the real-time concurrent request amount of each service;

[0071] If the total amount of real-time concurrent requests is greater than the number of threads, the concurrent processing amount of each service is reduced in proportion to the amount of real-time concurrent requests of each service.

[0072] In the case where the total amount of real-time concurrent requests is less than the number of threads in the thread pool, there is a surplus of resources at this time, and the concurrent processing capacity of each service can be configured according to the real-time concurrent request capacity of each service, but the real-time concurrent request capacity of each service may fluctuate. In order to be able to be processed in a timely manner when the real-time concurrent request capacity increases, the concurrent processing capacity of each service can be increased in proportion to the proportion of the real-time concurrent request capacity of each service, and resources can also be fully utilized; in the case where the total amount of real-time concurrent requests is greater than the number of threads in the thread pool, there is a shortage of resources at this time, and the concurrent processing capacity of each service can still be configured according to the real-time concurrent request capacity of each service, but at this time there may be not enough threads in the thread pool to process the requests, so it is necessary to reduce the concurrent processing capacity of each service in proportion to the proportion of the real-time concurrent request capacity of each service, so that the concurrent requests of each service can be effectively processed. Of course, adjusting the concurrent processing capacity of each service according to the proportion of the real-time concurrent request capacity of each service is not limited to the above examples, and other methods are also possible, such as increasing or decreasing the concurrent processing capacity according to the proportion of the real-time concurrent request capacity of each service based on the initial concurrent processing capacity of each service.

[0073] After setting the concurrent processing volume of each service, the concurrent processing volume of each service may also be pushed to the registration center, so that the registration center can push it as the initial concurrent processing volume of each service when S201 is executed next time.

[0074] The resource management method provided in this embodiment obtains the initial concurrent processing volume of each service and the number of threads in the thread pool; obtains the real-time concurrent request volume of each service and the concurrent request reference volume of each service; compares the real-time concurrent request volume of each service with the corresponding concurrent request reference volume; if the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within the preset range, then controls each service to process concurrent requests with the corresponding initial concurrent processing volume; if the difference between the real-time concurrent request volume of at least one service and the corresponding concurrent request reference volume is not within the preset range, then sums the real-time concurrent request volume of each service to obtain the total real-time concurrent request volume, and compares the total real-time concurrent request volume with the number of threads, sets the concurrent processing volume of each service according to the comparison result, and controls each service to process concurrent requests with the set concurrent processing volume. This embodiment reasonably manages resources from an overall perspective, so that the concurrent processing volume of each service is more reasonable, and makes full use of resources while ensuring stable use of resources, avoiding insufficient resource allocation or waste of resources, and ensuring the stability of the system to a certain extent.

[0075] Based on the above embodiment, the method further includes:

[0076] If the difference between the real-time concurrent request amount and the corresponding concurrent request reference amount of any service is not within the preset range, the concurrent request reference amount of the service is adjusted according to the real-time concurrent request amount of the service, and is used as the concurrent request reference amount of the service when the concurrent request reference amount of each service is obtained when S202 is executed next time. For example, if the real-time concurrent request amount is greater than the corresponding concurrent request reference amount, the concurrent request reference amount is appropriately increased, or the historical concurrent request amount in a new historical time period is re-obtained to calculate the concurrent request reference amount, and the new historical time period includes the current moment; if the real-time concurrent request amount is less than the corresponding concurrent request reference amount, the concurrent request reference amount is appropriately reduced, or the historical concurrent request amount in a new historical time period is re-obtained to calculate the concurrent request reference amount, and the new historical time period includes the current moment.

[0077] Based on any of the above embodiments, the method further includes:

[0078] Obtain business indicators for each service, including but not limited to at least one of the following: transaction volume, peak interval, response time, business network type, etc.; classify and / or group each service according to the business indicators of each service and a preset grading algorithm.

[0079] For example, services can be divided into three levels: high, medium, and low. The preset grading algorithm can be to configure the value range of a certain indicator according to the three levels of high, medium, and low. For any service, it is determined in which value range its indicator is, and then the level corresponding to the value range is determined. Of course, other grading algorithms can also be used, which are not limited here.

[0080] In this embodiment, each service can be deployed according to its level, for example, high-level services can be deployed on high-performance devices, and low-level services can be deployed on low-performance devices; in addition, optionally, the service level can be determined in real time during service operation, and when the service level changes, the service can be dynamically redeployed.

[0081] Optionally, when setting the concurrent processing capacity of each service, the concurrent processing capacity of the service can also be adjusted according to the level of the service. That is, in the above embodiment, the concurrent processing capacity of each service is adjusted according to the proportion of real-time concurrent requests of each service and / or the level of the service. The concurrent processing capacity can be appropriately increased for high-level services and appropriately reduced for low-level services to ensure the stable operation of high-level services.

[0082] Figure 4 The resource management device provided in this embodiment can execute the processing flow provided in the resource management method embodiment, such as Figure 4As shown, the resource management device 400 includes: a first acquisition unit 401, a second acquisition unit 402, a comparison unit 403, a control unit 404 and a configuration unit 405.

[0083] The first acquisition unit 401 is used to acquire the initial concurrent processing volume of each service and the number of threads in the thread pool;

[0084] The second acquisition unit 402 is used to acquire the real-time concurrent request quantity of each service and the concurrent request reference quantity of each service;

[0085] A comparison unit 403, configured to compare the real-time concurrent request amount of each service with the corresponding concurrent request reference amount;

[0086] The control unit 404 is used to control each service to process concurrent requests with the corresponding initial concurrent processing amount if the difference between the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within a preset range;

[0087] The configuration unit 405 is configured to sum the real-time concurrent request amounts of each service to obtain the total real-time concurrent request amount, compare the total real-time concurrent request amount with the number of threads, and set the concurrent processing amount of each service according to the comparison result if the difference between the real-time concurrent request amount of at least one service and the corresponding concurrent request reference amount is not within a preset range,

[0088] The control unit 404 is further configured to control each service to process concurrent requests with a set concurrent processing volume.

[0089] In one or more embodiments of the present application, when setting the concurrent processing amount of each service according to the comparison result, the configuration unit 405 is used to:

[0090] If the total amount of real-time concurrent requests is not equal to the number of threads, the ratio of the real-time concurrent requests of each service is obtained, and the concurrent processing amount of each service is adjusted according to the ratio of the real-time concurrent requests of each service.

[0091] In one or more embodiments of the present application, when adjusting the concurrent processing volume of each service according to the ratio of the real-time concurrent request volume of each service, the configuration unit 405 is used to:

[0092] If the total amount of real-time concurrent requests is less than the number of threads, the concurrent processing capacity of each service is increased in proportion to the amount of real-time concurrent requests of each service;

[0093] If the total amount of real-time concurrent requests is greater than the number of threads, the concurrent processing amount of each service is reduced in proportion to the amount of real-time concurrent requests of each service.

[0094] In one or more embodiments of the present application, the control unit 404 is further configured to:

[0095] If the total amount of real-time concurrent requests is equal to the number of threads, each service is controlled to process concurrent requests with a corresponding initial concurrent processing amount.

[0096] In one or more embodiments of the present application, when acquiring the initial concurrent processing amount of each service and the number of threads in the thread pool, the first acquisition unit 401 is used to:

[0097] Obtain the initial concurrent processing capacity of each service and the number of threads in the thread pool by scanning code annotation information or target files; and / or

[0098] Receive the initial concurrent processing capacity of each service and the number of threads in the thread pool pushed by the management platform or registration center.

[0099] In one or more embodiments of the present application, when acquiring the reference amount of concurrent requests for each service, the second acquiring unit 402 is used to:

[0100] The median, average or maximum value of the historical concurrent request volume of any service in the historical time period is obtained, and the median, average or maximum value of the historical concurrent request volume is determined as the concurrent request reference volume of the service.

[0101] In one or more embodiments of the present application, the configuration unit 405 is further configured to:

[0102] If the difference between the real-time concurrent request volume of any service and the corresponding concurrent request reference volume is not within the preset range, the concurrent request reference volume of the service will be adjusted according to the real-time concurrent request volume of the service, and will be used as the concurrent request reference volume of the service when the concurrent request reference volume of each service is obtained next time.

[0103] The resource management device of the embodiment of the present application can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0104] Figure 5 FIG. 1 shows a hardware structure diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 is used to implement the operation corresponding to the electronic device in any of the above method embodiments. The electronic device 500 of this embodiment may include: a memory 501, a processor 502 and a communication interface 503.

[0105] The memory 501 is used to store computer programs. The memory 501 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk.

[0106] The processor 502 is used to execute the computer program stored in the memory to implement the method in the above embodiment. For details, please refer to the relevant description in the above method embodiment. The processor 502 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0107] Optionally, the memory 501 can be independent or integrated with the processor 502. When the memory 501 is a device independent of the processor 502, the electronic device 500 may further include a bus. The bus is used to connect the memory 501 and the processor 502. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0108] The communication interface 503 is used to receive or send requests and / or data.

[0109] The electronic device provided in this embodiment can be used to execute the method in the above embodiments. Its implementation method and technical effect are similar, and this embodiment will not be described in detail here.

[0110] In addition, this embodiment further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method described in the above embodiment.

[0111] In addition, this embodiment further provides a computer program product, including a computer program, and the computer program is executed by a processor to implement the method described in the above embodiment.

[0112] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0114] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0115] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0116] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0117] The above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, rather than to limit them. Although the embodiments of the present application are described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0118] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0119] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A resource management method, It is characterized in that include: Get the initial concurrent processing capacity of each service and the number of threads in the thread pool; Get the real-time concurrent request volume of each service and the reference volume of concurrent requests of each service; Compare the real-time concurrent request volume of each service with the corresponding concurrent request reference volume; If the difference between the real-time concurrent request volume of each service and the corresponding concurrent request reference volume is within a preset range, each service is controlled to process concurrent requests with the corresponding initial concurrent processing volume; If the difference between the real-time concurrent request amount of at least one service and the corresponding concurrent request reference amount is not within a preset range, the real-time concurrent request amounts of each service are summed to obtain the total real-time concurrent request amount, and the total real-time concurrent request amount is compared with the number of threads, and the concurrent processing amount of each service is set according to the comparison result, and each service is controlled to process concurrent requests with the set concurrent processing amount; The setting of the concurrent processing volume of each service according to the comparison result includes: If the total amount of real-time concurrent requests is not equal to the number of threads, the ratio of the real-time concurrent requests of each service is obtained, and the concurrent processing amount of each service is adjusted according to the ratio of the real-time concurrent requests of each service.

2. The method according to claim 1, It is characterized in that The method of adjusting the concurrent processing volume of each service according to the ratio of the real-time concurrent request volume of each service includes: If the total amount of real-time concurrent requests is less than the number of threads, the concurrent processing capacity of each service is increased in proportion to the amount of real-time concurrent requests of each service; If the total amount of real-time concurrent requests is greater than the number of threads, the concurrent processing amount of each service is reduced in proportion to the amount of real-time concurrent requests of each service.

3. The method according to any one of claims 1 to 2, It is characterized in that The method further comprises: If the total amount of real-time concurrent requests is equal to the number of threads, each service is controlled to process concurrent requests with a corresponding initial concurrent processing amount.

4. The method according to any one of claims 1 to 2, It is characterized in that The obtaining of the initial concurrent processing volume of each service and the number of threads in the thread pool includes: Obtain the initial concurrent processing capacity of each service and the number of threads in the thread pool by scanning code annotation information or target files; and / or Receive the initial concurrent processing capacity of each service and the number of threads in the thread pool pushed by the management platform or registration center.

5. The method according to any one of claims 1 to 2, It is characterized in that The obtaining of the concurrent request reference quantity of each service includes: The median, average or maximum value of the historical concurrent request volume of any service in the historical time period is obtained, and the median, average or maximum value of the historical concurrent request volume is determined as the concurrent request reference volume of the service.

6. The method according to claim 5, It is characterized in that The method further comprises: If the difference between the real-time concurrent request volume of any service and the corresponding concurrent request reference volume is not within the preset range, the concurrent request reference volume of the service will be adjusted according to the real-time concurrent request volume of the service, and will be used as the concurrent request reference volume of the service when the concurrent request reference volume of each service is obtained next time.

7. A resource management device, It is characterized in that include: A first acquisition unit is used to acquire the initial concurrent processing volume of each service and the number of threads in the thread pool; A second acquisition unit is used to acquire the real-time concurrent request volume of each service and the concurrent request reference volume of each service; A comparison unit, used to compare the real-time concurrent request amount of each service with the corresponding concurrent request reference amount; A control unit, configured to control each service to process concurrent requests with a corresponding initial concurrent processing amount if the difference between the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within a preset range; a configuration unit, configured to sum the real-time concurrent request amounts of each service to obtain a total real-time concurrent request amount, compare the total real-time concurrent request amount with the number of threads, and set the concurrent processing amount of each service according to the comparison result, if the difference between the real-time concurrent request amount of at least one service and the corresponding concurrent request reference amount is not within a preset range; The control unit is also used to control each service to process concurrent requests with the set concurrent processing volume; When setting the concurrent processing volume of each service according to the comparison result, the configuration unit is used to: if the total amount of real-time concurrent requests is not equal to the number of threads, obtain the ratio of the real-time concurrent requests of each service, and adjust the concurrent processing volume of each service according to the ratio of the real-time concurrent requests of each service.

8. The device according to claim 7, It is characterized in that When adjusting the concurrent processing volume of each service according to the ratio of the real-time concurrent request volume of each service, the configuration unit is used to: If the total amount of real-time concurrent requests is less than the number of threads, the concurrent processing capacity of each service is increased in proportion to the amount of real-time concurrent requests of each service; If the total amount of real-time concurrent requests is greater than the number of threads, the concurrent processing amount of each service is reduced in proportion to the amount of real-time concurrent requests of each service.

9. The device according to any one of claims 7 to 8, It is characterized in that The control unit is also used for: If the total amount of real-time concurrent requests is equal to the number of threads, each service is controlled to process concurrent requests with a corresponding initial concurrent processing amount.

10. An electronic device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.

11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.

12. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Patent Citations

  • Server concurrency control method, server concurrency control apparatus, computer device and storage medium

    CN108551465A

  • Service flow limiting method, device and system

    CN110830384A