CN113656162A - Resource application method and device, electronic equipment and storage medium - Google Patents
Resource application method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113656162A CN113656162A CN202110949204.XA CN202110949204A CN113656162A CN 113656162 A CN113656162 A CN 113656162A CN 202110949204 A CN202110949204 A CN 202110949204A CN 113656162 A CN113656162 A CN 113656162A
- Authority
- CN
- China
- Prior art keywords
- resource
- resource pool
- current
- pool
- service processing
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000011084 recovery Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000002360 preparation method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application provides a resource application method and device, electronic equipment and a storage medium. In the resource application method, when an application request of resource pool resources sent by a service is received, whether the current resource surplus of the resource pool in an operating state can meet the requirement of the resource consumption applied by the current service is judged. And if the current resource surplus of the resource pool in the running state is judged and the requirement of the resource consumption of the current service application cannot be met, replacing the resource pool in the running state with the standby resource pool. And applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state. By using the method, when an application request of the resource pool resources sent by a service is received, if the current resource surplus of the resource pool in the running state cannot meet the resource consumption of the current service application, the standby resource pool is used for replacing the current running resource pool to perform subsequent service processing, so that the operation without locking can be realized.
Description
Technical Field
The present application relates to the field of resource management technologies, and in particular, to a method and an apparatus for applying for a resource, an electronic device, and a storage medium.
Background
In the operation process of the service system, various resources such as memory, objects, etc. are inevitably used. If resources are directly applied to the operating system in the service processing process, the scheduling overhead of the operating system is generated, and the time consumption for initializing the resources is very large. In order to solve this problem, it is a common practice to create a certain amount of resources through a resource pool, and when a service needs a resource application, the service can apply for the resource through an interface of the resource pool.
However, in the prior art, when a resource is applied through a resource pool during service processing, if the amount of the resource remaining in the resource pool is insufficient, a certain amount of resource needs to be applied again, and operations such as initialization and preparation of the resource need to be performed, so that delay jitter occurs continuously in the running process of a service system, and the delay of service request response is obviously increased, which causes service processing stagnation.
Disclosure of Invention
In view of this, the present application provides a resource application method, a resource application apparatus, an electronic device, and a storage medium, so as to solve the problem in the prior art that when the amount of resources remaining in a resource pool is insufficient during service processing, a certain amount of resources need to be applied again, and execution of a service is blocked, which results in that the service consumes a lot of time.
In order to achieve the above purpose, the present application provides the following technical solutions:
the first aspect of the present application discloses a resource application method, where there are at least two resource pools, and only one resource pool is in a running state at each time, and other resource pools are standby, the method including:
when an application request of resource pool resources sent by a service is received, judging whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption of the current service application;
if the current resource surplus of the resource pool in the running state is judged to be incapable of meeting the requirement of the resource consumption of the current service application, replacing the resource pool in the running state with a standby resource pool;
and applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state.
Optionally, in the method, if it is determined that the current resource remaining amount of the resource pool in the running state cannot meet the requirement of the resource consumption amount of the current service application, after replacing the resource pool in the running state with a standby resource pool, the method further includes:
judging whether the current resource surplus of the current running resource pool can meet the resource consumption of the next service processing period of the current service; the resource consumption of the next service processing period is obtained by predicting according to the resource consumption data of a plurality of historical service processing periods;
and if the current resource surplus of the currently running resource pool is judged and the requirement of the resource consumption of the next service processing period of the current service cannot be met, replacing the currently running resource pool with a standby resource pool after the current service application processing is finished, applying for resources with preset resource amount, and expanding the capacity of the currently running resource pool.
Optionally, in the foregoing method, a manner that the resource consumption amount of the next service processing period is predicted according to the resource consumption data of a plurality of historical service processing periods includes:
acquiring resource consumption data of a plurality of historical service processing cycles;
calculating the resource consumption rate of each historical service processing period based on the resource consumption data of the plurality of historical service processing periods;
and predicting the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
Optionally, the method further includes:
marking a resource management mark on the resource in each resource pool; the resource management mark is used for characterizing a resource pool where the resource is located.
When resource recovery is carried out, each resource is recovered into the corresponding resource pool according to the resource management mark of each resource.
The second aspect of the present application discloses an application apparatus for resources, where at least two resource pools are provided, and only one resource pool is in a running state at each time, and other resource pools are standby, the apparatus includes:
the first judging unit is used for judging whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption amount applied by the current service or not when receiving an application request of the resource pool resources sent by the service;
the first replacing unit is used for replacing the resource pool in the running state with a standby resource pool if the current resource surplus of the resource pool in the running state is judged and the requirement of the resource consumption of the current service application cannot be met;
and the capacity expansion unit is used for applying for the resources with the preset resource amount and expanding the capacity of the resource pool in the running state.
Optionally, the above apparatus further includes:
a second judging unit, configured to judge whether a current resource surplus of a currently running resource pool can satisfy a resource consumption amount of a next service processing cycle of the current service; the resource consumption of the next service processing period is obtained by predicting according to the resource consumption data of a plurality of historical service processing periods;
and the second replacement unit is used for replacing the standby resource pool with the currently running resource pool after the current service application processing is finished, applying for resources with preset resource amount, and expanding the capacity of the currently running resource pool if the current resource surplus of the currently running resource pool is judged and the requirement of the resource consumption of the next service processing period of the current service cannot be met.
Optionally, in the above apparatus, the second determining unit includes:
the acquisition subunit is used for acquiring resource consumption data of a plurality of historical service processing cycles;
the calculating subunit is configured to calculate, based on the resource consumption data of the multiple historical service processing cycles, a resource consumption rate of each historical service processing cycle;
and the predicting subunit is configured to predict the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
Optionally, the above apparatus further includes:
the marking unit is used for marking the resource management mark on the resource in each resource pool; the resource management mark is used for characterizing a resource pool where the resource is located.
And the recovery unit is used for recovering each resource into the corresponding resource pool according to the resource management mark of each resource when the resource is recovered.
A third aspect of the present application discloses an electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of the first and second aspects of the present application.
A fourth aspect of the present application discloses a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of the first and second aspects of the present application.
According to the technical scheme, the resource application method provided by the application has the advantages that at least two resource pools are provided, only one resource pool is in the running state at each moment, and other resource pools are reserved. When an application request of resource pool resources sent by a service is received, whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption of the current service application or not is judged. And if the current resource surplus of the resource pool in the running state is judged and the requirement of the resource consumption of the current service application cannot be met, replacing the resource pool in the running state with the standby resource pool. And applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state. Therefore, by using the method of the present application, when an application request of a resource pool resource sent by a service is received, if the current resource surplus of the resource pool in the running state cannot meet the resource consumption of the current service application, the standby resource pool is used to replace the currently running resource pool for subsequent service processing, so that the operation without locking can be achieved. The problem that in the prior art, when the amount of the residual resources in the resource pool is insufficient during service processing, a certain amount of resources need to be applied again, and the service consumes much time is solved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a diagram illustrating a system response of a business system during business processing in the background art;
FIG. 2 is a flowchart of a resource application method disclosed in an embodiment of the present application;
fig. 3 is a schematic diagram of a system response of a service system during service processing according to another embodiment of the present application;
FIG. 4 is a flowchart of an embodiment of predicting resource consumption of a next transaction processing cycle according to resource consumption data of a plurality of historical transaction processing cycles, according to another embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an apparatus for applying for a resource according to another embodiment of the present disclosure;
fig. 6 is a schematic diagram of an electronic device according to another embodiment of the disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Moreover, in this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
As can be seen from the background art, in the prior art, when a resource is applied through a resource pool during service processing, if the amount of the remaining resource in the resource pool is not enough, a certain amount of resource needs to be applied again, and operations such as initialization and preparation of the resource need to be performed, at this time, overhead is much larger than that of a common application, so that delay jitter occurs continuously in the running process of a system, delay of service request response is significantly increased, and service processing is stalled. Specifically, referring to fig. 1, it can be seen from fig. 1 that when a resource pool needs to apply for a certain amount of resources for capacity expansion each time, a service consumes a lot of time, and a spike of a spike occurs.
In view of this, the present application provides a resource application method, a resource application device, an electronic device, and a storage medium, so as to solve the problem in the prior art that when the amount of resources remaining in a resource pool is insufficient during service processing, a certain amount of resources need to be applied again, which results in a long service time.
An embodiment of the present application provides a method for applying for a resource, where in the method for applying for a resource, at least two resource pools are provided, and only one resource pool is in a running state at each time, and other resource pools are standby, as shown in fig. 2, specifically including:
s201, when an application request of resource pool resources sent by a service is received, judging whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption of the current service application.
It should be noted that at least two resource pools are provided in the resource pool manager, one of the resource pools is in a running state and is used for performing service processing, the other resource pools are reserved as standby resource pools for standby, and the resources in the standby resource pools have completed operations such as resource application and initialization.
It should be further noted that, an asynchronous capacity-expansion thread, also referred to as an asynchronous thread, is added in the resource pool management. The asynchronous thread has the function that when the service applies for the resource of the resource pool, if the resource amount of the resource pool is insufficient, the asynchronous thread can replace the resource pool when responding to the service request, and then the asynchronous thread is used for expanding the original resource pool. When the asynchronous thread does not need to expand the capacity, the current resource surplus of the resource pool can be detected at regular time. When an application request of resource pool resources sent by a service is received, the asynchronous capacity-expansion thread checks the service to be processed currently, and obtains the amount of the resource quantity which needs to be applied in the whole processing period of the service to be processed currently, and the asynchronous capacity-expansion thread judges whether the current resource surplus of the resource pool can meet the requirement of the resource consumption quantity applied by the current service or not.
S202, if the current resource surplus of the resource pool in the running state is judged to be incapable of meeting the requirement of the resource consumption of the current service application, replacing the resource pool in the running state with a standby resource pool.
It should be noted that, if the asynchronous capacity expansion thread determines that the current resource amount of the currently running resource pool cannot meet the resource consumption requirement of the current service application, the currently running resource pool is replaced with the standby resource pool, and subsequent service processing is continued using the standby resource pool. If the service request suddenly increases in the service processing period, the remaining amount of resources in the currently running resource pool may be insufficient, and at this time, the standby resource pool may replace the currently running resource pool to perform subsequent service processing. As shown in fig. 3, by using the method of the present application, the resource surplus of the resource pool in the running state is detected at regular time through the asynchronous thread, and the standby resource pool can be used to replace the currently running resource pool at any time for subsequent service processing, so that no locking operation can be performed.
Optionally, in another embodiment of the present application, after the step S202 is executed, the method may further include:
judging whether the current resource surplus of the current running resource pool can meet the resource consumption of the next service processing period of the current service; and predicting the resource consumption of the next service processing period according to the resource consumption data of a plurality of historical service processing periods.
And if the current resource surplus of the currently running resource pool is judged to be incapable of meeting the requirement of the resource consumption of the next service processing period of the current service, replacing the currently running resource pool with the standby resource pool after the current service application processing is finished, applying for the resource with the preset resource amount, and expanding the capacity of the currently running resource pool.
It should be noted that, when it is determined that the current resource surplus of the resource pool in the running state cannot meet the requirement of the resource consumption applied by the current service, the thread of asynchronous capacity expansion continues to determine whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption in the next service processing cycle of the current service after the resource pool in the running state is replaced by the standby resource pool. If the current resource surplus of the resource pool in the running state is judged to be unable to meet the requirement of resource consumption of the next service processing period, the asynchronous capacity-expansion thread replaces the current running resource pool with the standby resource pool after the current service application processing is finished, so as to process the service of the next service processing period and realize the advanced replacement. And applying for resources with preset resource amount, expanding the capacity of the replaced resource pool, and taking the resource pool as a new standby resource pool after the capacity expansion is completed.
Optionally, in another embodiment of the present application, an implementation manner in which the resource consumption amount of the next service processing cycle in the above steps is predicted according to resource consumption data of a plurality of historical service processing cycles, as shown in fig. 4, may include:
s401, acquiring resource consumption data of a plurality of historical service processing cycles.
It should be noted that, in order to analyze the rule of the historical data, it is first necessary to obtain resource consumption data of a plurality of historical service processing cycles, so as to obtain the resource amount consumed by each service in its processing cycle through analysis.
S402, calculating the resource consumption rate of each historical service processing period based on the resource consumption data of the historical service processing periods.
It should be noted that after the resource consumption data of a plurality of historical service processing cycles are acquired, the resource consumption rate of each historical service processing cycle is calculated according to the processing duration and the consumed resource amount of each service.
And S403, predicting the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
It should be noted that after the resource consumption rates of the historical service processing periods are calculated, since the resource amount consumed by the same service in the same processing period has a certain regularity, the historical service processing period identical to the next service processing period is found out according to the service attribute of the next service and the time length for processing the next service, and the resource consumption amount of the next service processing period is predicted by using the found resource consumption rate of the historical service processing period.
S203, applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state.
It should be noted that, after the currently running resource pool is replaced by the standby resource pool, the asynchronous capacity expansion thread applies for the resource with the preset resource amount in advance, and then performs operations such as resource initialization, memory initialization, object creation, and the like to expand the currently running resource pool so that the resource amount of the resource pool is sufficient to deal with subsequent business processing, and the resource pool is used as a new standby resource pool to realize subsequent resource pool replacement.
In the resource application method provided by the embodiment of the application, when an application request of a resource pool resource sent by a service is received, whether the current resource surplus of the resource pool in a running state can meet the requirement of the resource consumption of the current service application is judged. And if the current resource surplus of the resource pool in the running state is judged and the requirement of the resource consumption of the current service application cannot be met, replacing the resource pool in the running state with the standby resource pool. And applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state. Therefore, by using the method of the present application, when an application request of a resource pool resource sent by a service is received, if the current resource surplus of the resource pool in the running state cannot meet the resource consumption of the current service application, the standby resource pool is used to replace the currently running resource pool for subsequent service processing, so that the operation without locking can be achieved. The problem that in the prior art, when the amount of the residual resources in the resource pool is insufficient during service processing, a certain amount of resources need to be applied again, and the service consumes much time is solved.
Optionally, in another embodiment of the present application, the method for applying for a resource may further include:
marking a resource management mark on the resource in each resource pool; the resource management mark is used for representing a resource pool where the resource is located.
When resource recovery is carried out, each resource is recovered into the corresponding resource pool according to the resource management mark of each resource.
It should be noted that, because a plurality of resource pools are provided, resources in the plurality of resource pools may be used in the service processing process, and therefore, a resource management flag is marked on the resource in each resource pool, so that it can be known to which resource pool each resource belongs, and when the service is finished using the resource and resource recovery is to be performed, according to the resource management flag of each resource, the interface for recovering the resource pool manager is directly called, and the used resource is recovered into the resource pool to which the resource pool manager belongs.
Optionally, in another embodiment of the present application, an apparatus for applying for a resource is further disclosed, as shown in fig. 5, including:
a first determining unit 501, configured to determine, when receiving an application request of a resource pool resource sent by a service, whether a current resource remaining amount of a resource pool in an operating state can meet a requirement of a resource consumption amount applied by the current service.
A first replacing unit 502, configured to replace the resource pool in the running state with a standby resource pool if it is determined that the current resource surplus of the resource pool in the running state cannot meet the requirement of the resource consumption of the current service application.
The capacity expansion unit 503 is configured to apply for a resource with a preset resource amount, and expand the capacity of the resource pool in the operating state.
In this embodiment, the specific implementation processes of the first determining unit 501, the first replacing unit 502, and the capacity expanding unit 503 can be referred to the content of the embodiment of the method in fig. 2, and are not described herein again.
In the resource application apparatus provided in this embodiment of the present application, when receiving an application request of a resource pool resource sent by a service, a first determining unit 501 determines whether a current resource remaining amount of a resource pool in an operating state can meet a requirement of a resource consumption amount applied by the current service. If the current resource surplus of the resource pool in the running state is judged, and the requirement of the resource consumption of the current service application cannot be met, the first replacing unit 502 replaces the resource pool in the running state with the standby resource pool. The capacity expansion unit 503 applies for a resource with a preset resource amount, and expands the capacity of the resource pool in the operating state. Therefore, by using the method of the present application, when an application request of a resource pool resource sent by a service is received, if the current resource surplus of the resource pool in the running state cannot meet the resource consumption of the current service application, the standby resource pool is used to replace the currently running resource pool for subsequent service processing, so that the operation without locking can be achieved. The problem that in the prior art, when the amount of the residual resources in the resource pool is insufficient during service processing, a certain amount of resources need to be applied again, and the service consumes much time is solved.
Optionally, in another embodiment of the present application, the apparatus for applying for resources further includes:
the second judging unit is used for judging whether the current resource surplus of the currently running resource pool can meet the resource consumption of the next service processing period of the current service; and predicting the resource consumption of the next service processing period according to the resource consumption data of a plurality of historical service processing periods.
And the second replacement unit is used for replacing the standby resource pool with the currently running resource pool after the current service application processing is finished, applying for the resource with the preset resource amount and expanding the capacity of the currently running resource pool if the current resource surplus of the currently running resource pool is judged and the requirement of the resource consumption of the next service processing period of the current service cannot be met.
In this embodiment, for the specific execution processes of the second determining unit and the second replacing unit, reference may be made to the contents of the corresponding method embodiments described above, and details are not described here again.
Optionally, in another embodiment of the present application, an implementation manner of the second determining unit includes:
and the acquisition subunit is used for acquiring the resource consumption data of a plurality of historical service processing cycles.
And the calculating subunit is used for calculating the resource consumption rate of each historical service processing period based on the resource consumption data of the plurality of historical service processing periods.
And the predicting subunit is used for predicting the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
In this embodiment, the specific execution processes of the obtaining subunit, the calculating subunit and the predicting subunit may refer to the content of the method embodiment corresponding to fig. 4, which is not described herein again.
Optionally, in another embodiment of the present application, the apparatus for applying for resources may further include:
the marking unit is used for marking the resource management mark on the resource in each resource pool; the resource management mark is used for representing a resource pool where the resource is located.
And the recovery unit is used for recovering each resource into the corresponding resource pool according to the resource management mark of each resource when the resource is recovered.
In this embodiment, for specific execution processes of the labeling unit and the recovery unit, reference may be made to the contents of the corresponding method embodiments described above, and details are not described here.
Another embodiment of the present application further provides an electronic device, as shown in fig. 6, specifically including:
one or more processors 601.
A storage device 602 having one or more programs stored thereon.
The one or more programs, when executed by the one or more processors 601, cause the one or more processors 601 to implement the method as in any one of the embodiments described above.
Another embodiment of the present application further provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of the above embodiments.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A resource application method is characterized in that at least two resource pools are provided, only one resource pool is in a running state at each moment, and other resource pools are standby, and the method comprises the following steps:
when an application request of resource pool resources sent by a service is received, judging whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption of the current service application;
if the current resource surplus of the resource pool in the running state is judged to be incapable of meeting the requirement of the resource consumption of the current service application, replacing the resource pool in the running state with a standby resource pool;
and applying for resources with preset resource amount, and expanding the capacity of the resource pool in the running state.
2. The method according to claim 1, wherein if it is determined that the current resource remaining amount of the resource pool in the operating state cannot meet the requirement of the resource consumption amount of the current service application, after replacing the resource pool in the operating state with a standby resource pool, the method further comprises:
judging whether the current resource surplus of the current running resource pool can meet the resource consumption of the next service processing period of the current service; the resource consumption of the next service processing period is obtained by predicting according to the resource consumption data of a plurality of historical service processing periods;
and if the current resource surplus of the currently running resource pool is judged to be incapable of meeting the requirement of the resource consumption of the next service processing period of the current service, replacing the currently running resource pool with a standby resource pool after the current service application processing is finished, presetting resources of the resource amount, and expanding the capacity of the currently running resource pool.
3. The method of claim 2, wherein the predicting the resource consumption of the next transaction processing cycle from the resource consumption data of a plurality of historical transaction processing cycles comprises:
acquiring resource consumption data of a plurality of historical service processing cycles;
calculating the resource consumption rate of each historical service processing period based on the resource consumption data of the plurality of historical service processing periods;
and predicting the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
4. The method of claim 1, further comprising:
marking a resource management mark on the resource in each resource pool; the resource management mark is used for representing a resource pool where the resource is located;
when resource recovery is carried out, each resource is recovered into the corresponding resource pool according to the resource management mark of each resource.
5. An apparatus for applying for resources, wherein there are at least two resource pools, and only one resource pool is in operation state at each time, and other resource pools are in standby, the apparatus comprising:
the first judging unit is used for judging whether the current resource surplus of the resource pool in the running state can meet the requirement of the resource consumption amount applied by the current service or not when receiving an application request of the resource pool resources sent by the service;
the first replacing unit is used for replacing the resource pool in the running state with a standby resource pool if the current resource surplus of the resource pool in the running state is judged and the requirement of the resource consumption of the current service application cannot be met;
and the capacity expansion unit is used for applying for the resources with the preset resource amount and expanding the capacity of the resource pool in the running state.
6. The apparatus of claim 5, further comprising:
a second judging unit, configured to judge whether a current resource surplus of a currently running resource pool can satisfy a resource consumption amount of a next service processing cycle of the current service; the resource consumption of the next service processing period is obtained by predicting according to the resource consumption data of a plurality of historical service processing periods;
and the second replacement unit is used for replacing the standby resource pool with the currently running resource pool after the current service application processing is finished, applying for resources with preset resource amount, and expanding the capacity of the currently running resource pool if the current resource surplus of the currently running resource pool is judged and the requirement of the resource consumption of the next service processing period of the current service cannot be met.
7. The apparatus of claim 6, wherein the second determining unit comprises:
the acquisition subunit is used for acquiring resource consumption data of a plurality of historical service processing cycles;
the calculating subunit is configured to calculate, based on the resource consumption data of the multiple historical service processing cycles, a resource consumption rate of each historical service processing cycle;
and the predicting subunit is configured to predict the resource consumption of the next service processing period by using the resource consumption rate of each historical service processing period.
8. The apparatus of claim 5, further comprising:
the marking unit is used for marking the resource management mark on the resource in each resource pool; the resource management mark is used for representing a resource pool where the resource is located;
and the recovery unit is used for recovering each resource into the corresponding resource pool according to the resource management mark of each resource when the resource is recovered.
9. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-4.
10. A computer storage medium, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110949204.XA CN113656162A (en) | 2021-08-18 | 2021-08-18 | Resource application method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110949204.XA CN113656162A (en) | 2021-08-18 | 2021-08-18 | Resource application method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113656162A true CN113656162A (en) | 2021-11-16 |
Family
ID=78480961
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110949204.XA Pending CN113656162A (en) | 2021-08-18 | 2021-08-18 | Resource application method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113656162A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023284171A1 (en) * | 2021-07-14 | 2023-01-19 | 苏州浪潮智能科技有限公司 | Resource allocation method and system after system restart, and related component |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120096165A1 (en) * | 2010-10-18 | 2012-04-19 | International Business Machines Corporation | Reallocating resource capacity among resource pools in a cloud computing environment |
CN105468727A (en) * | 2015-11-20 | 2016-04-06 | 国家电网公司 | Zookeeper based method for realizing MySQL strong-consistency copy |
CN107682888A (en) * | 2017-11-01 | 2018-02-09 | 苏州汉明科技有限公司 | A kind of cloud AC redundancy backup systems and method |
CN108076082A (en) * | 2016-11-09 | 2018-05-25 | 阿里巴巴集团控股有限公司 | A kind of expansion method of application cluster, device and system |
CN109412874A (en) * | 2018-12-21 | 2019-03-01 | 腾讯科技(深圳)有限公司 | Configuration method, device, server and the storage medium of device resource |
CN109428864A (en) * | 2017-08-30 | 2019-03-05 | 武汉斗鱼网络科技有限公司 | Improve the method and device that nginx-rtmp draws streaming quality |
CN109783243A (en) * | 2018-12-28 | 2019-05-21 | 南京华飞数据技术有限公司 | It is a kind of based on reserved copy and duplicate switching multi-thread data without lock reading/writing method |
US20200097349A1 (en) * | 2018-09-26 | 2020-03-26 | International Business Machines Corporation | Diagnostic health checking and replacement of resources in disaggregated data centers |
CN111158595A (en) * | 2019-12-27 | 2020-05-15 | 中国建设银行股份有限公司 | Enterprise-level heterogeneous storage resource scheduling method and system |
CN112698952A (en) * | 2021-01-05 | 2021-04-23 | 广州品唯软件有限公司 | Unified management method and device for computing resources, computer equipment and storage medium |
CN112799596A (en) * | 2021-02-03 | 2021-05-14 | 联想(北京)有限公司 | Capacity expansion control method and device for storage resources and electronic equipment |
CN113254223A (en) * | 2021-07-14 | 2021-08-13 | 苏州浪潮智能科技有限公司 | Resource allocation method and system after system restart and related components |
-
2021
- 2021-08-18 CN CN202110949204.XA patent/CN113656162A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120096165A1 (en) * | 2010-10-18 | 2012-04-19 | International Business Machines Corporation | Reallocating resource capacity among resource pools in a cloud computing environment |
CN105468727A (en) * | 2015-11-20 | 2016-04-06 | 国家电网公司 | Zookeeper based method for realizing MySQL strong-consistency copy |
CN108076082A (en) * | 2016-11-09 | 2018-05-25 | 阿里巴巴集团控股有限公司 | A kind of expansion method of application cluster, device and system |
CN109428864A (en) * | 2017-08-30 | 2019-03-05 | 武汉斗鱼网络科技有限公司 | Improve the method and device that nginx-rtmp draws streaming quality |
CN107682888A (en) * | 2017-11-01 | 2018-02-09 | 苏州汉明科技有限公司 | A kind of cloud AC redundancy backup systems and method |
US20200097349A1 (en) * | 2018-09-26 | 2020-03-26 | International Business Machines Corporation | Diagnostic health checking and replacement of resources in disaggregated data centers |
CN109412874A (en) * | 2018-12-21 | 2019-03-01 | 腾讯科技(深圳)有限公司 | Configuration method, device, server and the storage medium of device resource |
CN109783243A (en) * | 2018-12-28 | 2019-05-21 | 南京华飞数据技术有限公司 | It is a kind of based on reserved copy and duplicate switching multi-thread data without lock reading/writing method |
CN111158595A (en) * | 2019-12-27 | 2020-05-15 | 中国建设银行股份有限公司 | Enterprise-level heterogeneous storage resource scheduling method and system |
CN112698952A (en) * | 2021-01-05 | 2021-04-23 | 广州品唯软件有限公司 | Unified management method and device for computing resources, computer equipment and storage medium |
CN112799596A (en) * | 2021-02-03 | 2021-05-14 | 联想(北京)有限公司 | Capacity expansion control method and device for storage resources and electronic equipment |
CN113254223A (en) * | 2021-07-14 | 2021-08-13 | 苏州浪潮智能科技有限公司 | Resource allocation method and system after system restart and related components |
Non-Patent Citations (6)
Title |
---|
FAN-TIEN CHENG ET AL.: "Application Cluster Service Scheme for Near-Zero-Downtime Services", PROCEEDINGS OF THE 2005 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, pages 4062 - 4067 * |
刘小亮等: ""多对多"高可用集群技术探索实践", 网络安全和信息化, no. 05, 5 May 2021 (2021-05-05), pages 80 - 84 * |
张文学等: "架构师书库 架构真意 企业级应用架构设计方法论与实践", 30 September 2020, 北京:机械工业出版社, pages: 200 - 202 * |
林军;倪宏;孙鹏;张辉;: "混合任务系统的服务质量保障调度算法", 计算机工程与应用, vol. 49, no. 10, pages 53 - 57 * |
梁卫华等: "移动通信设备与实训", 31 March 2014, 成都:西南交通大学出版社, pages: 122 - 123 * |
马英矫: "面向超级基站的异构资源池互连关键技术研究", 中国博士学位论文全文数据库 (信息科技辑), no. 01, pages 136 - 233 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023284171A1 (en) * | 2021-07-14 | 2023-01-19 | 苏州浪潮智能科技有限公司 | Resource allocation method and system after system restart, and related component |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3675434B1 (en) | Distributed system resource allocation method, device and system | |
WO2014004566A2 (en) | Querying for business service processing status information | |
CN107301093B (en) | Method and device for managing resources | |
CN107273182B (en) | Method and system for dynamically expanding virtual machine resources | |
CN109032805A (en) | A kind of scalable appearance method, apparatus of elasticity, server and storage medium | |
CN111221700B (en) | Cluster node state monitoring method, device, equipment and readable storage medium | |
CN106572137B (en) | Distributed service resource management method and device | |
WO2017041674A1 (en) | Method, device and electronic equipment for starting backup task | |
CN113656162A (en) | Resource application method and device, electronic equipment and storage medium | |
CN103488538B (en) | Application extension device and application extension method in cloud computing system | |
CN112650575A (en) | Resource scheduling method and device and cloud service system | |
CN114866563A (en) | Capacity expansion method, device, system and storage medium | |
CN115617497A (en) | Thread processing method, scheduling component, monitoring component, server and storage medium | |
Hung et al. | Task scheduling for optimizing recovery time in cloud computing | |
CN107368351B (en) | Automatic upgrading and capacity expanding method and device for virtual machine configuration | |
US20100082528A1 (en) | Method and Apparatus For Optimizing Lead Time For Service Provisioning | |
CN110928672A (en) | Task arranging method, device and equipment and storage medium | |
CN107168790B (en) | Job scheduling method and device | |
CN115695435A (en) | Method and device for dynamically adjusting node flow, electronic equipment and storage medium | |
CN114780245A (en) | Server resource allocation method and device | |
CN113806050A (en) | Processing method and device of computing resources, electronic equipment and storage medium | |
CN111625866A (en) | Authority management method, system, equipment and storage medium | |
CN106161068A (en) | A kind of recovery prompting to Internet resources and distribution method, and controller | |
CN112395081A (en) | Resource online automatic recovery method, system, server and storage medium | |
CN106708656B (en) | User operation recovery method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211116 |