CN112689007A - Resource allocation method, device, computer equipment and storage medium - Google Patents

Resource allocation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112689007A
CN112689007A CN202011537910.5A CN202011537910A CN112689007A CN 112689007 A CN112689007 A CN 112689007A CN 202011537910 A CN202011537910 A CN 202011537910A CN 112689007 A CN112689007 A CN 112689007A
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.)
Granted
Application number
CN202011537910.5A
Other languages
Chinese (zh)
Other versions
CN112689007B (en
Inventor
朱建勇
董小强
董佳佳
吴明谦
陈雅娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Suning Cloud Computing Co ltd
Original Assignee
Jiangsu Suning Cloud Computing Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Jiangsu Suning Cloud Computing Co ltd filed Critical Jiangsu Suning Cloud Computing Co ltd
Priority to CN202011537910.5A priority Critical patent/CN112689007B/en
Publication of CN112689007A publication Critical patent/CN112689007A/en
Priority to CA3143849A priority patent/CA3143849A1/en
Application granted granted Critical
Publication of CN112689007B publication Critical patent/CN112689007B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 estimated 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; selecting a target node according to the resource consumption estimated 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 performing resource allocation on the current access request through the target thread pool. By adopting the method, the access bearing capacity can be improved in the concurrent access scene.

Description

Resource allocation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of web services, and in particular, to a resource allocation method, apparatus, computer device, and storage medium.
Background
With the development of web service technology, the magnitude of web service access requests and the frequency of requests per unit time are increasing as business data is continuously accessed to a web service platform.
However, in the conventional web service access process, for an excessive amount of access requests per unit time, even if the computing resources of the cluster allow, the access fails and cannot be accessed. This is because in a high concurrency scenario, resources of the web service cluster are not reasonably allocated and fully utilized, thereby affecting the maximum access carrying capacity and access success rate in a concurrent access scenario.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a resource allocation method, device, computer device and storage medium capable of improving access load in a concurrent access scenario.
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 estimated 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;
selecting a target node according to the resource consumption estimated 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 performing resource allocation on the current access request through the target thread pool.
In one embodiment, selecting a target node based on the resource consumption estimate comprises: and when the resource consumption estimated value is larger than a preset threshold value, selecting a target node in a polling mode.
In one embodiment, selecting a target node based on the resource consumption estimate comprises: and selecting the target node in a random mode when the resource consumption estimated 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 under 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 each port of a cluster end node, and calculating available nodes and an available thread pool according to the operation indexes;
selecting a target node according to the resource consumption estimated value, comprising: selecting a target node from the available nodes according to the resource consumption estimated value;
selecting a target thread pool under a target node according to the priority, wherein the selecting comprises the following steps: and selecting a target thread pool corresponding to the priority from the available thread pools under the target node.
In one embodiment, the method further comprises: and when no thread pool corresponding to the priority exists in the available thread pools under the target node, selecting a target thread pool with the level lower than the priority from the available thread pools under the target node.
In one embodiment, calculating a resource consumption estimate for a current access request based on access parameters includes: and acquiring a data range value required to be accessed and an interface quantity value of an external system required to be accessed according to the access parameters, and calculating a resource consumption estimated 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 estimated value according to the actual execution information.
In one embodiment, determining the priority of the current access request based on the access parameter comprises: and analyzing the service type of the current access request according to the access parameters, 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 parameter comprises: acquiring actual execution information of the historical access request, calculating estimated access time consumption of the current access request according to the 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.
An apparatus for allocating resources, the apparatus comprising:
the request receiving module is used for receiving a current access request and acquiring the 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 parameters and determining the priority of the current access request according to the access parameters;
the node selection module is used for selecting a target node according to the resource consumption estimated 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 executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned resource allocation method.
According to the resource allocation method, the resource allocation device, the computer equipment and the storage medium, the resource consumption estimated 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 estimated 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 resources can be realized in a concurrent scene, and the carrying capacity of concurrent access is improved.
Drawings
FIG. 1 is a diagram of an exemplary environment in which a method for allocating resources may be implemented;
FIG. 2 is a flow diagram illustrating a method for resource allocation in one embodiment;
FIG. 3 is a diagram of a web server cluster-based resource allocation technology architecture in an application example;
FIG. 4 is a diagram illustrating allocation of thread pools in an example application;
FIG. 5 is a block diagram showing the structure of a resource allocation apparatus according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The resource allocation method provided by the application can be applied to the application environment shown in fig. 1. The terminal 102 and the server 104 communicate with each other through a network, the server 104 is any one or more servers in a web server cluster, and 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 an access parameter of the current access request, calculates a resource consumption pre-evaluation value of the current access request according to the access parameter, determines a priority of the current access request according to the access parameter, selects a target node according to the resource consumption pre-evaluation value, selects a target thread pool under the target node according to the priority, and performs resource allocation on the current access request through the target thread pool.
In one embodiment, as shown in fig. 2, a resource allocation method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
step S202: and 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 the web server cluster.
The implementation manner of the web server cluster is not limited, and the implementation manner may be implemented by mutually connecting a plurality of web server hosts, for example, a server architecture including a load balancer and a plurality of end nodes, where the load balancer may be software or hardware, and the end nodes may be homogeneous or heterogeneous servers; the method can also be realized by clustering a plurality of independently working web application servers on one physical server; the method can also be implemented in a manner of registering a web Service on an RSF platform based on an RSF (Remote Service Framework).
The access parameter refers to relevant request data indicating completion of web service access, 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 the access belongs or a type containing a service, and the like.
Specifically, when receiving a current access request for accessing the web server cluster sent by the terminal, the server may parse the current access request, and obtain, from the current access request, relevant request data as an access parameter.
Step S204: and calculating a resource consumption estimated 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 estimation value refers to a resource value expected to be consumed after the current access request is processed, that is, a corresponding resource value expected to be consumed in response to the current access request is returned according to the current access request. The priority can be used to indicate the importance of the current access request, and the higher the priority, the higher the importance of the access request, the higher the user's expectation for its normal execution.
Specifically, for the calculation of the resource consumption estimation value, the server may perform filtering factor calculation by an exponential back-off algorithm according to the access parameter, so as to obtain a data range to be accessed and the number of external interfaces to be accessed, and estimate the resource consumption value based on the data range to be accessed and the number of external interfaces to be accessed. For the determination of the priority, the server may extract the service type, the service scenario, or the service data of the current access request from the access parameter, so as to determine the priority of the current access request, or may determine the priority of the current access request by estimating a resource value or a duration expected to be consumed by the current access request, and combining with a relevant reference of historical access requests of each priority level.
Step S206: and selecting a target node according to the resource consumption estimated 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 estimated value of the current access request, select a suitable node from nodes at the end (back end) of the cluster for the current access request through the node selection policy as a target node, 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 performing resource allocation on the current access request through the target thread pool.
The target thread pool is a thread pool subordinate to a target node, specifically, the server can trigger a corresponding thread pool allocation strategy according to the priority of the current access request, the server selects a proper thread pool from the thread pool subordinate to the target node as the target thread pool according to the corresponding thread pool allocation strategy, and after pushing 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 strategy, so that the target thread pool can perform resource allocation on the current access request and perform subsequent processing.
According to the resource allocation method, the resource consumption estimated 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 estimated value and the priority, and the resource allocation is performed on the current access request through the target thread pool, so that the reasonable allocation of cluster resources can be realized in a concurrent scene, and the carrying capacity of concurrent access is improved.
In one embodiment, selecting a target node based on the resource consumption estimate comprises: selecting a target node in a polling mode when the resource consumption estimated value is larger than a preset threshold value; and/or selecting the target node in a random mode when the resource consumption estimated value is smaller than a preset threshold value.
In this embodiment, the setting manner of the threshold is not limited, the initialization threshold may be obtained from a test environment or a pressure test environment, and the initialization threshold may be adjusted and optimized in a production environment. For an access request with a resource consumption estimated value larger than a threshold, the resource consumption may be more, and the execution time may be longer, so that a polling scheduling manner may be adopted to ensure that each node at the end of the cluster can implement load balancing. For the access request with the resource consumption estimated value smaller than the threshold, the resource consumption is probably less, and the execution time consumption is shorter, so the scheduling speed can be improved by adopting a random mode. In this embodiment, different node selection (concurrency) strategies are adopted according to different resource consumption estimated values, so that the utilization rate of concurrency and 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 under 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 divided into 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. In this embodiment, access requests of different levels are allocated to thread pools of different levels according to priorities of the access requests, so that the access requests of different levels are isolated, and therefore, the access requests of different levels do not interfere with each other, especially, an access with a higher priority is not hindered by an access with a lower priority arranged in front, response delay of an access with a higher priority can be reduced, resource contention is reduced, and thus, the carrying capacity of services of each level is ensured.
In one embodiment, the method may further include: collecting operation indexes of all ports of a cluster end node, calculating available nodes according to the operation indexes, and selecting a target node according to a resource consumption estimated value, wherein the method comprises the following steps: and selecting a target node from the available nodes according to the resource consumption estimated value.
The collection mode of the operation index of each port of the cluster end node is not limited, and for example, the operation index can be collected through a real-time task and an off-line task, or can be collected manually and periodically. Specifically, the real-time acquisition is as follows: aiming at data with high timeliness requirements, acquiring real-time data through a real-time computing engine Flink; and (3) offline acquisition: automatically triggering an acquisition task according to time granularity (such as minutes, hours and the like); manual collection: manual collection of non-regularized data.
The operation index of each port of the cluster end node includes a parameter value and an actual value, and may include, for example, 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 an accessed service port.
In this embodiment, the current use state of each node may be calculated through the collected operation indexes of each port of the cluster end node, and a node whose resource utilization rate is lower than a preset standard may be used as an available node, and the target node may be selected 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.
Further, the method can also calculate an available thread pool according to the collected operation indexes of each port of the cluster end node, and select a target thread pool under a target node according to the priority, and comprises the following steps: and selecting a target thread pool corresponding to the priority from the available thread pools under the target node.
Specifically, the thread pool with the current thread occupancy rate lower than the preset standard can be used as an available thread pool according to the use state of the thread pool under the node, and the target thread pool is selected based on the available thread pool. Thus, the problems of low resource utilization rate and reduced concurrency caused by unbalanced thread occupancy rates of the thread pools can be avoided.
Further, the method further comprises: and when no thread pool corresponding to the priority exists in the available thread pools under the target node, selecting a target thread pool with the level lower 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 access request with a higher level can be allowed to use the thread pool corresponding to the access request with a lower level, so that the response delay of the access with a higher level is reduced, and the normal response of the important service is preferentially ensured.
In one embodiment, calculating a resource consumption estimate for a current access request based on access parameters includes: and acquiring a data range value required to be accessed and an interface quantity value of an external system required to be accessed according to the access parameters, and calculating a resource consumption estimated value of the current access request according to the data range value and the interface quantity value.
Specifically, the server may analyze the current access request, and obtain a data range value that needs to be accessed and an interface quantity value of an external system that needs to be accessed through analysis, thereby calculating a resource consumption estimate 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 estimated 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, actual call time, actual thread occupation, actual execution bare time, and the like, and the actual execution information of the current access request is used as historical reference data, and a calculation manner of a resource consumption pre-estimation value of a subsequent access request is adjusted through algorithms such as machine learning or artificial intelligence, so as to improve calculation accuracy and reduce misjudgment.
In one embodiment, determining the priority of the current access request based on the access parameter comprises: and analyzing the service type of the current access request according to the access parameters, and determining the priority of the current access request according to the service type.
Specifically, the access parameter may include data related to a service, and the service type to which the current access request belongs may be determined according to the data, and in general, the service type may represent an importance degree or an expected degree of the service, so that the priority of the current access request may be determined according to a preset correspondence between the service type and the priority.
In one embodiment, determining the priority of the current access request based on the access parameter comprises: acquiring actual execution information of the historical access request, calculating estimated access time consumption of the current access request according to the 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 by combining with actual execution information of the historical access request. The actual execution information of the historical access request can be obtained by acquiring access related data such as access times within a certain time, call time, thread occupation, execution bare time, times of execution bare time exceeding an SLA (Service-Level Agreement) and the like, and the information acquisition mode is not limited and can refer to the mode of acquiring the operation index 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:
step 1, according to the access parameters, performing the analysis of the execution step and the splitting of the calculation of the number of the peripheral systems to be accessed.
And 2, calculating estimated reference time consumption according to the analyzed execution step, calculating historical reference time consumption according to 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 a high priority by referring to the historical reference time consumption.
And 3, calculating estimated access time consumption according to the number of peripheral systems to be accessed, calculating historical access time consumption according to actual execution information of the historical access requests, and determining the access requests with access time consumption larger than the historical access time consumption as high priority by referring to the historical access time consumption.
Further, the method can also comprise the following steps:
and 4, recording the actual reference time consumption of each analysis step of the current access request. The actual reference time consumption conforms to 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 for accessing each peripheral system. The actual visit time conforms to 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 to fig. 3, fig. 3 illustrates a technical architecture diagram of a web server cluster (e.g., wildflash cluster) based resource allocation for an application instance.
For the data acquisition unit, data acquisition can be performed from two dimensions of an access request and a service port. Access request dimension: the method comprises the steps of access times, time consumption of calling, thread occupation, execution bare time exceeding SLA times and the like. Service port dimension: including the half connection queue size, full connection queue size, the number of full connection queue overflows, the number of half connection queue overflows, etc. of the service port being accessed. The collection mode may specifically include real-time task collection, offline task collection, and manual periodic collection. Collecting in real time: and aiming at the data with high timeliness requirement, acquiring real-time data through a real-time computing engine Flink. And (3) offline acquisition: the collection task is automatically triggered by a time granularity (e.g., minutes, hours, etc.). Manual collection: manual collection of non-regularized data. The collected data can be stored in a database, and when the current access request is received and the resource allocation is carried out on the current access request, the current access request is used as a reference for resource calculation, and the data collection can be accompanied with the whole process.
For the resource calculation module, when a current access request is received, reference estimation (resource consumption estimated value and priority) and scene estimation (available nodes and available thread pools) are carried out according to access parameters of the current access request and 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 can specifically refer to fig. 4, where fig. 4 shows an allocation diagram of the thread pool implemented by an application. The thread pool can be divided into a high-priority thread pool and a low-priority thread pool, requests are distributed to the corresponding thread pools according to the priority of the access requests, and the low-priority thread pool is allowed to be used at high priority when being idle.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 2 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of 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:
a request receiving module 10, configured to receive a current access request, and obtain an access parameter of the current access request, where the current access request is an access request for accessing a web server cluster;
the resource estimation module 20 is configured to calculate a resource consumption prediction 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 used for selecting a target node according to the resource consumption estimated value, wherein the target node is a node at the tail end of the web server cluster;
and the thread allocation module 40 is configured to select a target thread pool under the target node according to the priority, and perform resource allocation on 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 estimation value is greater than the preset threshold value.
In one embodiment, the node selection module 30 selects the target node in a random manner when the resource consumption estimation value is smaller than the preset threshold.
In one embodiment, the thread allocation module 40 selects a target thread pool corresponding to the priority level under the target node according to a preset corresponding relationship between the priority level and the thread pool.
In one embodiment, the apparatus further includes a data collection module 50, configured to collect operation indexes of each port of a cluster end node, calculate available nodes and available thread pools according to the operation indexes, select a target node from the available nodes according to the resource consumption prediction value by the node selection module 30, and select a target thread pool corresponding to a priority from the available thread pools below the target node by the thread allocation module 40.
In one embodiment, the thread allocation module 40 is further configured to select a target thread pool with a lower level than the priority level from the available thread pools under the target node when there is no thread pool corresponding to the priority level in 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 quantity value of an external system to be accessed according to the access parameter, and calculates a resource consumption estimation value of the current access request according to the data range value and the interface quantity 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 prediction value according to the actual execution information.
In one embodiment, the resource estimation module 20 analyzes the service type of the current access request 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 an estimated access time of the current access request according to the access parameter, and determines a priority of the current access request according to the estimated access time and the actual execution information of the historical access request.
For specific limitations of the resource allocation apparatus, reference may be made to the above limitations of the resource allocation method, which is not described herein again. The modules in the resource allocation apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram 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 comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. 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.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those 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 following steps 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 estimated 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; selecting a target node according to the resource consumption estimated 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 performing 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 estimation value, the following steps are specifically implemented: and when the resource consumption estimated value is larger than a preset threshold value, selecting a target node in a polling mode.
In one embodiment, when the processor executes the computer program to select the target node according to the resource consumption estimation value, the following steps are specifically implemented: and selecting the target node in a random mode when the resource consumption estimated value is smaller than a preset threshold value.
In one embodiment, when the processor executes the computer program to select the target thread pool under the target node according to the priority, the following steps are specifically implemented: and selecting a target thread pool corresponding to the priority under 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 all 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 specifically select target nodes from the available nodes according to a resource consumption pre-estimation value when the target nodes are selected according to the resource consumption pre-estimation value, and executing the computer program by the processor to specifically select target thread pools corresponding to 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: and when no thread pool corresponding to the priority exists in the available thread pools under the target node, selecting a target thread pool with the level lower 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 estimation value of the current access request according to the access parameter, the following steps are specifically implemented: and acquiring a data range value required to be accessed and an interface quantity value of an external system required to be accessed according to the access parameters, and calculating a resource consumption estimated 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 estimated 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 parameters, 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: acquiring actual execution information of the historical access request, calculating estimated access time consumption of the current access request according to the 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 estimated 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; selecting a target node according to the resource consumption estimated 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 performing 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 implement the selection of the target node according to the resource consumption estimate, the following steps are implemented: and when the resource consumption estimated value is larger than a preset threshold value, selecting a target node in a polling mode.
In one embodiment, when the computer program is executed by the processor to implement the selection of the target node according to the resource consumption estimate, the following steps are implemented: and selecting the target node in a random mode when the resource consumption estimated value is smaller than a preset threshold value.
In one embodiment, when the computer program is executed by the processor to implement selecting the target thread pool under the target node according to the priority, the following steps are specifically implemented: and selecting a target thread pool corresponding to the priority under the target node according to the preset corresponding relation between the priority and the thread pool.
In one embodiment, the computer program when executed by the processor further performs the steps of: the method comprises the steps of collecting operation indexes of all ports of end nodes of a cluster, calculating available nodes and available thread pools according to the operation indexes, enabling a computer program to be executed by a processor to specifically select target nodes from the available nodes according to a resource consumption estimated value when the computer program is executed to realize selection of the target nodes according to the resource consumption estimated value, and enabling the computer program to be executed by the processor to specifically realize selection of target thread pools corresponding to priorities from the available thread pools below the target nodes when the computer program is executed to realize selection of the target thread pools below the target nodes according to the priorities.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when no thread pool corresponding to the priority exists in the available thread pools under the target node, selecting a target thread pool with the level lower 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 implement the calculation of the resource consumption estimate for the current access request based on the access parameter, the following steps are implemented: and acquiring a data range value required to be accessed and an interface quantity value of an external system required to be accessed according to the access parameters, and calculating a resource consumption estimated value of the current access request according to the data range value and the interface quantity value.
In one embodiment, the computer program when executed by the processor further performs the steps of: and acquiring actual execution information of the current access request, and adjusting a calculation mode of the resource consumption estimated value according to the actual execution information.
In one embodiment, the computer program when executed by the processor for implementing the method for determining the priority of a current access request based on the access parameter specifically implements the steps of: and analyzing the service type of the current access request according to the access parameters, and determining the priority of the current access request according to the service type.
In one embodiment, the computer program when executed by the processor for implementing the method for determining the priority of a current access request based on the access parameter specifically implements the steps of: acquiring actual execution information of the historical access request, calculating estimated access time consumption of the current access request according to the 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.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile 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), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of resource allocation, the method comprising:
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;
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;
selecting a target node according to the resource consumption estimated 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 performing resource allocation on the current access request through the target thread pool.
2. The method of claim 1, wherein said selecting a target node based on said resource consumption estimate comprises:
when the resource consumption estimated 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 estimated 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 under the target node according to the preset corresponding relation between the priority and the thread pool.
4. The method of claim 1, further comprising:
collecting operation indexes of all ports of the cluster tail end node, and calculating available nodes and available thread pools according to the operation indexes;
the selecting the target node according to the resource consumption estimated value comprises the following steps: selecting a target node from the available nodes according to the resource consumption estimated value;
selecting a target thread pool under the target node according to the priority comprises: selecting a target thread pool corresponding to the priority from available thread pools under the target node;
preferably, the method further comprises: and when no thread pool corresponding to the priority exists in the available thread pools under the target node, selecting a target thread pool with the level lower than the priority from the available thread pools under the target node.
5. The method of claim 1, wherein said calculating a resource consumption estimate for the current access request based on the access parameter comprises:
and acquiring a data range value required to be accessed and an interface quantity value of an external system required to be accessed according to the access parameter, and calculating a resource consumption estimated value of the current access request according to the data range value and the interface quantity value.
6. The method of claim 1, further comprising:
and acquiring actual execution information of the current access request, and adjusting a calculation mode of a resource consumption estimated value according to the actual execution information.
7. The method of any of claims 1 to 6, wherein the determining the priority of the current access request according to the access parameter comprises:
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; or the like, or, alternatively,
acquiring actual execution information of a historical access request, calculating estimated access time consumption of the current access request according to the 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.
8. An apparatus for resource allocation, 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 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 estimated 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.
9. 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 steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202011537910.5A 2020-12-23 2020-12-23 Resource allocation method, device, computer equipment and storage medium Active CN112689007B (en)

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 true CN112689007A (en) 2021-04-20
CN112689007B 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)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113992758A (en) * 2021-12-27 2022-01-28 杭州金线连科技有限公司 Dynamic scheduling method and device for system data resources and electronic equipment
CN114422511A (en) * 2021-12-23 2022-04-29 北京八分量信息科技有限公司 Method and device for managing data nodes in heterogeneous network and related products
CN114442934A (en) * 2021-12-27 2022-05-06 天翼云科技有限公司 Data processing method and device and storage engine
CN114745196A (en) * 2022-04-27 2022-07-12 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109104480A (en) * 2018-08-06 2018-12-28 东软集团股份有限公司 A kind of processing method and processing device of network request
CN109375992A (en) * 2018-08-17 2019-02-22 华为技术有限公司 A kind of resource regulating method and device
US20190108069A1 (en) * 2016-09-30 2019-04-11 Tencent Technology (Shenzhen) Company Limited Distributed resource allocation method, allocation node, and access node
CN109783229A (en) * 2018-12-17 2019-05-21 平安普惠企业管理有限公司 The method and device of thread resources distribution
CN110727499A (en) * 2019-09-18 2020-01-24 平安科技(深圳)有限公司 Resource data acquisition method and device, computer equipment and storage medium
CN111274604A (en) * 2020-01-16 2020-06-12 平安医疗健康管理股份有限公司 Service access method, device, equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190108069A1 (en) * 2016-09-30 2019-04-11 Tencent Technology (Shenzhen) Company Limited Distributed resource allocation method, allocation node, and access node
CN109104480A (en) * 2018-08-06 2018-12-28 东软集团股份有限公司 A kind of processing method and processing device of network request
CN109375992A (en) * 2018-08-17 2019-02-22 华为技术有限公司 A kind of resource regulating method and device
CN109783229A (en) * 2018-12-17 2019-05-21 平安普惠企业管理有限公司 The method and device of thread resources distribution
CN110727499A (en) * 2019-09-18 2020-01-24 平安科技(深圳)有限公司 Resource data acquisition method and device, computer equipment and storage medium
CN111274604A (en) * 2020-01-16 2020-06-12 平安医疗健康管理股份有限公司 Service access method, device, equipment and computer readable storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
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
CN113992758A (en) * 2021-12-27 2022-01-28 杭州金线连科技有限公司 Dynamic scheduling method and device for system data resources and electronic equipment
CN113992758B (en) * 2021-12-27 2022-04-19 杭州金线连科技有限公司 Dynamic scheduling method and device for system data resources and electronic equipment
CN114442934A (en) * 2021-12-27 2022-05-06 天翼云科技有限公司 Data processing method and device and storage engine
CN114442934B (en) * 2021-12-27 2024-01-02 天翼云科技有限公司 Data processing method, device and storage engine
CN114745196A (en) * 2022-04-27 2022-07-12 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium
CN114745196B (en) * 2022-04-27 2024-01-02 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium

Also Published As

Publication number Publication date
CN112689007B (en) 2023-05-05
CA3143849A1 (en) 2022-06-23

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
CN109218355B (en) Load balancing engine, client, distributed computing system and load balancing method
CN109597685B (en) Task allocation method, device and server
CN109787908B (en) Server current limiting method, system, computer equipment and storage medium
CN110489447B (en) Data query method and device, computer equipment and storage medium
CN110597858A (en) Task data processing method and device, computer equipment and storage medium
EP3335120B1 (en) Method and system for resource scheduling
US20120221730A1 (en) Resource control system and resource control method
US8572621B2 (en) Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
CN107911399B (en) Elastic expansion method and system based on load prediction
US20200012602A1 (en) Cache allocation method, and apparatus
CN108449237B (en) Network performance monitoring method and device, computer equipment and storage medium
CN112068934B (en) Control system and method for shrinking container cloud service instance
CN111666131A (en) Load balancing distribution method and device, computer equipment and storage medium
CN112612618A (en) Interface current limiting method and device, computer equipment and storage medium
CN116346740A (en) Load balancing method and device
CN110489227B (en) Resource allocation method, device, computer equipment and storage medium
CN108156212B (en) Elastic expansion method and system based on user perception
CN113268350A (en) Resource allocation method and device based on cloud service construction and computer equipment
EP3046029B1 (en) Method and device for determining program performance interference model
CN113691587B (en) Virtual resource processing method and device, electronic equipment and storage medium
CN114936089A (en) Resource scheduling method, system, device and storage medium
CN112003900B (en) Method and system for realizing high service availability under high-load scene in distributed system
CN113419863B (en) Data distribution processing method and device based on node capacity

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