CN114675973B - Resource management method, device, storage medium and program product - Google Patents
Resource management method, device, storage medium and program product Download PDFInfo
- Publication number
- CN114675973B CN114675973B CN202210462597.6A CN202210462597A CN114675973B CN 114675973 B CN114675973 B CN 114675973B CN 202210462597 A CN202210462597 A CN 202210462597A CN 114675973 B CN114675973 B CN 114675973B
- Authority
- CN
- China
- Prior art keywords
- service
- concurrent
- real
- time
- request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a resource management method, equipment, a storage medium and a program product, wherein the initial concurrent processing capacity of each service and the thread number of a thread pool are obtained; and if the difference value of the real-time concurrency request quantity of at least one service and the corresponding concurrency request reference quantity is not in the preset range, summing the real-time concurrency request quantity of each service to obtain the total real-time concurrency request quantity, setting the concurrency processing quantity of each service according to the comparison result of the total real-time concurrency request quantity and the thread number, and controlling each service to process the concurrency request with the set concurrency processing quantity. The resources are reasonably controlled from the whole angle, the concurrent processing capacity of each service is more reasonable, the stable use of the resources is ensured, the resources are fully utilized, and the system stability is ensured.
Description
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a resource management method, device, storage medium, and program product.
Background
The distributed service call is a remote call, each service should be run in a light weight, that is, the service running time is short, if the service is long, the thread pool resource is occupied for a long time, and when the service call is suddenly increased, the service call is easy to cause the blocking of all link nodes, thereby affecting the call of other services, and further causing the performance of the whole service cluster to be reduced or even the whole service cluster to be unavailable.
In the prior art, each service in the distributed service may have concurrent call requests, and in concurrent management and control, the concurrent processing amount, that is, the maximum number of requests processed simultaneously, is generally configured for a single service, and when the concurrent request amount exceeds the concurrent processing amount, the exceeding concurrent request is directly refused, so that the use pressure of critical resources is avoided.
In the prior art, the concurrent processing capacity is usually configured manually for a single service, so that certain critical resource management and control requirements are met, but the problems of insufficient resource allocation or resource waste and the like of certain core services possibly exist, and the full utilization of resources cannot be realized.
Disclosure of Invention
The application provides a resource management method, equipment, a storage medium and a program product, which are used for reasonably controlling resources from the whole angle, so that the concurrent processing capacity of each service is more reasonable.
In a first aspect, the present application provides a resource management method, including:
acquiring initial concurrent processing capacity of each service and thread number of a thread pool;
acquiring real-time concurrent request quantity of each service and concurrent request reference quantity of each service;
comparing the real-time concurrent request quantity of each service with the corresponding concurrent request reference quantity;
if the difference value between the real-time concurrent request quantity of each service and the corresponding concurrent request reference quantity is within a preset range, controlling each service to process the concurrent request according to the corresponding initial concurrent processing quantity;
If the difference value between the real-time concurrent request quantity of at least one service and the corresponding concurrent request reference quantity is not in the preset range, summing the real-time concurrent request quantity of each service to obtain the total real-time concurrent request quantity, comparing the total real-time concurrent request quantity with the thread quantity, setting the concurrent processing quantity of each service according to the comparison result, and controlling each service to process the concurrent request with the set concurrent processing quantity.
In a second aspect, the present application provides a resource management device comprising:
the first acquisition unit is used for acquiring the initial concurrent processing amount of each service and the thread number of the thread pool;
the second acquisition unit is used for acquiring the real-time concurrent request quantity of each service and the concurrent request reference quantity of each service;
The comparison unit is used for comparing the real-time concurrent request quantity of each service with the corresponding concurrent request reference quantity;
The control unit is used for controlling each service to process the concurrent request according to the corresponding initial concurrent processing amount if the difference value between the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within the preset range;
A configuration unit, configured to sum the real-time concurrent request amounts of the services to obtain a total real-time concurrent request amount 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, compare the total real-time concurrent request amount with the thread number, set the concurrent processing amount of each service according to the comparison result,
The control unit is also used for controlling each service to process the concurrent request according to the set concurrent processing capacity.
In a third aspect, the present application provides an electronic device comprising a processor, and a memory communicatively coupled to the processor;
The memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method as described in the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for performing the method according to the first aspect when executed by a processor.
In a fifth aspect, the application provides a computer program product comprising a computer program which, when executed by a processor, implements the method according to the first aspect.
The resource management method, the device, the storage medium and the program product provided by the application are characterized by acquiring initial concurrent processing capacity of each service and thread number of a thread pool, acquiring real-time concurrent request capacity of each service and concurrent request reference capacity of each service, comparing the real-time concurrent request capacity of each service with the corresponding concurrent request reference capacity, controlling each service to process concurrent requests according to the corresponding initial concurrent processing capacity if the difference value between the real-time concurrent request capacity of each service and the corresponding concurrent request reference capacity is within a preset range, summing the real-time concurrent request capacity of each service to acquire the total real-time concurrent request capacity if the difference value between the real-time concurrent request capacity of at least one service and the corresponding concurrent request reference capacity is not within the preset range, comparing the total real-time concurrent request capacity with the thread number, setting the concurrent processing capacity of each service according to the comparison result, and controlling each service to process the set concurrent processing capacity. The embodiment reasonably manages and controls the resources from the whole angle, so that the concurrent processing amount of each service is more reasonable, the resources are fully utilized while the stable use of the resources is ensured, the occurrence of insufficient resource allocation or resource waste is avoided, and the stability of the system is ensured to a certain extent.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic diagram of a resource management method according to an embodiment of the present application;
FIG. 2 is a flowchart of a resource management method according to an embodiment of the present application;
FIG. 3 is a flowchart of a resource management method according to another embodiment of the present application;
FIG. 4 is a block diagram of a resource management device according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
First, the terms involved in the present application will be explained:
distributed system-software system built on network has high cohesiveness and transparency, and is a system composed of several single units with same performance specification and code meaning.
Critical resources-there are many processes in a multiprogramming system that share various resources, however, there are many resources available to only one process at a time. The resources that only one process is allowed to use at a time are called critical resources. Many physical devices belong to critical resources such as input machines, printers, tape drives, etc. The critical resources are described in terms of software threads, the bottom limitation is hardware, such as a plurality of threads are connected with a database, and the upper line of the connection number is the critical resource boundary of the database.
The distributed service call is a remote call, each service should be run in a light weight, that is, the service running time is short, if the service is long, the thread pool resource is occupied for a long time, and when the service call is suddenly increased, the service call is easy to cause the blocking of all link nodes, thereby affecting the call of other services, and further causing the performance of the whole service cluster to be reduced or even the whole service cluster to be unavailable.
In the prior art, each service in the distributed service may have concurrent call requests, and in concurrent management and control, the concurrent processing amount, that is, the maximum number of requests processed simultaneously, is generally configured for a single service, and when the concurrent request amount exceeds the concurrent processing amount, the exceeding concurrent request is directly refused, so that the use pressure of critical resources is avoided.
In the prior art, the concurrent processing capacity is usually configured manually for a single service, so that certain critical resource management and control requirements are met, but the problems of insufficient resource allocation or resource waste and the like of certain core services possibly exist, and the full utilization of resources cannot be realized.
In order to solve the technical problems, the embodiment of the application provides a resource management method, which is used for reasonably controlling resources from an overall perspective aiming at critical resources of a distributed system, specifically, obtaining the initial concurrent processing amount of each service and the thread number of a thread pool, obtaining the real-time concurrent request amount of each service and the concurrent request reference amount of each service, comparing the real-time concurrent request amount of each service with the corresponding concurrent request reference amount, controlling each service to process concurrent requests according to the corresponding initial concurrent processing amount if the difference value of the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within a preset range, summing the real-time concurrent request amount of each service to obtain the total real-time concurrent request amount, comparing the total real-time concurrent request amount with the thread number, setting the concurrent processing amount of each service according to the comparison result, and controlling the processing of the concurrent request of each service after setting. The embodiment reasonably manages and controls the resources from the whole angle, so that the concurrent processing amount of each service is more reasonable, the resources are fully utilized while the stable use of the resources is ensured, the occurrence of insufficient resource allocation or resource waste is avoided, and the stability of the system is ensured to a certain extent.
The specific application scenario of the present application is shown in fig. 1, and includes a plurality of distributed services 101, a server 102, and a concurrency database 105 to be resource managed, and may further include a management platform 103 and/or a registration center 104, where the server 102 may obtain an initial concurrency processing amount of each service and a thread number of a thread pool by scanning a scan code annotation information or a target file and/or from the management platform 103 and the registration center 104, obtain a real-time concurrency request amount of each service from the distributed services 101, obtain a concurrency request reference amount of each service from the concurrency database 105, compare the real-time concurrency request amount of each service with a corresponding concurrency request reference amount, if a difference value between the real-time concurrency request amount of each service and the corresponding concurrency request reference amount is within a preset range, control each service to process a corresponding initial concurrency request, and if a difference value between the real-time concurrency request amount of at least one service and the corresponding concurrency request reference amount is not within the preset range, sum the real-time concurrency request amount of each service to obtain a real-time concurrency request total amount, and compare the concurrency request total amount with the corresponding concurrency request reference amount and control result to set up the service to process the corresponding concurrency request.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of a resource management method according to an embodiment of the present application. The embodiment provides a resource management method, an execution subject of which is electronic equipment such as a server, and the like, and the resource management method specifically comprises the following steps:
s201, obtaining initial concurrent processing capacity of each service and thread number of a thread pool.
In this embodiment, the concurrent processing amount is the number of requests called by the service that can be processed simultaneously and the maximum concurrent processing amount of the service is the initial concurrent processing amount of each service, where the initial concurrent processing amount may be a preset concurrent processing amount, for example, the concurrent processing amount of a certain service or a certain service is preset in code annotation information or a certain file, and may be obtained through scanning and parsing, or the concurrent processing amount set by the user at any time, for example, the concurrent processing amount of a certain service or a certain service is set through a management platform, or the concurrent processing amount pre-stored in a registry, where the pre-stored concurrent processing amount is the initial concurrent processing amount of each service finally determined in the last resource management process.
Thread pools are a form of multi-threaded processing in which tasks are added to a queue and then automatically started after a thread is created. In this embodiment, the thread pool includes a plurality of threads, and for any service, one thread is started when one request is processed, and if a plurality of requests are processed simultaneously, a plurality of threads are started.
More specifically, when acquiring the initial concurrent processing amount of each service and the thread number of the thread pool, the method may include:
Acquiring initial concurrent processing amount of each service and thread number of thread pool by scanning code annotation information or target file, and/or
Initial concurrent processing amount of each service pushed by the management platform or the registry and thread number of the thread pool are received.
In this embodiment, the initial concurrent throughput of each service, and the number of threads in the thread pool, may be obtained from different sources to provide data support for subsequent processing.
If the concurrent processing capacity of a certain service or a certain service is preset in the code annotation information or the target file, the code annotation information or the target file can be analyzed by scanning the code annotation information or the target file to obtain the initial concurrent processing capacity of each service, and similarly, the thread number of the thread pool can be preset in the code annotation information or the target file, and the thread number of the thread pool can be obtained by scanning the code annotation information or the target file.
In addition, if the user sets the concurrent processing amount of a certain service or certain services and/or the thread number of the thread pool through the management platform at any time, for example, the management platform can set the concurrent processing amount of the certain service or certain services and/or the thread number of the thread pool in some emergency situations, if the concurrent processing amount of each service and/or the thread number of the thread pool is pre-stored in the registry, the pre-stored concurrent processing amount is the initial concurrent processing amount of each service finally determined in the last resource management process, and the registry can push the pre-stored concurrent processing amount of each service and/or the thread number of the thread pool.
If the number of threads in the thread pool or the initial concurrent processing amount of any service is different from that of the initial concurrent processing amount of any service, one of the plurality of threads may be selected according to the priority, wherein the priority of the management platform is the highest, the priority of the registry is the next lowest, and the code annotation information or the target file is the lowest. In addition, the sources of the initial concurrent processing amounts of different services can be combined differently without collision, for example, the initial concurrent processing amounts of some services are derived from the scan code annotation information, the initial concurrent processing amounts of some services are derived from the scan target file, the initial concurrent processing amounts of some services are derived from the management platform push, the initial concurrent processing amounts of some services are derived from the registry push, and the combination modes are not listed here.
S202, acquiring real-time concurrent request quantity of each service and concurrent request reference quantity of each service.
In this embodiment, for any service, a number of user requests, that is, real-time concurrency request amounts, may be received simultaneously at runtime, and the real-time concurrency request amounts of the service may be calculated according to the transaction amounts and TPS (Transaction Per Second, transaction amounts per second), for example, the concurrency request amounts of devices served at a certain moment are counted and summarized, the concurrency request amounts at different moments may be averaged, and the calculation frequency may be customized by the user, for example, calculated once every half hour. The real-time concurrency request amount of each service is stored in a concurrency database.
The concurrency request reference quantity of each service is a reference value for measuring the real-time concurrency request quantity, judging whether the real-time concurrency request quantity has mutation, wherein the concurrency request reference quantity of any service can be a median value, an average value or a maximum value of the historical concurrency request quantity of the service in a historical time period, the historical concurrency request quantity in the historical time period can be obtained from a concurrency database, and the median value, the average value or the maximum value can be calculated, or other values can be used for reflecting the level of the historical concurrency request quantity, so that a reference is provided for judging whether the real-time concurrency request quantity has mutation.
Note that, in this embodiment, the order of S201 and S202 is not limited, and S201 and S202 may be executed simultaneously or in any order.
S203, comparing the real-time concurrent request quantity of each service with the corresponding concurrent request reference quantity.
In this embodiment, the real-time concurrency request quantity is compared with the corresponding concurrency request reference quantity, if the real-time concurrency request quantity of each service is close to the corresponding concurrency request reference quantity, S204 is executed, otherwise, if the real-time concurrency request quantity of at least one service is relatively large in difference from the corresponding concurrency request reference quantity, S205 is executed. Whether the real-time concurrent request quantity and the corresponding concurrent request reference quantity are close to each other or not can be judged, and whether the difference value between the real-time concurrent request quantity of the service and the corresponding concurrent request reference quantity is within a preset range or not can be judged.
S204, if the difference value between the real-time concurrent request quantity of each service and the corresponding concurrent request reference quantity is within a preset range, controlling each service to process the concurrent request according to the corresponding initial concurrent processing quantity.
In this embodiment, if the real-time concurrency request amount of each service is close to the corresponding concurrency request reference amount, it is indicated that no mutation occurs in the real-time concurrency request amount of each service, and the concurrency request processing can be performed by using the initial concurrency processing amount without adjusting the concurrency processing amount of each service.
S205, if the difference value between the real-time concurrent request quantity of at least one service and the corresponding concurrent request reference quantity is not in the preset range, summing the real-time concurrent request quantity of each service to obtain the total real-time concurrent request quantity, comparing the total real-time concurrent request quantity with the thread quantity, setting the concurrent processing quantity of each service according to the comparison result, and controlling each service to process the concurrent request according to the set concurrent processing quantity.
In this embodiment, if the difference between the real-time concurrency request quantity of at least one service and the corresponding concurrency request reference quantity is relatively large, it is indicated that the real-time concurrency request quantity of at least one service is suddenly changed, and the concurrency processing quantity of each service needs to be adjusted to optimize the concurrency processing quantity of each service as a whole, so as to adapt to the sudden change of the real-time concurrency request quantity of at least one service, and avoid the shortage of core service allocation resources or resource waste.
Specifically, the real-time concurrent request amounts of the services are summed to obtain a real-time concurrent request total amount, and the real-time concurrent request total amount is compared with the thread number of the thread pool.
Optionally, as shown in fig. 3, comparing the total real-time concurrent request with the thread number, and setting the concurrent processing amount of each service according to the comparison result, which specifically includes:
S301, comparing the total real-time concurrent request amount with the thread number;
s302, if the total real-time concurrent request amount is not equal to the thread number, acquiring the proportion of the real-time concurrent request amount of each service, and adjusting the concurrent processing amount of each service according to the proportion of the real-time concurrent request amount of each service;
and S303, if the total quantity of the real-time concurrent requests is equal to the thread quantity, controlling each service to process the concurrent requests according to the corresponding initial concurrent processing quantity.
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 amount of each service may not be adjusted, and the initial concurrent processing amount may be used to process the concurrent requests, or the concurrent processing amount of each service may be reconfigured according to the ratio of the real-time concurrent request amount of each service, so that the resources may be fully utilized.
In the case that the total amount of the real-time concurrent requests is not equal to the number of threads, that is, the total amount of the real-time concurrent requests may be larger or smaller than the number of threads, the concurrent processing amount of each service may be adjusted according to the proportion of the real-time concurrent request amount of each service, so that resources are reasonably managed and controlled from the overall angle, the concurrent processing amount of each service is more reasonable, and the resources are fully utilized.
Specifically, if the total real-time concurrent request amount is smaller than the thread number, the concurrent processing amount of each service is increased in the same proportion according to the proportion of the real-time concurrent request amount of each service;
And if the total quantity of the real-time concurrent requests is larger than the thread quantity, reducing the concurrent processing quantity of each service according to the proportion of the real-time concurrent request quantity of each service in the same proportion.
In the case that the total amount of the real-time concurrent requests is smaller than the number of threads of the thread pool, resources remain, the concurrent processing amount of each service can be configured according to the real-time concurrent request amount of each service, but the real-time concurrent request amount of each service may fluctuate, so that the concurrent processing amount of each service can be reduced according to the proportion of the real-time concurrent request amount of each service in order to be timely processed under the condition that the real-time concurrent request amount is increased, the resources can be fully utilized, and in the case that the total amount of the real-time concurrent requests is larger than the number of threads of the thread pool, the resources are insufficient, the concurrent processing amount of each service still can be configured according to the real-time concurrent request amount of each service, but at the moment, no sufficient threads exist in the thread pool to process the requests, and therefore the concurrent processing amount of each service needs to be reduced according to the proportion of the real-time concurrent request amount of each service in the same proportion, and the concurrent request of each service can be effectively processed. Of course, the concurrent processing amount of each service is not limited to the above example, and other methods may be adopted, such as increasing or decreasing the concurrent processing amount of each service according to the ratio of the real-time concurrent request amount of each service in addition to the initial concurrent processing amount of each service.
After setting the concurrent processing amount of each service, the concurrent processing amount of each service may be further pushed to the registry, so that the registry may push as the initial concurrent processing amount of each service when S201 is executed next time.
The resource management method includes the steps of obtaining initial concurrent processing amounts of all services and thread numbers of a thread pool, obtaining real-time concurrent request amounts of all services and concurrent request reference amounts of all services, comparing the real-time concurrent request amounts of all services with corresponding concurrent request reference amounts, controlling all services to process concurrent requests according to the corresponding initial concurrent processing amounts if differences between the real-time concurrent request amounts of all services and the corresponding concurrent request reference amounts are within a preset range, summing the real-time concurrent request amounts of all services to obtain real-time concurrent request total amounts if differences between the real-time concurrent request amounts of at least one service and the corresponding concurrent request reference amounts are not within the preset range, comparing the real-time concurrent request total amounts with the thread numbers, setting the concurrent processing amounts of all services according to comparison results, and controlling all services to process the concurrent requests according to the set concurrent processing amounts. The embodiment reasonably manages and controls the resources from the whole angle, so that the concurrent processing amount of each service is more reasonable, the resources are fully utilized while the stable use of the resources is ensured, the occurrence of insufficient resource allocation or resource waste is avoided, and the stability of the system is ensured to a certain extent.
On the basis of the above embodiment, the method further includes:
If the difference value between the real-time concurrency request quantity of any service and the corresponding concurrency request reference quantity is not in the preset range, the concurrency request reference quantity of the service is adjusted according to the real-time concurrency request quantity of the service, and the real-time concurrency request quantity is used as the concurrency request reference quantity of the service when the concurrency request reference quantity of each service is acquired when the step S202 is executed next time. For example, if the real-time concurrency request is greater than the corresponding concurrency request, the concurrency request is appropriately increased, or the concurrency request is newly obtained in a new historical time period, which includes the current time, and if the real-time concurrency request is less than the corresponding concurrency request, the concurrency request is appropriately decreased, or the concurrency request is newly obtained in a new historical time period, which includes the current time.
On the basis of any of the above embodiments, the method further includes:
the method comprises the steps of obtaining business indexes of each service, wherein the business indexes comprise at least one of transaction amount, peak value interval, response time consumption, business network type and the like, and grading and/or grouping each service according to the business indexes of each service and a preset grading algorithm.
For example, the service may be divided into three levels, i.e., high, medium and low, and the preset classification algorithm may configure a value range for a certain index according to the three levels, i.e., high, medium and low, and determine which value range the index is in for any service, and then determine the level corresponding to the value range. Of course, other classification algorithms may be used, and are not limited herein.
In this embodiment, each service may be deployed according to the class of each service, for example, a high-class service is deployed on a high-performance device, and a low-class service is deployed on a low-performance device; in addition, optionally, during the service running process, the service grade can be judged in real time, and when the service grade changes, the service can be dynamically redeployed.
Optionally, when setting the concurrent processing amount of each service, the concurrent processing amount of the service may be adjusted according to the service level, that is, in the above embodiment, the concurrent processing amount of each service is adjusted according to the proportion of the real-time concurrent request amount of each service and/or the service level, so that the concurrent processing amount of each service may be increased appropriately for a high-level service, the concurrent processing amount may be reduced appropriately for a low-level service, and stable operation of the high-level service is ensured.
Fig. 4 is a block diagram of a resource management device according to an embodiment of the present application. The resource management device provided in this embodiment may execute the processing flow provided in the resource management method embodiment, as shown in fig. 4, where the resource management device 400 includes a first obtaining unit 401, a second obtaining unit 402, a comparing unit 403, a control unit 404, and a configuration unit 405.
A first obtaining unit 401, configured to obtain an initial concurrent processing amount of each service and a thread number of a thread pool;
A second obtaining unit 402, configured to obtain a real-time concurrency request amount of each service and a concurrency request reference amount of each service;
a comparison unit 403, configured to compare the real-time concurrency request quantity of each service with the corresponding concurrency request reference quantity;
The control unit 404 is configured to control each service to perform processing of the concurrent request according to 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;
a configuration unit 405, configured to sum the real-time concurrency request amounts of the services to obtain a real-time concurrency request total amount if the difference between the real-time concurrency request amount of at least one service and the corresponding concurrency request reference amount is not within a preset range, compare the real-time concurrency request total amount with the thread number, set the concurrency processing amount of each service according to the comparison result,
The control unit 404 is further configured to control each service to perform processing of the concurrent request with the set concurrent processing amount.
In one or more embodiments of the present application, the configuration unit 405, when setting the concurrent throughput of each service according to the comparison result, is configured to:
And if the total real-time concurrent request amount is not equal to the thread number, acquiring the proportion of the real-time concurrent request amount of each service, and adjusting the concurrent processing amount of each service according to the proportion of the real-time concurrent request amount of each service.
In one or more embodiments of the present application, the configuration unit 405 is configured to, when adjusting the concurrent throughput of each service according to the ratio of the real-time concurrent request amounts of each service:
If the total real-time concurrent request amount is smaller than the thread number, the concurrent processing amount of each service is increased in the same proportion according to the proportion of the real-time concurrent request amount of each service;
And if the total quantity of the real-time concurrent requests is larger than the thread quantity, reducing the concurrent processing quantity of each service according to the proportion of the real-time concurrent request quantity of each service in the same proportion.
In one or more embodiments of the application, the control unit 404 is further configured to:
and if the total quantity of the real-time concurrent requests is equal to the thread quantity, controlling each service to process the concurrent requests according to the corresponding initial concurrent processing quantity.
In one or more embodiments of the present application, the first obtaining unit 401, when obtaining an initial concurrent processing amount of each service and a thread number of a thread pool, is configured to:
Acquiring initial concurrent processing amount of each service and thread number of thread pool by scanning code annotation information or target file, and/or
Initial concurrent processing amount of each service pushed by the management platform or the registry and thread number of the thread pool are received.
In one or more embodiments of the present application, the second obtaining unit 402 is configured, when obtaining the concurrency request reference quantity of each service, to:
And acquiring the median, average or maximum value of the historical concurrent request quantity of any service in the historical time period, and determining the median, average or maximum value of the historical concurrent request quantity as the concurrent request reference quantity of the service.
In one or more embodiments of the present application, the configuration unit 405 is further configured to:
If the difference value between the real-time concurrent request quantity of any service and the corresponding concurrent request reference quantity is not in the preset range, the concurrent request reference quantity of the service is adjusted according to the real-time concurrent request quantity of the service, and the real-time concurrent request quantity is used as the concurrent request reference quantity of each service when the concurrent request reference quantity of each service is acquired next time.
The resource management device of the embodiment of the present application may be used to implement the technical solution of the embodiment of the method, and its implementation principle and technical effects are similar, and are not described herein again.
Fig. 5 shows a schematic hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic device 500, for implementing the operations 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.
A memory 501 for storing a computer program. The Memory 501 may include a high-speed random access Memory (Random Access Memory, RAM), and may further include a Non-Volatile Memory (NVM), such as at least one magnetic disk Memory, and may also be a U-disk, a removable hard disk, a read-only Memory, a magnetic disk, or an optical disk.
The processor 502 is configured to execute the computer program stored in the memory to implement the method in the foregoing embodiment, and specific reference may be made to the description in the foregoing method embodiment. The Processor 502 may be a central processing unit (Central Processing Unit, CPU), or may be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application specific integrated circuits (Application Specific IntegratedCircuit, ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
Alternatively, the memory 501 may be separate or integrated with the processor 502. When memory 501 is a separate device from processor 502, electronic device 500 may also include a bus. The bus is used to connect the memory 501 and the processor 502. The bus may be an industry standard architecture (IndustryStandard Architecture, ISA) bus, peripheral interconnect (Peripheral ComponentInterconnect, PCI) bus, or an extended industry standard architecture (Extended Industry StandardArchitecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
A communication interface 503 for receiving or transmitting requests and/or data.
The electronic device provided in this embodiment may be used to execute the method in the foregoing embodiment, and its implementation manner and technical effects are similar, which is not described herein.
In addition, the present embodiment also provides a computer-readable storage medium having stored thereon a computer program that is executed by a processor to implement the method described in the above embodiments.
In addition, the present embodiment also provides a computer program product, including a computer program, where the computer program is executed by a processor to implement the method described in the foregoing embodiment.
In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform part of the steps of the methods described in the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above. The specific working process of the above-described device may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Although the embodiments of the present application have been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the foregoing embodiments may be modified or some and all of the technical features may be equivalently replaced, and that the modifications and substitutions do not depart from the scope of the technical solutions of the embodiments of the present application.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.
Claims (12)
1. A method of resource management, comprising:
acquiring initial concurrent processing capacity of each service and thread number of a thread pool;
acquiring real-time concurrent request quantity of each service and concurrent request reference quantity of each service;
comparing the real-time concurrent request quantity of each service with the corresponding concurrent request reference quantity;
if the difference value between the real-time concurrent request quantity of each service and the corresponding concurrent request reference quantity is within a preset range, controlling each service to process the concurrent request according to the corresponding initial concurrent processing quantity;
If the difference value between the real-time concurrent request quantity of at least one service and the corresponding concurrent request reference quantity is not in the preset range, summing the real-time concurrent request quantity of each service to obtain the total real-time concurrent request quantity, comparing the total real-time concurrent request quantity with the thread quantity, setting the concurrent processing quantity of each service according to the comparison result, and controlling each service to process the concurrent request with the set concurrent processing quantity;
the setting the concurrent processing amount of each service according to the comparison result comprises the following steps:
And if the total real-time concurrent request amount is not equal to the thread number, acquiring the proportion of the real-time concurrent request amount of each service, and adjusting the concurrent processing amount of each service according to the proportion of the real-time concurrent request amount of each service.
2. The method of claim 1, wherein said adjusting the concurrent throughput of each service according to the ratio of the real-time concurrent request throughput of each service comprises:
If the total real-time concurrent request amount is smaller than the thread number, the concurrent processing amount of each service is increased in the same proportion according to the proportion of the real-time concurrent request amount of each service;
And if the total quantity of the real-time concurrent requests is larger than the thread quantity, reducing the concurrent processing quantity of each service according to the proportion of the real-time concurrent request quantity of each service in the same proportion.
3. The method according to any one of claims 1-2, wherein the method further comprises:
and if the total quantity of the real-time concurrent requests is equal to the thread quantity, controlling each service to process the concurrent requests according to the corresponding initial concurrent processing quantity.
4. The method according to any one of claims 1-2, wherein the obtaining initial concurrent throughput for each service and the number of threads for a thread pool comprises:
Acquiring initial concurrent processing amount of each service and thread number of thread pool by scanning code annotation information or target file, and/or
Initial concurrent processing amount of each service pushed by the management platform or the registry and thread number of the thread pool are received.
5. The method according to any one of claims 1-2, wherein said obtaining the concurrent request reference for each service comprises:
And acquiring the median, average or maximum value of the historical concurrent request quantity of any service in the historical time period, and determining the median, average or maximum value of the historical concurrent request quantity as the concurrent request reference quantity of the service.
6. The method of claim 5, wherein the method further comprises:
If the difference value between the real-time concurrent request quantity of any service and the corresponding concurrent request reference quantity is not in the preset range, the concurrent request reference quantity of the service is adjusted according to the real-time concurrent request quantity of the service, and the real-time concurrent request quantity is used as the concurrent request reference quantity of each service when the concurrent request reference quantity of each service is acquired next time.
7. A resource management apparatus, characterized by comprising:
the first acquisition unit is used for acquiring the initial concurrent processing amount of each service and the thread number of the thread pool;
the second acquisition unit is used for acquiring the real-time concurrent request quantity of each service and the concurrent request reference quantity of each service;
The comparison unit is used for comparing the real-time concurrent request quantity of each service with the corresponding concurrent request reference quantity;
The control unit is used for controlling each service to process the concurrent request according to the corresponding initial concurrent processing amount if the difference value between the real-time concurrent request amount of each service and the corresponding concurrent request reference amount is within the preset range;
A configuration unit, configured to sum the real-time concurrent request amounts of the services to obtain a total real-time concurrent request amount 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, compare the total real-time concurrent request amount with the thread number, set the concurrent processing amount of each service according to the comparison result,
The control unit is also used for controlling each service to process the concurrent request according to the set concurrent processing capacity;
And the configuration unit is used for acquiring the proportion of the real-time concurrent request quantity of each service if the total real-time concurrent request quantity is not equal to the thread quantity and adjusting the concurrent processing quantity of each service according to the proportion of the real-time concurrent request quantity of each service when the concurrent processing quantity of each service is set according to the comparison result.
8. The apparatus according to claim 7, wherein the configuration unit, when adjusting the concurrent processing amount of each service according to the ratio of the real-time concurrent request amount of each service, is configured to:
If the total real-time concurrent request amount is smaller than the thread number, the concurrent processing amount of each service is increased in the same proportion according to the proportion of the real-time concurrent request amount of each service;
And if the total quantity of the real-time concurrent requests is larger than the thread quantity, reducing the concurrent processing quantity of each service according to the proportion of the real-time concurrent request quantity of each service in the same proportion.
9. The apparatus according to any one of claims 7-8, wherein the control unit is further configured to:
and if the total quantity of the real-time concurrent requests is equal to the thread quantity, controlling each service to process the concurrent requests according to the corresponding initial concurrent processing quantity.
10. An electronic device comprising a processor and a memory communicatively coupled to the processor;
The memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1-6.
11. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1-6.
12. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210462597.6A CN114675973B (en) | 2022-04-28 | 2022-04-28 | Resource management method, device, storage medium and program product |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210462597.6A CN114675973B (en) | 2022-04-28 | 2022-04-28 | Resource management method, device, storage medium and program product |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114675973A CN114675973A (en) | 2022-06-28 |
| CN114675973B true CN114675973B (en) | 2025-06-06 |
Family
ID=82080369
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210462597.6A Active CN114675973B (en) | 2022-04-28 | 2022-04-28 | Resource management method, device, storage medium and program product |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114675973B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117221331B (en) * | 2023-11-08 | 2024-01-19 | 成都新希望金融信息有限公司 | Multi-channel grouping concurrency configuration method |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108551465A (en) * | 2018-03-09 | 2018-09-18 | 平安科技(深圳)有限公司 | The concurrent digital control method of server, device, computer equipment and storage medium |
| CN110830384A (en) * | 2019-09-30 | 2020-02-21 | 浙江口碑网络技术有限公司 | Method, device and system for limiting service flow |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107800768B (en) * | 2017-09-13 | 2020-01-10 | 平安科技(深圳)有限公司 | Open platform control method and system |
| CN113794650B (en) * | 2021-09-16 | 2024-06-21 | 深圳平安智慧医健科技有限公司 | Concurrent request processing method, computer device and computer readable storage medium |
-
2022
- 2022-04-28 CN CN202210462597.6A patent/CN114675973B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108551465A (en) * | 2018-03-09 | 2018-09-18 | 平安科技(深圳)有限公司 | The concurrent digital control method of server, device, computer equipment and storage medium |
| CN110830384A (en) * | 2019-09-30 | 2020-02-21 | 浙江口碑网络技术有限公司 | Method, device and system for limiting service flow |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114675973A (en) | 2022-06-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10772115B2 (en) | Resource scheduling method and server | |
| CN111966500B (en) | Resource scheduling method and device, electronic equipment and storage medium | |
| US20180337984A1 (en) | Method and apparatus for managing resource on cloud platform | |
| EP4383074A1 (en) | Service processing method and apparatus, server, storage medium, and computer program product | |
| CN112600887B (en) | Computing power management method and device | |
| EP2725862A1 (en) | Resource allocation method and resource management platform | |
| CN109783237A (en) | A kind of resource allocation method and device | |
| CN108776934A (en) | Distributed data computational methods, device, computer equipment and readable storage medium storing program for executing | |
| CN112486642B (en) | Resource scheduling method, device, electronic equipment and computer readable storage medium | |
| CN114217977B (en) | Resource allocation method, device, equipment and storage medium | |
| CN106569898A (en) | Resource distribution method and mobile terminal | |
| CN113032102A (en) | Resource rescheduling method, device, equipment and medium | |
| KR102860324B1 (en) | Resource scheduling method and system, electronic device, and computer-readable storage medium | |
| CN112073532A (en) | Resource allocation method and device | |
| CN114143327A (en) | Cluster resource quota allocation method, device and electronic device | |
| CN114675973B (en) | Resource management method, device, storage medium and program product | |
| CN115951988B (en) | Job scheduling method, computing equipment and storage medium | |
| CN116360994A (en) | Scheduling method, device, server and storage medium of distributed heterogeneous resource pool | |
| CN116233022A (en) | Job scheduling method, server and server cluster | |
| CN112000477B (en) | Method, device, equipment and medium for load balancing in pod | |
| US11303546B2 (en) | Service system and control method of the same | |
| CN107203256B (en) | Energy-saving distribution method and device under network function virtualization scene | |
| CN110838987A (en) | Queue current limiting method and storage medium | |
| CN114090228A (en) | Resource allocation method, device, electronic equipment and medium | |
| CN116431327B (en) | Task current limiting processing method and fort machine |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |