CN111767132A - Method, apparatus, device and computer readable medium for allocating resources - Google Patents

Method, apparatus, device and computer readable medium for allocating resources Download PDF

Info

Publication number
CN111767132A
CN111767132A CN201910548455.XA CN201910548455A CN111767132A CN 111767132 A CN111767132 A CN 111767132A CN 201910548455 A CN201910548455 A CN 201910548455A CN 111767132 A CN111767132 A CN 111767132A
Authority
CN
China
Prior art keywords
service
resource
unit
newly added
resource amount
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910548455.XA
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910548455.XA priority Critical patent/CN111767132A/en
Publication of CN111767132A publication Critical patent/CN111767132A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method, a device, equipment and a computer readable medium for allocating resources, and relates to the technical field of computers. One embodiment of the method comprises: acquiring newly added resource quantity of the service based on service request hardware equipment and a minimum service unit of the request hardware equipment; the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service, and after the number of actual hardware equipment is increased according to the newly added resource quantity of the service, resources are allocated to the service; and the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service, and resources are allocated to the service. The method and the device can improve the accuracy of measuring the application amount of the resources, and further accurately allocate the resources.

Description

Method, apparatus, device and computer readable medium for allocating resources
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer-readable medium for allocating resources.
Background
IT resources, which are important cost components in an enterprise, include servers, network devices, and rack bandwidth, among others. In the current process of applying for IT resources, the requirements for the IT resources are explained through multiple dimensions, and then resources are allocated for services based on the applied IT resources. Common application IT resources may include:
(1) and evaluating the number of the IT application resources based on the number of the historical IT application resources.
(2) And evaluating the quantity of the application IT resources through external requirements.
(3) And evaluating the quantity of the request IT resources through the load pressure of the hardware.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: the amount of application of resources is often very different from the amount of demand of resources, which makes it difficult to accurately allocate resources.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a computer readable medium for allocating resources, which can improve accuracy of measuring an amount of application of resources, and further accurately allocate resources.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of allocating resources, including:
acquiring the newly added resource quantity of the service based on service request hardware equipment and a minimum service unit of the request hardware equipment, wherein the minimum service unit is a combination of the request hardware equipment for processing the service;
the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service, and after the number of actual hardware equipment is increased according to the newly added resource quantity of the service, resources are allocated to the service, wherein the number of the actual hardware equipment is a parameter determined by a minimum service unit;
and the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service, and resources are allocated to the service.
The acquiring, based on the service request hardware device and the minimum service unit of the request hardware device, the newly added resource amount of the service includes:
determining a minimum service unit of the request hardware equipment based on the service request hardware equipment;
and acquiring the newly added resource quantity of the service according to the quantity of the request hardware equipment, the unit hardware quantity of the minimum service unit of the request hardware equipment and the unit resource quantity of the minimum service unit of the request hardware equipment.
After the number of the actual hardware devices is increased according to the newly added resource amount of the service and before the resources are allocated to the service, the method further includes:
and determining the number of the actual hardware equipment according to the theoretical resource quantity of the service, the peak resource quantity of the service, the newly-added resource quantity of the service, the unit resource quantity of the minimum service unit of the actual hardware equipment and the unit hardware quantity of the minimum service unit of the actual hardware equipment.
After increasing the number of the actual hardware devices according to the newly increased resource amount of the service, the method further includes:
updating the inventory resource amount of the business based on the number of the actual hardware devices, the unit resource amount of the minimum service unit of the actual hardware devices, and the unit hardware amount of the minimum service unit of the actual hardware devices.
The difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, and after the number of the actual hardware devices is increased according to the newly added resource amount of the service, resources are allocated to the service, including:
in a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service,
and if the newly-added resource quantity of the service is larger than or equal to the reserved resource quantity of the period, increasing the quantity of the reserved resource quantity of the next period corresponding to the actual hardware equipment, and then allocating resources for the service.
The difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, and after the number of the actual hardware devices is increased according to the newly added resource amount of the service, resources are allocated to the service, including:
in a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service,
and if the newly added resource amount of the service is smaller than the reserved resource amount in the period, allocating resources for the service after increasing the number of actual hardware equipment according to the newly added resource amount of the service.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for allocating resources, including:
a conversion module, configured to obtain a newly added resource amount of a service based on a service request hardware device and a minimum service unit of the request hardware device, where the minimum service unit is a combination of the request hardware devices that process the service;
a first allocation module, configured to allocate resources to the service after a difference between a theoretical resource amount of the service and a peak resource amount of the service is smaller than a newly added resource amount of the service and increasing a number of actual hardware devices according to the newly added resource amount of the service, where the number of actual hardware devices is a parameter determined by a minimum service unit;
and the second allocation module is used for allocating resources for the service, wherein the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service.
The conversion module is specifically configured to determine, based on the service request hardware device, a minimum service unit of the request hardware device;
and acquiring the newly added resource quantity of the service according to the quantity of the request hardware equipment, the unit hardware quantity of the minimum service unit of the request hardware equipment and the unit resource quantity of the minimum service unit of the request hardware equipment.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for allocating resources, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method as described above.
One embodiment of the above invention has the following advantages or benefits: because the newly added resource amount of the service is obtained based on the service request hardware device and the minimum service unit of the request hardware device. The difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly increased resource quantity of the service, which indicates that the current available resource quantity is difficult to meet the requirement of the service, and the resources are allocated to the service after the actual hardware quantity is increased according to the newly increased resource quantity of the service; the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly added resource demand quantity of the service, and if the current available resource quantity can meet the requirement of the service, the resource is distributed to the service. Based on the theoretical resource quantity of the service, the peak resource quantity of the service and the newly added resource quantity of the service, the accuracy of measuring the application quantity of the resources can be improved, and further whether hardware needs to be added or not can be determined, and accurate resource distribution for the service is guaranteed.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of allocating resources according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a split service according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating resource amounts in an embodiment of the present invention;
FIG. 4 is a diagram illustrating an amount of newly added resources in an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a main flow of a method for periodically allocating resources according to an embodiment of the present invention;
FIG. 6 is a resource diagram illustrating a periodic allocation of resources according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a main structure of an apparatus for allocating resources in an embodiment of the present invention;
FIG. 8 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 9 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the process of applying for IT resources, in order to meet the requirements of end users, the number of hardware is often increased according to the amount of applied resources. The importance of the inventory resources in the resource application process is ignored. Compared with the latest servers, the stock resources comprise a large number of servers with poor computing power, and can still run business normally.
In consideration of the stock resources, the actual demand of the resources is often less than the application amount of the resources, and the application amount of the resources is greatly different from the demand of the resources.
In order to solve the problem of difficulty in accurately allocating resources, the following technical scheme in the embodiment of the present invention may be adopted.
Referring to fig. 1, fig. 1 is a schematic diagram of a main flow of a method for allocating resources according to an embodiment of the present invention, and determines whether to add actual hardware data to allocate resources based on a theoretical resource amount of a service, a peak resource amount of the service, and a newly added resource amount of the service. As shown in fig. 1, the method specifically comprises the following steps:
s101, acquiring the newly added resource quantity of the service based on the service request hardware equipment and the minimum service unit of the request hardware equipment, wherein the minimum service unit is the combination of the request hardware equipment for processing the service.
For each service, resources are required to operate. The resources may include IT resources. As one example, the service may be an application (App).
In the process of applying for resources, in order to meet the requirement of a user for running a service, a request hardware device for running the service is often directly applied. Such as: the server, the concrete parameter includes: CPU is a 16-core 32 thread; the memory is 64G; the hard disk is 8 Terabytes (TB).
The method aims to avoid resource waste on the premise of guaranteeing normal operation of the service. The amount of resources required to be added for converting the requested hardware device into a service is measured in terms of the amount of resources.
The minimum service unit is a combination of requesting hardware devices that handle the traffic. Since the parameters of different hardware devices are different, the minimum service unit corresponds to the hardware device. The minimum service unit includes the following parameters: the hardware name of the minimum service unit, the number of unit hardware of the minimum service unit, and the amount of unit resources of the minimum service unit.
The minimum service unit includes a fixed number of hardware devices, a name of the hardware device is a hardware name of the minimum service unit, a number of the hardware devices is a unit hardware number of the minimum service unit, and an amount of resources provided by the fixed number of hardware devices is a unit resource amount of the minimum service unit.
As an example, the minimum service unit includes 5 servers of model 123, and each server of model 123 provides an amount of resources of 100. Hardware name of minimum service unit: a server of type 123; the number of unit hardware of the minimum service unit is 5; the minimum serving cell has a cell resource amount of 500.
In the embodiment of the present invention, from the perspective of the service, one or more metrics may be split for each service. Each metric has a corresponding amount of inventory resources. As an example, the service includes stored data, and the metric may be the capacity to store data; alternatively, the metric may be the speed at which the data is stored, etc.
The stock resource amount is the maximum amount of resources that can provide a service for a business. As an example, for storing data, the metric is the capacity of the stored data, and the amount of stock service resources may be 1000 Terabytes (TB).
Referring to fig. 2, fig. 2 is a schematic diagram of a splitting service according to an embodiment of the present invention. In fig. 2, the service may be split according to the metric a or the metric B. The split is performed according to the metric a, and the minimum service unit a can be used to process the service. The minimum service unit a includes: 6 servers with model 456. Splitting according to the metric B, and processing the service by using the minimum service unit B, where the minimum service unit B includes: 5 servers with model 456.
Referring to table 1, table 1 is a parameter schematic table of a minimum service unit.
TABLE 1
Minimum service unit name Amount of unit resource Hardware name Number of unit hardware
Minimum service unit A 100G Server 1 6
Minimum service unit B 200G Server 1 6
The parameters in table 1 are parameters related to the minimum service unit, for example, a service, specifically, a storage service. The minimum service unit a includes 6 servers 1; the minimum service unit B includes 6 servers 1. The storage capacity available for each server 1 is 100G.
The metric for minimum service unit a is to set 6 copies. Then, the unit resource amount of the minimum service unit a is: the (100G × 6 servers 1)/6 copies become 100G.
The metric for minimum service unit B is to set 3 copies. Then, the unit resource amount of the minimum service unit B is: the (100G × 6 servers 1)/3 copies are 200G.
It can be understood that the unit resource amount of a minimum service unit a is 100G; the unit resource amount of one minimum service unit B is 200G.
As an example, the service is specifically a storage service, and the storage service 1 requires a resource amount of 1T. For the measurement standard of setting 6 copies, 10 minimum service units A are needed; for the metric to set 3 copies, 5 minimum service units B are needed.
It should be noted that the unit resource amount of the minimum service unit is preset for two parameters, namely, traffic and a metric. If the service and/or the metric changes, the unit resource amount of the minimum service unit changes accordingly.
In one embodiment of the invention, the newly added resource amount of the service may be obtained as follows. First, based on a service request hardware device, a minimum service unit of the request hardware device is determined. The service request hardware device is a hardware device for which a user provides parameters, for which a minimum service unit is determined. And then, acquiring the newly added resource quantity of the service according to the quantity of the requested hardware equipment, the unit hardware quantity of the minimum service unit of the requested hardware equipment and the unit resource quantity of the minimum service unit of the requested hardware equipment.
Specifically, the newly added resource amount is the number of the requesting hardware devices × the unit resource amount of the minimum service unit of the requesting hardware devices/the unit hardware number of the minimum service unit of the requesting hardware devices.
As an example, along the minimum service unit a referred to in table 1. The requesting hardware device is the server 1, and the number of the requesting hardware devices is 12. The new resource amount is 12 multiplied by 100G/6 multiplied by 200G.
In the above embodiment, the service request hardware device is characterized in the form of the newly added resource amount of the service, so that the actual resource demand amount of the service can be accurately measured.
S102, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service, and after the quantity of the actual hardware equipment is increased according to the newly added resource quantity of the service, the resources are distributed for the service, wherein the quantity of the actual hardware equipment is a parameter determined by the minimum service unit.
In the embodiment of the present invention, the resource amount involved in the service includes, but is not limited to, the following resource amounts: theoretical resource amount, peak resource amount, used resource amount, and stock resource amount.
The theoretical resource amount is the maximum used resource amount of a Service-Level agent (SLA) support Service. It can be understood that the actual used resource amount is smaller than the theoretical resource amount, so that the reliability of the service can be guaranteed.
The peak amount of resources is the maximum amount of used resources for traffic within a preset time period. The amount of used resources is the amount of resources currently used by the service.
The inventory resource amount is the ultimate amount of resources available to the business. That is, the actual used resource amount is larger than the theoretical resource amount and smaller than the stock resource amount, and the business can be operated, but it is difficult to ensure the reliability of the service.
Referring to fig. 3, fig. 3 is a schematic diagram of resource amount in the embodiment of the present invention. The amount of inventory resources is equal to the sum of the theoretical amount of resources and the amount of buffer resources. The buffer resource in the buffer resource amount is a resource for buffering a service, and it is difficult to guarantee the reliability of the service using the buffer resource. The peak resource amount is less than the theoretical resource amount. The amount of used resources is less than the theoretical amount of resources.
The theoretical resource amount and the stock resource amount are parameters that can be obtained by pressure measurement. The used resource amount and the peak resource amount are parameters which can be directly measured and known.
In the embodiment of the invention, the service needs to allocate resources to normally operate. For a service, the theoretical resource amount of the service and the peak resource amount of the service may be obtained.
The new resource amount is the resource amount which is newly added by the user application. In the embodiment of the invention, the number of the hardware devices is not directly increased according to the amount of the newly added resources so as to meet the requirements of users.
Considering that the difference between the theoretical resource amount of the service and the peak resource amount of the service represents the available resource amount of the service, and if the available resource amount is smaller than the newly added resource amount of the service, it indicates that the available resource amount is difficult to meet the resource requirement of the user, the amount of hardware equipment needs to be increased to expand the available resource amount of the service.
Referring to fig. 4, fig. 4 is a schematic diagram of an amount of newly added resources in the embodiment of the present invention. Fig. 4 includes two new resource amounts, i.e., a new resource amount 1 and a new resource amount 2. Newly adding a resource amount 1 which is smaller than the difference value between the theoretical resource amount and the peak resource amount; and the newly added resource amount 2 is larger than the difference value between the theoretical resource amount and the peak resource amount.
In the embodiment of the present invention, when the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, that is, the difference is equivalent to the newly added resource amount 2 in fig. 4, it indicates that the current available resource amount is difficult to meet the actual requirement, and hardware devices need to be added to expand the current available resource amount to meet the actual requirement.
In the embodiment of the invention, the number of the actual hardware equipment can be increased according to the newly added resource amount of the service. Considering that the minimum service unit is a combination of requesting hardware devices that handle traffic, the number of actual hardware devices added may be determined in conjunction with the minimum service unit.
In an embodiment of the present invention, the number of the actual hardware devices may be determined by a theoretical resource amount of the service, a peak resource amount of the service, a newly added resource amount of the service, a unit resource amount of the minimum service unit of the actual hardware device, and a unit hardware amount of the minimum service unit of the actual hardware device.
The number of actual hardware devices is the unit hardware number of the minimum service unit x [ new resource amount- (theoretical resource amount-peak resource amount) ]/(unit resource amount of the minimum service unit x service resource ratio)
(1)
Wherein, the service resource proportion is equal to the ratio of the theoretical resource quantity to the stock resource quantity.
The number of actual hardware devices added can be determined on the basis of the minimum service unit according to equation (1).
It should be noted that, in order to increase the amount of available resources, the actual hardware devices need to be increased. The actual hardware device may be the same as or different from the requesting hardware device involved in the newly added amount of resources of the service. For example, two servers with the parameter a are newly added to a certain gate, and the requesting hardware device is the server with the parameter a. Then, only the server of the B parameter can be purchased according to the specification, and the actual hardware equipment is the server of the B parameter. By adopting the technical scheme of the embodiment of the invention, the resource amount provided by the actual hardware equipment is more than or equal to the resource amount of the requested hardware equipment, so that the requirement of a user can be met.
In an embodiment of the present invention, after adding an actual hardware device to an existing hardware device, if the stock resource amount of the service changes, the stock resource amount of the service is updated based on the number of the actual hardware device, the unit resource amount of the minimum service unit of the actual hardware device, and the unit hardware amount of the minimum service unit of the actual hardware device.
The inventory resource amount is the existing inventory resource amount + the number of actual hardware devices × the unit resource amount of the minimum service unit/the unit hardware number of the minimum service unit
(2)
From equation (2), the inventory resource amount of the acquired traffic can be calculated.
And after the actual hardware equipment is added according to the newly increased resource quantity of the service, if the available resource of the current service is larger than the newly increased resource quantity of the service, allocating the resource for the service to operate the service.
S103, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is larger than or equal to the newly added resource quantity of the service, and resources are distributed for the service.
If the difference between the theoretical resource amount of the service and the peak resource amount of the service is greater than or equal to the newly added resource amount of the service, it indicates that the available resources of the current service are greater than the newly added resource amount of the service, and the requirements of the user can be met, and the resources can be directly allocated to the service without increasing actual hardware equipment.
In the embodiment of the invention, the service can normally run only when needing resources, and the newly added resource amount of the service corresponding to the service request hardware equipment is measured by the minimum service unit. And then, measuring the stock resource by the difference between the theoretical resource quantity of the service and the peak resource quantity of the service, comparing the difference with the newly added resource quantity of the service, and determining whether actual hardware equipment needs to be added or not to meet the user requirement.
The comparison can improve the accuracy of measuring the application amount of the resources, and only under the condition that the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly increased resource amount of the service, the number of actual hardware equipment is increased according to the newly increased resource amount of the service, so that the resources are accurately distributed.
In one embodiment of the invention, resources may be allocated during each preset period. Referring to fig. 5, fig. 5 is a schematic diagram of a main flow of a method for periodically allocating resources according to an embodiment of the present invention.
S501, in a preset period, judging that the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is larger than or equal to the newly added resource quantity of the service.
The theoretical resource amount of the service is a parameter that can be obtained through pressure measurement. The peak resource amount of the service is a parameter that can be directly measured and obtained. The newly added resource amount of the service is based on parameters obtained by the service request hardware device and the minimum service unit of the request hardware device.
And in a preset period, comparing the difference between the theoretical resource quantity of the service and the peak resource quantity of the service with the newly added resource quantity of the service. The method aims to judge whether the current available resource quantity meets the resource requirement of a user. As an example, the preset period may be a month, a season, or a half year.
In a preset period, if the difference between the theoretical resource amount of the service and the peak resource amount of the service is greater than or equal to the newly added resource amount of the service, executing S502; in a preset period, if the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, S503 is executed.
S502, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is larger than or equal to the newly added resource quantity of the service, and resources are distributed for the service.
In a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly added resource quantity of the service, which shows that the current available resource quantity meets the resource requirement of the user. Accordingly, resources may be allocated for the traffic.
S503, if the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is less than the newly increased resource quantity of the service, judging that the newly increased resource quantity of the service is greater than or equal to the reserved resource quantity of the period.
In a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly-added resource quantity of the service, which indicates that the current available resource quantity is difficult to meet the resource requirement of the user.
In each expected period, resources are reserved for each preset period, namely the reserved resource amount in the period. If the newly added resource amount of the service is greater than or equal to the reserved resource amount in the period, executing S504; and (5) if the newly added resource amount of the service is less than the reserved resource amount in the period, executing S505.
S504, the newly added resource amount of the service is larger than or equal to the reserved resource amount in the period, and the number of the actual hardware equipment is increased based on the reserved resource amount in the next period.
If the newly added resource amount of the service is greater than or equal to the reserved resource amount in the period, it indicates that the resource requirement has reached the expectation, and the number of the actual hardware equipment needs to be increased. The number of actual hardware devices may be determined according to equation (1) based on the amount of reserved resources for the next cycle.
And S505, the newly added resource amount of the service is smaller than the reserved resource amount in the period, and the number of the actual hardware equipment is increased based on the newly added resource amount of the service.
If the newly added resource amount of the service is smaller than the reserved resource amount in the period, it indicates that the resource demand is not expected, and the number of the actual hardware devices needs to be increased, but the number of the actual hardware devices can be determined according to the formula (1) based on the newly added resource amount of the service.
In the above embodiment, the resource is reserved in each preset period, and if the newly-added resource amount is greater than or equal to the reserved data amount in the present period, it indicates that the resource demand is increasing faster, and the number of the actual hardware devices is increased based on the reserved resource amount in the next period; if the new resource quantity is smaller than the reserved data quantity in the period, the resource demand is fully increased, and the quantity of the actual hardware equipment is increased by the new resource quantity. Therefore, the accuracy of measuring the application amount of the resources is improved.
Referring to fig. 6, fig. 6 is a resource diagram illustrating a resource allocation periodically according to an embodiment of the present invention. The virtual machine is distinguished by a dotted line from top to bottom, namely the expected newly added hardware equipment, the expected newly added resource amount and the actual newly added resource amount.
The example in fig. 6 is illustrated with 4 cycles as an example. The adding of the hardware device is expected to include a preset adding of the hardware device every cycle. The expected new resource amount is an amount of the newly added resource corresponding to the expected newly added hardware device.
In the period 1, if the actual amount of the newly added resource in the period 1 reaches the expected amount of the newly added resource in the period 1, the expected amount of the newly added resource in the period 2 may be obtained, and the number of the actual hardware devices may be determined based on the expected amount of the newly added resource in the period 2.
In the period 2, if the actual newly added resource amount in the period 2 does not reach the expected newly added resource amount in the period 2, the expected newly added resource amount in the period 3 cannot be obtained, and the number of the actual hardware devices may be determined based on the actual newly added resource amount in the period 2.
In the period 3, if the actual newly added resource amount in the period 3 does not reach the expected newly added resource amount in the period 3, the expected newly added resource amount in the period 4 cannot be obtained, and the number of the actual hardware devices may be determined based on the actual newly added resource amount in the period 3.
In the period 4, if the actual newly added resource amount in the period 4 does not reach the expected newly added resource amount in the period 4, the expected newly added resource amount in the period 4 cannot be obtained, and the number of the actual hardware devices may be determined based on the actual newly added resource amount in the period 4.
Fig. 7 is a schematic diagram of a main structure of an apparatus for allocating resources according to an embodiment of the present invention, where the apparatus for allocating resources may implement a method for allocating resources, as shown in fig. 7, the apparatus for allocating resources specifically includes:
the conversion module 701 is configured to obtain a newly added resource amount of the service based on the service request hardware device and a minimum service unit of the request hardware device, where the minimum service unit is a combination of the request hardware devices that process the service.
The first allocating module 702 is configured to allocate resources to the service after the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service and the number of actual hardware devices is increased according to the newly added resource amount of the service, where the number of actual hardware devices is a parameter determined by the minimum service unit.
The second allocating module 703 is configured to allocate resources for the service, where a difference between the theoretical resource amount of the service and the peak resource amount of the service is greater than or equal to a newly added resource amount of the service.
In an embodiment of the present invention, the converting module 701 is specifically configured to determine, based on a service request hardware device, a minimum service unit of the request hardware device;
and acquiring the newly added resource quantity of the service according to the quantity of the requested hardware equipment, the unit hardware quantity of the minimum service unit of the requested hardware equipment and the unit resource quantity of the minimum service unit of the requested hardware equipment.
In an embodiment of the present invention, the method further includes a quantity module 704, configured to determine the quantity of the actual hardware device according to the theoretical resource quantity of the service, the peak resource quantity of the service, the newly added resource quantity of the service, the unit resource quantity of the minimum service unit of the actual hardware device, and the unit hardware quantity of the minimum service unit of the actual hardware device.
In an embodiment of the present invention, the method further includes an updating module 705 for updating the inventory resource amount of the business based on the number of the actual hardware devices, the unit resource amount of the minimum service unit of the actual hardware devices, and the unit hardware amount of the minimum service unit of the actual hardware devices.
In an embodiment of the present invention, the first allocating module 702 is specifically configured to, within a preset period, determine that a difference between a theoretical resource amount of the service and a peak resource amount of the service is smaller than a newly added resource amount of the service,
and if the newly-added resource quantity of the service is larger than or equal to the reserved resource quantity of the period, increasing the quantity of the reserved resource quantity of the next period corresponding to the actual hardware equipment, and then allocating resources for the service.
In an embodiment of the present invention, the first allocating module 702 is specifically configured to, within a preset period, determine that a difference between a theoretical resource amount of the service and a peak resource amount of the service is smaller than a newly added resource amount of the service,
and if the newly added resource amount of the service is smaller than the reserved resource amount in the period, the resources are allocated to the service after the number of the actual hardware equipment is increased according to the newly added resource amount of the service.
Fig. 8 shows an exemplary system architecture 800 of a method of allocating resources or an apparatus for allocating resources to which embodiments of the present invention may be applied.
As shown in fig. 8, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves to provide a medium for communication links between the terminal devices 801, 802, 803 and the server 805. Network 804 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 801, 802, 803 to interact with a server 805 over a network 804 to receive or send messages or the like. The terminal devices 801, 802, 803 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 801, 802, 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 805 may be a server that provides various services, such as a back-office management server (for example only) that supports shopping-like websites browsed by users using the terminal devices 801, 802, 803. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for allocating resources provided by the embodiment of the present invention is generally executed by the server 805, and accordingly, the apparatus for allocating resources is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks, and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 9, shown is a block diagram of a computer system 900 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 9, the computer system 900 includes a Central Processing Unit (CPU)901 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
The following components are connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The above-described functions defined in the system of the present invention are executed when the computer program is executed by a Central Processing Unit (CPU) 901.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a transmitting unit, an obtaining unit, a determining unit, and a first processing unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, the sending unit may also be described as a "unit sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
acquiring the newly added resource quantity of the service based on service request hardware equipment and a minimum service unit of the request hardware equipment, wherein the minimum service unit is a combination of the request hardware equipment for processing the service;
the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service, and after the number of actual hardware equipment is increased according to the newly added resource quantity of the service, resources are allocated to the service, wherein the number of the actual hardware equipment is a parameter determined by a minimum service unit;
and the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service, and resources are allocated to the service.
According to the technical scheme of the embodiment of the invention, the newly added resource amount of the service is obtained based on the service request hardware equipment and the minimum service unit of the request hardware equipment. The difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly increased resource quantity of the service, which indicates that the current available resource quantity is difficult to meet the requirement of the service, and the resources are allocated to the service after the actual hardware quantity is increased according to the newly increased resource quantity of the service; the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly added resource demand quantity of the service, and if the current available resource quantity can meet the requirement of the service, the resource is distributed to the service. Based on the theoretical resource quantity of the service, the peak resource quantity of the service and the newly added resource quantity of the service, the accuracy of measuring the application quantity of the resources can be improved, and further whether hardware needs to be added or not can be determined, and accurate resource distribution for the service is guaranteed.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for allocating resources, comprising:
acquiring the newly added resource quantity of the service based on service request hardware equipment and a minimum service unit of the request hardware equipment, wherein the minimum service unit is a combination of the request hardware equipment for processing the service;
the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service, and after the number of actual hardware equipment is increased according to the newly added resource quantity of the service, resources are allocated to the service, wherein the number of the actual hardware equipment is a parameter determined by a minimum service unit;
and the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service, and resources are allocated to the service.
2. The method according to claim 1, wherein the obtaining the newly added resource amount of the service based on the service request hardware device and the minimum service unit of the request hardware device comprises:
determining a minimum service unit of the request hardware equipment based on the service request hardware equipment;
and acquiring the newly added resource quantity of the service according to the quantity of the request hardware equipment, the unit hardware quantity of the minimum service unit of the request hardware equipment and the unit resource quantity of the minimum service unit of the request hardware equipment.
3. The method according to claim 1, wherein after the number of actual hardware devices is increased according to the newly added resource amount of the service and before the resource is allocated to the service, the method further comprises:
and determining the number of the actual hardware equipment according to the theoretical resource quantity of the service, the peak resource quantity of the service, the newly-added resource quantity of the service, the unit resource quantity of the minimum service unit of the actual hardware equipment and the unit hardware quantity of the minimum service unit of the actual hardware equipment.
4. The method for allocating resources according to claim 1, wherein after increasing the number of actual hardware devices according to the newly added resource amount of the service, the method further comprises:
updating the inventory resource amount of the business based on the number of the actual hardware devices, the unit resource amount of the minimum service unit of the actual hardware devices, and the unit hardware amount of the minimum service unit of the actual hardware devices.
5. The method according to claim 1, wherein the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, and the resource is allocated to the service after the number of the actual hardware devices is increased according to the newly added resource amount of the service, and the method comprises:
in a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service,
and if the newly-added resource quantity of the service is larger than or equal to the reserved resource quantity of the period, increasing the quantity of the reserved resource quantity of the next period corresponding to the actual hardware equipment, and then allocating resources for the service.
6. The method according to claim 1, wherein the difference between the theoretical resource amount of the service and the peak resource amount of the service is smaller than the newly added resource amount of the service, and the resource is allocated to the service after the number of the actual hardware devices is increased according to the newly added resource amount of the service, and the method comprises:
in a preset period, the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is smaller than the newly added resource quantity of the service,
and if the newly added resource amount of the service is smaller than the reserved resource amount in the period, allocating resources for the service after increasing the number of actual hardware equipment according to the newly added resource amount of the service.
7. An apparatus for allocating resources, comprising:
a conversion module, configured to obtain a newly added resource amount of a service based on a service request hardware device and a minimum service unit of the request hardware device, where the minimum service unit is a combination of the request hardware devices that process the service;
a first allocation module, configured to allocate resources to the service after a difference between a theoretical resource amount of the service and a peak resource amount of the service is smaller than a newly added resource amount of the service and increasing a number of actual hardware devices according to the newly added resource amount of the service, where the number of actual hardware devices is a parameter determined by a minimum service unit;
and the second allocation module is used for allocating resources for the service, wherein the difference between the theoretical resource quantity of the service and the peak resource quantity of the service is greater than or equal to the newly increased resource quantity of the service.
8. The apparatus for allocating resources according to claim 7, wherein the conversion module is specifically configured to determine, based on the service request hardware device, a minimum service unit of the request hardware device;
and acquiring the newly added resource quantity of the service according to the quantity of the request hardware equipment, the unit hardware quantity of the minimum service unit of the request hardware equipment and the unit resource quantity of the minimum service unit of the request hardware equipment.
9. An electronic device that allocates resources, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201910548455.XA 2019-06-24 2019-06-24 Method, apparatus, device and computer readable medium for allocating resources Pending CN111767132A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910548455.XA CN111767132A (en) 2019-06-24 2019-06-24 Method, apparatus, device and computer readable medium for allocating resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910548455.XA CN111767132A (en) 2019-06-24 2019-06-24 Method, apparatus, device and computer readable medium for allocating resources

Publications (1)

Publication Number Publication Date
CN111767132A true CN111767132A (en) 2020-10-13

Family

ID=72718315

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910548455.XA Pending CN111767132A (en) 2019-06-24 2019-06-24 Method, apparatus, device and computer readable medium for allocating resources

Country Status (1)

Country Link
CN (1) CN111767132A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160352821A1 (en) * 2015-05-26 2016-12-01 Alibaba Group Holding Limited Method and system for allocating resources for virtual hosts
CN108459905A (en) * 2017-02-17 2018-08-28 华为技术有限公司 Resource pool method for planning capacity and server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160352821A1 (en) * 2015-05-26 2016-12-01 Alibaba Group Holding Limited Method and system for allocating resources for virtual hosts
CN106293869A (en) * 2015-05-26 2017-01-04 阿里巴巴集团控股有限公司 A kind of resource allocation methods and device
CN108459905A (en) * 2017-02-17 2018-08-28 华为技术有限公司 Resource pool method for planning capacity and server

Similar Documents

Publication Publication Date Title
JP7127010B2 (en) Resource allocation methods, apparatus, electronic equipment, computer readable media and computer programs
US10572285B2 (en) Method and apparatus for elastically scaling virtual machine cluster
EP3985932A1 (en) Method and apparatus for node speed limiting, electronic device, and storage medium
CN111786895A (en) Method and apparatus for dynamic global current limiting
US10009416B2 (en) Perfect application capacity analysis for elastic capacity management of cloud-based applications
CN105227489A (en) A kind of bandwidth management method and electronic equipment
CN109428926B (en) Method and device for scheduling task nodes
CN111062572B (en) Task allocation method and device
CN114155026A (en) Resource allocation method, device, server and storage medium
CN110401731B (en) Method and apparatus for distributing content distribution nodes
CN114116173A (en) Method, device and system for dynamically adjusting task allocation
CN112104679A (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
CN114327918B (en) Method and device for adjusting resource amount, electronic equipment and storage medium
CN112667368A (en) Task data processing method and device
CN109842665B (en) Task processing method and device for task allocation server
CN115665054A (en) Method and module for bandwidth allocation and data transmission management system
CN113779412B (en) Message touch method, node and system based on blockchain network
CN111767132A (en) Method, apparatus, device and computer readable medium for allocating resources
CN112688982B (en) User request processing method and device
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN114237902A (en) Service deployment method and device, electronic equipment and computer readable medium
CN114090247A (en) Method, device, equipment and storage medium for processing data
CN108683608B (en) Method and device for distributing flow
CN109471574B (en) Method and device for configuring resources

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