CN112689007B - Resource allocation method, device, computer equipment and storage medium - Google Patents
Resource allocation method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112689007B CN112689007B CN202011537910.5A CN202011537910A CN112689007B CN 112689007 B CN112689007 B CN 112689007B CN 202011537910 A CN202011537910 A CN 202011537910A CN 112689007 B CN112689007 B CN 112689007B
- Authority
- CN
- China
- Prior art keywords
- access request
- priority
- current access
- target node
- target
- 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
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Computer And Data Communications (AREA)
Abstract
The application relates to a resource allocation method, a resource allocation device, computer equipment and a storage medium. The method comprises the following steps: receiving a current access request, and acquiring an access parameter of the current access request, wherein the current access request is an access request for accessing a web server cluster; calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter; selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster; and selecting a target thread pool under the target node according to the priority, and carrying out resource allocation on the current access request through the target thread pool. The method can improve the access bearing capacity under the concurrent access scene.
Description
Technical Field
The present invention relates to the field of web services, and in particular, to a method, an apparatus, a computer device, and a storage medium for allocating resources.
Background
With the development of web service technology, when business data is continuously accessed to a web service platform, the magnitude of web service access requests and the frequency of requests in unit time are continuously increased.
However, in the conventional web service access process, for an excessive number of access requests per unit time, even if the cluster's computing resources allow, access failure and failure may occur. The method is characterized in that resources of the web service cluster are not reasonably distributed and fully utilized in a high concurrency scene, so that the maximum access bearing capacity and the access success rate in the concurrency access scene are affected.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a resource allocation method, apparatus, computer device, and storage medium capable of improving access load in a concurrent access scenario.
A method for resource allocation, said method comprising:
receiving a current access request, and acquiring an access parameter of the current access request, wherein the current access request is an access request for accessing a web server cluster;
calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter;
selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster;
and selecting a target thread pool under the target node according to the priority, and carrying out resource allocation on the current access request through the target thread pool.
In one embodiment, selecting a target node based on the resource consumption pre-determined value comprises: and selecting the target node in a polling mode when the resource consumption predicted value is larger than a preset threshold value.
In one embodiment, selecting a target node based on the resource consumption pre-determined value comprises: and selecting the target node in a random mode when the resource consumption predicted value is smaller than a preset threshold value.
In one embodiment, selecting a target thread pool under a target node according to priority comprises: and selecting a target thread pool corresponding to the priority from the target node according to the preset corresponding relation between the priority and the thread pool.
In one embodiment, the method further comprises:
collecting operation indexes of all ports of the cluster terminal nodes, and calculating available nodes and available thread pools according to the operation indexes;
selecting a target node according to the resource consumption predicted value, including: selecting a target node from available nodes according to the resource consumption predicted value;
selecting a target thread pool under a target node according to the priority, including: and selecting a target thread pool corresponding to the priority from available thread pools under the target node.
In one embodiment, the method further comprises: when the available thread pool under the target node does not have the thread pool corresponding to the priority, selecting the target thread pool with the lower level than the priority from the available thread pools under the target node.
In one embodiment, calculating the resource consumption estimate for the current access request based on the access parameters includes: and acquiring a data range value to be accessed and an interface quantity value of an external system to be accessed according to the access parameter, and calculating a resource consumption predicted value of the current access request according to the data range value and the interface quantity value.
In one embodiment, the method further comprises: and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption predicted value according to the actual execution information.
In one embodiment, determining the priority of the current access request based on the access parameters includes: and analyzing the service type of the current access request according to the access parameter, and determining the priority of the current access request according to the service type.
In one embodiment, determining the priority of the current access request based on the access parameters includes: the method comprises the steps of collecting actual execution information of a historical access request, calculating estimated access time consumption of a current access request according to access parameters, and determining the priority of the current access request according to the estimated access time consumption and the actual execution information of the historical access request.
A resource allocation apparatus, said apparatus comprising:
the request receiving module is used for receiving a current access request, acquiring access parameters of the current access request, wherein the current access request is an access request for accessing the web server cluster;
the resource estimation module is used for calculating a resource consumption estimated value of the current access request according to the access parameter and determining the priority of the current access request according to the access parameter;
the node selection module is used for selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster;
and the thread allocation module is used for selecting a target thread pool under the target node according to the priority, and performing resource allocation on the current access request through the target thread pool.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the resource allocation method described above when the computer program is executed.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the resource allocation method described above.
According to the resource allocation method, the device, the computer equipment and the storage medium, the resource consumption predicted value of the current access request is calculated, the priority of the current access request is determined, the target node and the target thread pool are selected according to the resource consumption predicted value and the priority, and the resource allocation is carried out on the current access request through the target thread pool, so that the reasonable allocation of the resource can be realized under the concurrent scene, and the bearing capacity of the concurrent access is improved.
Drawings
FIG. 1 is an application environment diagram of a resource allocation method in one embodiment;
FIG. 2 is a flow chart of a method of resource allocation in one embodiment;
FIG. 3 is a diagram of a resource allocation technique architecture based on a web server cluster in one application example;
FIG. 4 is a schematic diagram of the allocation of thread pools in an example application;
FIG. 5 is a block diagram of a resource allocation device in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The resource allocation method provided by the application can be applied to an application environment shown in fig. 1. The terminal 102 and the server 104 communicate through a network, and the server 104 is any one or more servers in a web server cluster, which may be implemented by an independent server or a server cluster formed by a plurality of servers, and the terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server 104 receives a current access request sent by the terminal 102, acquires access parameters of the current access request, calculates a resource consumption predicted value of the current access request according to the access parameters, determines the priority of the current access request according to the access parameters, selects a target node according to the resource consumption predicted value, selects a target thread pool under the target node according to the priority, and allocates resources to the current access request through the target thread pool.
In one embodiment, as shown in fig. 2, a resource allocation method is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
step S202: and receiving a current access request, and acquiring access parameters of the current access request, wherein the current access request is an access request for accessing the web server cluster.
The implementation manner of the web server cluster is not limited, and the web server cluster can be realized by mutually connecting a plurality of web server hosts, for example, a server architecture comprising a load balancer and a plurality of end nodes, wherein the load balancer can be software or hardware, and the end nodes can be isomorphic or heterogeneous servers; or by clustering a plurality of independently operating web application servers on a physical server; but also can be implemented in a manner based on RSF (Remote Service Framework ) and registering web services on RSF platform, etc.
The access parameter refers to related request data indicating that web service access is completed, and may include a data range of a database to be accessed, a data range of a table, a range of unstructured data, an external interface to be called, a type to which access belongs, a type including a service, and the like.
Specifically, when the server receives a current access request for accessing the web server cluster sent by the terminal, the server analyzes the current access request, and analyzes relevant request data from the current access request to obtain the relevant request data as access parameters.
Step S204: and calculating a resource consumption predicted value of the current access request according to the access parameters, and determining the priority of the current access request according to the access parameters.
The resource consumption predicted value refers to a resource value expected to be consumed for completing the current access request processing, namely, the resource value expected to be consumed according to the corresponding response returned according to the current access request. The priority may be used to represent the importance of the current access request, with higher priority access requests having higher importance and higher user expectations for their normal execution.
Specifically, for calculation of the resource consumption predicted value, the server may perform filter factor calculation by an exponential backoff algorithm according to the access parameter, thereby obtaining a data range to be accessed and the number of external interfaces to be accessed, and estimating the consumption value of the resource based on the data range to be accessed and the number of external interfaces to be accessed. For determining the priority, the server may extract the service type, service scenario, service data, etc. of the current access request from the access parameters, so as to determine the priority of the current access request, or may estimate the expected consumed resource value or expected consumed time length of the current access request, and determine the priority of the current access request in combination with the relevant reference of the historical access request of each priority level.
Step S206: and selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster.
Specifically, the server may trigger a corresponding node selection policy according to the calculated resource consumption predicted value of the current access request, select, for the current access request, a suitable node from nodes at the end (back end) of the cluster as a target node through the node selection policy, and push the current access request to the target node.
Step S208: and selecting a target thread pool under the target node according to the priority, and carrying out resource allocation on the current access request through the target thread pool.
The target thread pool is a thread pool belonging to the target node, specifically, the server may trigger a corresponding thread pool allocation policy according to the priority of the current access request, the server selects a suitable thread pool from the thread pools belonging to the target node as the target thread pool according to the corresponding thread pool allocation policy, and after the server pushes the current access request to the target node, the server instructs the target node to allocate the current access request to the target thread pool under the target node through the thread pool allocation policy, so that the target thread pool may allocate resources to the current access request and perform subsequent processing.
According to the resource allocation method, the resource consumption predicted value of the current access request is calculated, the priority of the current access request is determined, the target node and the target thread pool are selected according to the resource consumption predicted value and the priority, and the resource allocation is carried out on the current access request through the target thread pool, so that reasonable allocation of cluster resources can be realized under the concurrent scene, and the bearing capacity of concurrent access is improved.
In one embodiment, selecting a target node based on the resource consumption pre-determined value comprises: when the resource consumption predicted value is larger than a preset threshold value, selecting a target node in a polling mode; and/or selecting the target node in a random mode when the resource consumption predicted value is smaller than a preset threshold value.
In this embodiment, the setting mode of the threshold is not limited, the initialization threshold may be obtained from a testing environment or a pressure testing environment, and the initialization threshold may be adjusted and optimized in a production environment. For the access request with the resource consumption predicted value larger than the threshold value, the resource consumption may be more and the execution time may be longer, so that a polling scheduling mode can be adopted to ensure that each node at the tail end of the cluster can realize load balance. For the access request with the resource consumption predicted value smaller than the threshold value, the resource consumption is possibly less, the execution time is short, and therefore the scheduling speed can be improved in a random mode. In this embodiment, different node selection (concurrency) strategies are adopted according to different resource consumption predicted values, so that concurrency and utilization rate of node resources can be improved.
In one embodiment, selecting a target thread pool under a target node according to priority comprises: and selecting a target thread pool corresponding to the priority from the target node according to the preset corresponding relation between the priority and the thread pool.
In this embodiment, the correspondence between the priority and the thread pool may be set in advance, for example, if the priority is a high priority and a low priority, a high priority thread pool corresponding to the high priority and a low priority thread pool corresponding to the low priority may be set. According to the embodiment, the access requests of different levels are distributed to the thread pools of different levels according to the priority of the access requests, so that the access requests of different levels can be isolated, and therefore, the access requests of different levels can not interfere with each other, especially, the access with higher priority can not be blocked by the access with lower priority arranged in front, the response delay of the access with higher priority can be reduced, the resource dispute is reduced, and the bearing capacity of all levels of services is ensured.
In one embodiment, the method may further include: collecting operation indexes of all ports of a cluster terminal node, calculating available nodes according to the operation indexes, and selecting target nodes according to a resource consumption predicted value, wherein the method comprises the following steps: and selecting a target node from the available nodes according to the resource consumption predicted value.
The collection mode of the operation indexes of each port of the cluster end node is not limited, and for example, the operation indexes can be collected through a real-time task and an off-line task, and also can be collected manually and periodically. The method comprises the following steps of real-time acquisition: aiming at data with high timeliness requirements, acquiring real-time data through a real-time computing engine Flink; offline acquisition: automatically triggering an acquisition task according to time granularity (such as minutes, hours and the like); and (3) manual collection: manual collection of irregular data.
The operation index of each port of the cluster end node includes a parameter value and an actual value, for example, may include a half-connection queue size, a full-connection queue size, a number of times of full-connection queue overflow, a number of times of half-connection queue overflow, and the like of the accessed service port.
In this embodiment, the current usage state of each node may be calculated according to the collected operation indexes of each port of the end node of the cluster, and the node with the resource usage rate lower than the preset standard may be used as the available node, and the selection of the target node may be performed based on the available node. By adopting the embodiment, the problems of overload of access requests on a single node and uneven distribution of requests of each node can be avoided.
Furthermore, the available thread pool can be calculated according to the collected operation indexes of each port of the cluster end node, and the target thread pool is selected under the target node according to the priority, including: and selecting a target thread pool corresponding to the priority from available thread pools under the target node.
Specifically, a thread pool with the current thread occupancy rate lower than a preset standard can be used as an available thread pool according to the use state of the thread pool under the node, and the selection of the target thread pool is performed based on the available thread pool. Thus, the problems of low resource utilization and reduced concurrency caused by unbalanced thread occupancy of the thread pool can be avoided.
Further, the method further comprises the steps of: when the available thread pool under the target node does not have the thread pool corresponding to the priority, selecting the target thread pool with the lower level than the priority from the available thread pools under the target node.
Specifically, when the thread pool corresponding to the priority level is in an unavailable state, but the thread pool with a lower level is in an available state, the higher-level access request can be allowed to use the thread pool corresponding to the lower-level access request, so that the response delay of the higher-level access is reduced, and the normal response of the important business is preferentially ensured.
In one embodiment, calculating the resource consumption estimate for the current access request based on the access parameters includes: and acquiring a data range value to be accessed and an interface quantity value of an external system to be accessed according to the access parameter, and calculating a resource consumption predicted value of the current access request according to the data range value and the interface quantity value.
Specifically, the server may parse the current access request to obtain a data range value to be accessed and an interface number value of an external system to be accessed, thereby calculating a resource consumption predicted value of the current access request.
In one embodiment, the method further comprises: and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption predicted value according to the actual execution information.
Specifically, the actual execution information of the current access request may be collected, for example, the actual execution information may include an actual resource consumption value, an actual call time consumption, an actual thread occupation, an actual execution bare time, and the like, and the actual execution information of the current access request is used as historical reference data, and the calculation mode of the resource consumption predicted value of the subsequent access request is adjusted through algorithms such as machine learning or artificial intelligence, so as to improve the calculation accuracy and reduce erroneous judgment.
In one embodiment, determining the priority of the current access request based on the access parameters includes: and analyzing the service type of the current access request according to the access parameter, and determining the priority of the current access request according to the service type.
Specifically, the access parameters may include data related to the service, according to which the service type to which the current access request belongs may be determined, and in general, the service type may represent the importance degree or the expected degree of the service, so that the priority of the current access request may be determined according to the preset correspondence between the service type and the priority.
In one embodiment, determining the priority of the current access request based on the access parameters includes: the method comprises the steps of collecting actual execution information of a historical access request, calculating estimated access time consumption of a current access request according to access parameters, and determining the priority of the current access request according to the estimated access time consumption and the actual execution information of the historical access request.
In this embodiment, the priority of the current access request may also be determined according to the estimated access time and the actual execution information of the historical access request. The actual execution information of the historical access request can be obtained by collecting access related data such as access times in a certain time, call time consumption, thread occupation, execution bare time, and times when the execution bare time exceeds an Service Level Agreement (SLA), and the information collection mode is not limited, and can refer to the mode of collecting the operation indexes of each port of the end node of the cluster.
In one embodiment, the determination of the priority may be specifically performed according to the following steps:
and step 1, splitting the execution step analysis and the calculation of the number of the peripheral systems required to be accessed according to the access parameters.
And 2, calculating estimated reference time consumption according to the analyzed execution step, calculating historical reference time consumption according to the actual execution information of the historical access request, and determining the access request with the estimated reference time consumption being greater than the historical reference time consumption as high priority by referring to the historical reference time consumption.
And 3, calculating estimated access time consumption according to the number of the required access peripheral systems, calculating historical access time consumption according to the actual execution information of the historical access requests, and determining the access requests with access time consumption greater than the historical access time consumption as high priority by referring to the historical access time consumption.
Further, the method may further include:
and step 4, recording the actual reference time consumption of each analysis step of the current access request. The actual reference time consumption accords with normal distribution, and the median of the normal distribution is taken as a model adjustment parameter.
And 5, recording the actual time consumption of the current access request to access each peripheral system. The actual access time consumption accords with normal distribution, and the median of the normal distribution is taken as a model adjustment parameter.
The resource allocation method according to the present application will be described in further detail below with reference to an application example. Referring now to FIG. 3, FIG. 3 illustrates a technical architecture diagram of resource allocation based on a web server cluster (e.g., a wildfly cluster) for one application instance.
For the data acquisition unit, data acquisition can be performed from both dimensions of the access request and the service port. Access request dimension: including access times, call time consumption, thread occupation, execution bare time exceeding SLA times, etc. Service port dimension: including the size of the half-connect queue, the size of the full-connect queue, the number of full-connect queue overflows, the number of half-connect queue overflows, etc. of the service port being accessed. The acquisition mode can specifically comprise real-time task acquisition, off-line task acquisition and manual periodic acquisition. And (3) real-time acquisition: aiming at data with high timeliness requirements, real-time data are collected through a real-time computing engine Flink. Offline acquisition: the acquisition task is automatically triggered at a time granularity (e.g., minutes, hours, etc.). And (3) manual collection: manual collection of irregular data. The collected data can be stored in a database, and when the current access request is received and the current access request is subjected to resource allocation, the collected data is used as an entry call for resource calculation, and the whole process can be accompanied with data collection.
For the resource calculation module, when a current access request is received, reference estimation (resource consumption predicted value and priority) and scene estimation (available nodes and available thread pools) are carried out according to the access parameters of the current access request and the acquired data, a node selection strategy (concurrent access selection strategy) and a thread pool allocation strategy are matched according to the results of the reference estimation and the scene estimation, and the current access request is allocated to a target thread pool under a target node according to the matched strategy.
The allocation policy of the thread pool may be specifically shown in fig. 4, and fig. 4 shows a schematic diagram of the allocation of the thread pool implemented by an application. The thread pool can be split into a high-priority thread pool and a low-priority thread pool, the requests are distributed to the corresponding thread pools according to the priority of the access requests, and the low-priority thread pool allows the high-priority thread pool to be used when the low-priority thread pool is idle.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in fig. 5, there is provided a resource allocation apparatus, including: a request receiving module 10, a resource estimating module 20, a node selecting module 30 and a thread allocating module 40, wherein:
the request receiving module 10 is configured to receive a current access request, obtain an access parameter of the current access request, where the current access request is an access request for accessing the web server cluster;
a resource estimation module 20, configured to calculate a resource consumption estimated value of the current access request according to the access parameter, and determine a priority of the current access request according to the access parameter;
the node selection module 30 is configured to select a target node according to the resource consumption predicted value, where the target node is a node at the end of the web server cluster;
the thread allocation module 40 is configured to select a target thread pool under the target node according to the priority, and allocate resources to the current access request through the target thread pool.
In one embodiment, the node selection module 30 selects the target node in a polling manner when the resource consumption estimate is greater than a preset threshold.
In one embodiment, the node selection module 30 selects the target node in a random manner when the resource consumption pre-determined value is less than a pre-set threshold.
In one embodiment, the thread allocation module 40 selects a target thread pool corresponding to the priority under the target node according to the preset correspondence between the priority and the thread pool.
In one embodiment, the apparatus further includes a data collection module 50, configured to collect operation indexes of ports of the end nodes of the cluster, calculate available nodes and available thread pools according to the operation indexes, the node selection module 30 selects a target node from the available nodes according to the resource consumption predicted value, and the thread allocation module 40 selects a target thread pool corresponding to the priority from the available thread pools under the target node.
In one embodiment, the thread allocation module 40 is further configured to select a target thread pool with a lower level than the priority from among the available thread pools under the target node when there is no thread pool corresponding to the priority among the available thread pools under the target node.
In one embodiment, the resource estimation module 20 obtains a data range value to be accessed and an interface number value of an external system to be accessed according to the access parameter, and calculates a resource consumption predicted value of the current access request according to the data range value and the interface number value.
In one embodiment, the data collection module 50 is further configured to collect actual execution information of the current access request, and adjust a calculation manner of the resource consumption predicted value according to the actual execution information.
In one embodiment, the resource estimation module 20 analyzes the service type to which the current access request belongs according to the access parameter, and determines the priority of the current access request according to the service type.
In one embodiment, the data collection module 50 is further configured to collect actual execution information of the historical access request, and the resource estimation module 20 calculates estimated access time consumption of the current access request according to the access parameter, and determines the priority of the current access request according to the estimated access time consumption and the actual execution information of the historical access request.
The specific limitation of the resource allocation device can be referred to as limitation of the resource allocation method hereinabove, and will not be described herein. The respective modules in the above-described resource allocation apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device may be used to store the collected data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a resource allocation method.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: receiving a current access request, and acquiring an access parameter of the current access request, wherein the current access request is an access request for accessing a web server cluster; calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter; selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster; and selecting a target thread pool under the target node according to the priority, and carrying out resource allocation on the current access request through the target thread pool.
In one embodiment, when the processor executes the computer program to select the target node according to the resource consumption predicted value, the following steps are specifically implemented: and selecting the target node in a polling mode when the resource consumption predicted value is larger than a preset threshold value.
In one embodiment, when the processor executes the computer program to select the target node according to the resource consumption predicted value, the following steps are specifically implemented: and selecting the target node in a random mode when the resource consumption predicted value is smaller than a preset threshold value.
In one embodiment, when the processor executes the computer program to select a target thread pool under a target node according to the priority, the following steps are specifically implemented: and selecting a target thread pool corresponding to the priority from the target node according to the preset corresponding relation between the priority and the thread pool.
In one embodiment, execution of the computer program by the processor further implements the steps of: the method comprises the steps of collecting operation indexes of ports of end nodes of a cluster, calculating available nodes and available thread pools according to the operation indexes, executing a computer program by a processor to achieve the purpose of selecting the target nodes from the available nodes according to the resource consumption predicted value when the target nodes are selected according to the resource consumption predicted value, and achieving the purpose of selecting the target thread pools corresponding to the priorities from the available thread pools under the target nodes when the target thread pools are selected under the target nodes according to the priorities.
In one embodiment, execution of the computer program by the processor further implements the steps of: when the available thread pool under the target node does not have the thread pool corresponding to the priority, selecting the target thread pool with the lower level than the priority from the available thread pools under the target node.
In one embodiment, when the processor executes the computer program to calculate the resource consumption predicted value of the current access request according to the access parameter, the following steps are specifically implemented: and acquiring a data range value to be accessed and an interface quantity value of an external system to be accessed according to the access parameter, and calculating a resource consumption predicted value of the current access request according to the data range value and the interface quantity value.
In one embodiment, execution of the computer program by the processor further implements the steps of: and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption predicted value according to the actual execution information.
In one embodiment, when the processor executes the computer program to determine the priority of the current access request according to the access parameter, the following steps are specifically implemented: and analyzing the service type of the current access request according to the access parameter, and determining the priority of the current access request according to the service type.
In one embodiment, when the processor executes the computer program to determine the priority of the current access request according to the access parameter, the following steps are specifically implemented: the method comprises the steps of collecting actual execution information of a historical access request, calculating estimated access time consumption of a current access request according to access parameters, and determining the priority of the current access request according to the estimated access time consumption and the actual execution information of the historical access request.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a current access request, and acquiring an access parameter of the current access request, wherein the current access request is an access request for accessing a web server cluster; calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter; selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster; and selecting a target thread pool under the target node according to the priority, and carrying out resource allocation on the current access request through the target thread pool.
In one embodiment, when the computer program is executed by the processor to select the target node according to the resource consumption predicted value, the following steps are specifically implemented: and selecting the target node in a polling mode when the resource consumption predicted value is larger than a preset threshold value.
In one embodiment, when the computer program is executed by the processor to select the target node according to the resource consumption predicted value, the following steps are specifically implemented: and selecting the target node in a random mode when the resource consumption predicted value is smaller than a preset threshold value.
In one embodiment, when the computer program is executed by the processor to select a target thread pool under a target node according to the priority, the following steps are specifically implemented: and selecting a target thread pool corresponding to the priority from the target node according to the preset corresponding relation between the priority and the thread pool.
In one embodiment, execution of the computer program by the processor further implements the steps of: the method comprises the steps of collecting operation indexes of ports of end nodes of a cluster, calculating available nodes and available thread pools according to the operation indexes, selecting the target nodes from the available nodes according to the resource consumption predicted value when the target nodes are selected according to the resource consumption predicted value by the execution of a computer program by a processor, and selecting the target thread pools corresponding to the priorities from the available thread pools under the target nodes when the target thread pools are selected under the target nodes according to the priorities by the execution of the computer program by the processor.
In one embodiment, execution of the computer program by the processor further implements the steps of: when the available thread pool under the target node does not have the thread pool corresponding to the priority, selecting the target thread pool with the lower level than the priority from the available thread pools under the target node.
In one embodiment, when the computer program is executed by the processor to calculate the resource consumption estimate of the current access request based on the access parameters, the following steps are specifically implemented: and acquiring a data range value to be accessed and an interface quantity value of an external system to be accessed according to the access parameter, and calculating a resource consumption predicted value of the current access request according to the data range value and the interface quantity value.
In one embodiment, execution of the computer program by the processor further implements the steps of: and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption predicted value according to the actual execution information.
In one embodiment, when the computer program is executed by the processor to implement the determination of the priority of the current access request based on the access parameters, the following steps are specifically implemented: and analyzing the service type of the current access request according to the access parameter, and determining the priority of the current access request according to the service type.
In one embodiment, when the computer program is executed by the processor to implement the determination of the priority of the current access request based on the access parameters, the following steps are specifically implemented: the method comprises the steps of collecting actual execution information of a historical access request, calculating estimated access time consumption of a current access request according to access parameters, and determining the priority of the current access request according to the estimated access time consumption and the actual execution information of the historical access request.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.
Claims (11)
1. A method of resource allocation, the method comprising:
receiving a current access request, and acquiring an access parameter of the current access request, wherein the current access request is an access request for accessing a web server cluster;
calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter; wherein the determining the priority of the current access request according to the access parameter includes: determining the number of peripheral systems to be accessed according to the access parameters, calculating estimated access time consumption of the current access request according to the number of peripheral systems to be accessed, calculating historical access time consumption according to actual execution information of the historical access request, and determining the priority of the current access request according to the estimated access time consumption and the historical access time consumption;
selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster;
selecting a target thread pool under the target node according to the priority, and performing resource allocation on the current access request through the target thread pool; wherein, the access requests with different priority levels select thread pools with different priority levels.
2. The method of claim 1, wherein selecting the target node based on the resource consumption pre-determined value comprises:
when the resource consumption predicted value is larger than a preset threshold value, selecting a target node in a polling mode; and/or selecting the target node in a random mode when the resource consumption predicted value is smaller than a preset threshold value.
3. The method of claim 1, wherein selecting a target thread pool under the target node according to the priority comprises:
and selecting a target thread pool corresponding to the priority from the target node according to the preset corresponding relation between the priority and the thread pool.
4. The method according to claim 1, wherein the method further comprises:
collecting operation indexes of all ports of the cluster terminal node, and calculating available nodes and available thread pools according to the operation indexes;
the selecting a target node according to the resource consumption predicted value comprises the following steps: selecting a target node from the available nodes according to the resource consumption predicted value;
the selecting a target thread pool under the target node according to the priority comprises the following steps: and selecting a target thread pool corresponding to the priority from available thread pools under the target node.
5. The method according to claim 4, wherein the method further comprises: and when the available thread pool under the target node does not have the thread pool corresponding to the priority, selecting a target thread pool with the grade lower than the priority from the available thread pools under the target node.
6. The method of claim 1, wherein said calculating a resource consumption estimate for said current access request based on said access parameters comprises:
and acquiring a data range value to be accessed and an interface quantity value of an external system to be accessed according to the access parameter, and calculating a resource consumption predicted value of the current access request according to the data range value and the interface quantity value.
7. The method according to claim 1, wherein the method further comprises:
and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption predicted value according to the actual execution information.
8. The method according to any one of claims 1 to 7, wherein said determining the priority of the current access request according to the access parameter further comprises:
and analyzing the service type of the current access request according to the access parameter, and determining the priority of the current access request according to the service type.
9. A resource allocation apparatus, the apparatus comprising:
the request receiving module is used for receiving a current access request and acquiring access parameters of the current access request, wherein the current access request is an access request for accessing a web server cluster;
the resource estimation module is used for calculating a resource consumption predicted value of the current access request according to the access parameter, and determining the priority of the current access request according to the access parameter; wherein the determining the priority of the current access request according to the access parameter includes: determining the number of peripheral systems to be accessed according to the access parameters, calculating estimated access time consumption of the current access request according to the number of peripheral systems to be accessed, calculating historical access time consumption according to actual execution information of the historical access request, and determining the priority of the current access request according to the estimated access time consumption and the historical access time consumption;
the node selection module is used for selecting a target node according to the resource consumption predicted value, wherein the target node is a node at the tail end of the web server cluster;
the thread allocation module is used for selecting a target thread pool under the target node according to the priority, and performing resource allocation on the current access request through the target thread pool; wherein, the access requests with different priority levels select thread pools with different priority levels.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 8 when the computer program is executed by the processor.
11. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011537910.5A CN112689007B (en) | 2020-12-23 | 2020-12-23 | Resource allocation method, device, computer equipment and storage medium |
CA3143849A CA3143849A1 (en) | 2020-12-23 | 2021-12-23 | Resource allocating method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011537910.5A CN112689007B (en) | 2020-12-23 | 2020-12-23 | Resource allocation method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112689007A CN112689007A (en) | 2021-04-20 |
CN112689007B true CN112689007B (en) | 2023-05-05 |
Family
ID=75451126
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011537910.5A Active CN112689007B (en) | 2020-12-23 | 2020-12-23 | Resource allocation method, device, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112689007B (en) |
CA (1) | CA3143849A1 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114422511A (en) * | 2021-12-23 | 2022-04-29 | 北京八分量信息科技有限公司 | Method and device for managing data nodes in heterogeneous network and related products |
CN114442934B (en) * | 2021-12-27 | 2024-01-02 | 天翼云科技有限公司 | Data processing method, device and storage engine |
CN113992758B (en) * | 2021-12-27 | 2022-04-19 | 杭州金线连科技有限公司 | Dynamic scheduling method and device for system data resources and electronic equipment |
CN114327899A (en) * | 2021-12-29 | 2022-04-12 | 中国电信股份有限公司 | Method and device for responding to access request, nonvolatile storage medium and processor |
CN114745196B (en) * | 2022-04-27 | 2024-01-02 | 广域铭岛数字科技有限公司 | Interface testing method, system, electronic device and readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727499A (en) * | 2019-09-18 | 2020-01-24 | 平安科技(深圳)有限公司 | Resource data acquisition method and device, computer equipment and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107885594B (en) * | 2016-09-30 | 2020-06-12 | 腾讯科技(深圳)有限公司 | Distributed resource scheduling method, scheduling node and access node |
CN109104480B (en) * | 2018-08-06 | 2021-08-13 | 东软集团股份有限公司 | Network request processing method and device |
CN109375992A (en) * | 2018-08-17 | 2019-02-22 | 华为技术有限公司 | A kind of resource regulating method and device |
CN109783229B (en) * | 2018-12-17 | 2024-10-01 | 广州诚毅科技咨询有限公司 | Thread resource allocation method and device |
CN111274604B (en) * | 2020-01-16 | 2022-11-22 | 深圳平安医疗健康科技服务有限公司 | Service access method, device, equipment and computer readable storage medium |
-
2020
- 2020-12-23 CN CN202011537910.5A patent/CN112689007B/en active Active
-
2021
- 2021-12-23 CA CA3143849A patent/CA3143849A1/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727499A (en) * | 2019-09-18 | 2020-01-24 | 平安科技(深圳)有限公司 | Resource data acquisition method and device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CA3143849A1 (en) | 2022-06-23 |
CN112689007A (en) | 2021-04-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112689007B (en) | Resource allocation method, device, computer equipment and storage medium | |
CN110333937B (en) | Task distribution method, device, computer equipment and storage medium | |
CN109766182B (en) | System resource dynamic expansion and contraction method and device, computer equipment and storage medium | |
EP3335120B1 (en) | Method and system for resource scheduling | |
CN108205541B (en) | Method and device for scheduling distributed web crawler tasks | |
CN110597858A (en) | Task data processing method and device, computer equipment and storage medium | |
CN111104208B (en) | Process scheduling management method, device, computer equipment and storage medium | |
US8572621B2 (en) | Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria | |
US20150277772A1 (en) | Global Memory Sharing Method and Apparatus, and Communications System | |
US20120221730A1 (en) | Resource control system and resource control method | |
CN107911399B (en) | Elastic expansion method and system based on load prediction | |
US10712945B2 (en) | Deduplication processing method, and storage device | |
CN110677459A (en) | Resource adjusting method and device, computer equipment and computer storage medium | |
CN112698952A (en) | Unified management method and device for computing resources, computer equipment and storage medium | |
CN114780244A (en) | Container cloud resource elastic allocation method and device, computer equipment and medium | |
CN108156212B (en) | Elastic expansion method and system based on user perception | |
CN116346740A (en) | Load balancing method and device | |
CN112416888A (en) | Dynamic load balancing method and system for distributed file system | |
CN109062514B (en) | Bandwidth control method and device based on namespace and storage medium | |
CN114465959A (en) | Interface dynamic flow control method and device, computer equipment and storage medium | |
CN109828892B (en) | Performance test method and device of asynchronous interface, computer equipment and storage medium | |
CN112463361A (en) | Method and equipment for distributing elastic resources of distributed computation | |
US20160188434A1 (en) | Method and device for determining program performance interference model | |
CN112003900B (en) | Method and system for realizing high service availability under high-load scene in distributed system | |
CN114936089A (en) | Resource scheduling method, system, device and storage medium |
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 |