Nothing Special   »   [go: up one dir, main page]

CN108415772B - Container-based resource adjustment method, device and medium - Google Patents

Container-based resource adjustment method, device and medium Download PDF

Info

Publication number
CN108415772B
CN108415772B CN201810146699.0A CN201810146699A CN108415772B CN 108415772 B CN108415772 B CN 108415772B CN 201810146699 A CN201810146699 A CN 201810146699A CN 108415772 B CN108415772 B CN 108415772B
Authority
CN
China
Prior art keywords
resource
container
resource threshold
threshold
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810146699.0A
Other languages
Chinese (zh)
Other versions
CN108415772A (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.)
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810146699.0A priority Critical patent/CN108415772B/en
Publication of CN108415772A publication Critical patent/CN108415772A/en
Application granted granted Critical
Publication of CN108415772B publication Critical patent/CN108415772B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5022Workload threshold

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)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a container-based resource adjusting method, a container-based resource adjusting device and a container-based resource adjusting medium, which are used for reducing service processing delay and improving the utilization rate of host machine resources while ensuring the service quality when the service volume of a cloud computing platform rises. The resource adjusting method based on the container comprises the following steps: determining the average load of a host machine in the current adjustment period; and adjusting the first resource threshold of each container in the next adjustment period according to the average load, wherein the first resource threshold of each container is not less than the second resource threshold of the container, and the second resource threshold of each container is carried in a container resource configuration request sent for the container.

Description

Container-based resource adjustment method, device and medium
Technical Field
The invention relates to the technical field of cloud computing, in particular to a resource adjusting method, device and medium based on a container.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
With the evolution of IT technology, infrastructure aspects are also emerging, and with the continuous maturity of virtualization technology, cloud computing is also developing to a new stage. As the most advanced technology of IT technology, cloud computing has important significance for future development of IT. The cloud computing not only changes the business architecture of an enterprise, but also changes the operation mode of the enterprise, and the deployment of the business on a cloud computing platform is a development trend of future business operation.
The service is deployed on the cloud computing platform and operated in different containers, and enterprises can configure resources required by the containers for operating the services according to service requirements. However, the business traffic of an enterprise is not steadily developed, and in order to be able to elastically shrink the container resource according to the sudden fluctuation of the business traffic, the prior art proposes the following two solutions: in the first solution, the cloud computing platform reserves enough buffering resources for each container, so that enough resources can be guaranteed to be available at the highest speed when the traffic flow rises. And the capacity expansion flow is triggered when the service flow rises, the service flow rises by increasing the number of containers, the capacity can be reduced at any time when the load is low, and the maximum full use of the host machine resources is ensured. However, in the first solution, although enough resources can be guaranteed to process the burst traffic at the fastest speed, the resource waste is serious; in the second solution, it generally takes a minute to add a container, and when the traffic volume suddenly increases, the capacity expansion will increase the traffic processing delay.
Therefore, how to improve the utilization rate of host machine resources while reducing the service processing delay and ensuring the service quality becomes one of the technical problems to be solved urgently in the prior art.
Disclosure of Invention
The embodiment of the invention provides a container-based resource adjusting method, a container-based resource adjusting device and a container-based resource adjusting medium, which are used for reducing service processing delay and ensuring service quality and improving the utilization rate of host machine resources when the service volume of a cloud computing platform rises.
In a first aspect, a method for adjusting resources based on a container is provided, including:
determining the average load of a host machine in the current adjustment period;
and adjusting the first resource threshold of each container in the next adjustment period according to the average load, wherein the first resource threshold of each container is not less than the second resource threshold of the container, and the second resource threshold of each container is carried in a container resource configuration request sent for the container.
In the method, two resource thresholds are respectively configured for the containers running on the host, the upper limit of the container resource configured for the containers by the user is a second resource threshold, but the actually available container resource is a first resource threshold, wherein the first resource threshold is not less than the second resource threshold, in the service running process, the actually available resource of each container is dynamically adjusted according to the average load of the host within a period of time, and because the excess resource is pre-configured, the excess configured resource can be instantly used when the demand of the container resource suddenly rises, so that rapid capacity expansion is realized, and the service processing delay is reduced; on the other hand, because the excess resources are usually used alternately among the containers, the whole host machine only needs to reserve a small amount of buffer resources for sharing and using of the containers, thereby reducing the resource waste of the host machine and improving the resource utilization rate of the host machine.
Optionally, adjusting the first resource threshold of each container in the next adjustment period according to the average load specifically includes:
if the average load in the current adjustment period is increased compared with the previous adjustment period, the first resource threshold is decreased, otherwise, if the average load in the current adjustment period is decreased compared with the previous adjustment period, the first resource threshold is increased.
Optionally, adjusting the first resource threshold of each container in the next adjustment period according to the average load specifically includes:
increasing the first resource threshold if the average load is less than a first load threshold; decreasing the first resource threshold if the average load is greater than a second load threshold.
Wherein,
the increasing the first resource threshold specifically includes: increasing the first resource threshold according to a first preset proportion;
the reducing the first resource threshold specifically includes: and reducing the first resource threshold according to a second preset proportion.
In the method, the actual available resources of each container are dynamically adjusted according to the load condition of the host, when the load of the host is larger, the actual available resources allocated to each container are reduced, when the load of the host is lighter, the actual available resources allocated to the containers are increased, the service performance of the host is ensured while the resource utilization rate of the host is improved, and the service quality of the containers is ensured.
Optionally, while increasing the first resource threshold according to a first preset proportion, the method further includes:
and determining the upper limit value of the adjusted first resource threshold according to the second resource threshold and/or the sum of the available resources of the host.
Optionally, the method for adjusting resources based on a container provided in the embodiment of the present invention further includes:
determining that the sum of the adjusted first resource threshold and the first resource thresholds corresponding to all service containers deployed on the host is not more than K times of the sum of the available resources of the host, wherein K is an integer greater than 1.
In the method, the upper limit value of the first resource threshold value is set, so that the problem that the service quality of the service is influenced due to the fact that the host machine is down due to insufficient host machine resources caused by the fact that the containers deployed on the host machine use the resources in excess is avoided.
Optionally, according to the second resource threshold and the sum of the available resources of the host, determining an upper limit value of the adjusted first resource threshold according to the following formula:
Figure BDA0001579033670000031
wherein:
y represents an upper limit value of the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
In a second aspect, a container-based resource adjusting apparatus is provided, including:
the first determining unit is used for determining the average load of the host machine in the current adjusting period;
and a resource adjusting unit, configured to adjust, according to the average load, a first resource threshold of each container in a next adjustment period, where the first resource threshold of each container is not smaller than a second resource threshold of the container, and the second resource threshold of each container is carried in a container resource configuration request sent for the container.
Optionally, the resource adjusting unit is specifically configured to decrease the first resource threshold when the average load in the current adjustment period is increased compared to the last adjustment period, and otherwise, increase the first resource threshold when the average load in the current adjustment period is decreased compared to the last adjustment period.
Optionally, the resource adjusting unit is specifically configured to increase the first resource threshold if the average load is smaller than a first load threshold; decreasing the first resource threshold if the average load is greater than a second load threshold.
Optionally, the resource adjusting unit is specifically configured to increase the first resource threshold according to a first preset proportion if the average load is smaller than the first load threshold; and if the average load is larger than a second load threshold, reducing the first resource threshold according to a second preset proportion.
Optionally, the apparatus for adjusting resources based on a container provided in the embodiment of the present invention further includes:
a second determining unit, configured to increase the first resource threshold according to a first preset ratio by the resource adjusting unit, and determine an upper limit of the adjusted first resource threshold according to the second resource threshold and/or a sum of available resources of the host; or determining that the sum of the adjusted first resource threshold and the first resource thresholds corresponding to all the service containers deployed on the host is not more than K times of the sum of the available resources of the host, where K is an integer greater than 1.
The resource adjusting unit is specifically configured to determine, according to the second resource threshold and the sum of the available resources of the host, an upper limit value of the adjusted first resource threshold according to the following formula:
Figure BDA0001579033670000041
wherein:
y represents an upper limit value of the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
In a third aspect, a computing device is provided, comprising at least one processor and at least one memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any of the above methods.
In a fourth aspect, a computer-readable medium is provided, which stores a computer program executable by a terminal device, the program, when run on the terminal device, causing the terminal device to perform the steps of any of the methods described above.
The method, the device and the medium for adjusting resources based on containers, provided by the embodiments of the present invention, configure two resource thresholds for a container running on a host, where an upper limit of a container resource configured by a user is a second resource threshold, a system allocates a first resource threshold, which is actually available and not less than the second resource threshold, to the user according to the second resource threshold, and dynamically adjusts the actually available resource of each container according to an average load of the host over a period of time during a service running process, so that an over-configured resource can be used immediately when a container resource demand suddenly rises, thereby implementing immediate capacity expansion and reducing service processing delay; on the other hand, because each container usually uses the excess resource alternately, the whole host machine only needs to reserve a small amount of buffer resources for sharing and using of each container, thereby reducing the waste of the host machine resources and improving the utilization rate of the host machine resources.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a schematic diagram of a computing device according to an embodiment of the invention;
fig. 2 is a schematic view of an application scenario of a container-based resource adjustment method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an implementation of a container-based resource adjustment method according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating hard-wired ECU values as a function of soft ECU values, according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a container-based resource adjustment apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to reduce service processing delay and guarantee service quality and improve the utilization rate of host machine resources, embodiments of the present invention provide a method, an apparatus, and a medium for adjusting resources based on a container.
First, some terms related to the embodiments of the present invention are explained to facilitate understanding by those skilled in the art.
1. And the container is operated based on the docker mirror image, and the service process is operated in the container.
2. A host, refers to a physical server, which is a carrier for running containers, and each physical server may run multiple containers.
3. Resources, various resources required for the container to run, for example, CPU resources, and the like.
4. An ECU: for describing the CPU capacity units of various types of machines, the per unit ECU capacity is equivalent to 1/80 for the full capacity of a 4-core 8-thread C1 machine of dominant frequency 2.53, i.e., 1ECU equals 1 core CPU capacity.
5. Cord ECU value: each container is assigned a quota of ECUs, by which the user calculates costs and payments. When the host machine resources are distributed, the sum of all container cord ECU configurations is equal to the total ECU available for the host machine.
6. Hard-line ECU value: when the host is idle, the containers may over-utilize the ECU, so the overall container hardwire ECU value is generally greater than or equal to the host total ECU value.
7. Super-matching: on the premise of guaranteeing the service quality of all containers of the host, the container sporadic over quota is allowed to use CPU resources, and the problem of resource demand of service flow burst is solved. Namely: the user configures the vessel with soft ECUs, but the host actually assigns to the vessel hard-wired ECUs.
8. Sharing: since the total number of all container hardwire ECUs is greater than the total number of flex ECUs, all containers actually share a share of buffer resources, minimizing host idle resources.
9. In the description of the embodiments of the invention, the terms "first," "second," and the like are used for descriptive purposes only and not for purposes of indicating or implying relative importance, nor for purposes of indicating or implying order.
The preferred embodiments of the present invention will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are merely for illustrating and explaining the present invention, and are not intended to limit the present invention, and that the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
The resource adjusting method based on the container provided by the embodiment of the invention can be applied to a computing device, and the computing device can be expressed in the form of general computing equipment. A computing device 10 according to the present invention is described below with reference to fig. 1. The computing device 10 shown in FIG. 1 is only one example and should not be taken to limit the scope of use and functionality of embodiments of the present invention.
As shown in fig. 1, components of computing device 10 may include, but are not limited to: at least one processor 11, at least one memory 12, and a bus 13 connecting the various system components, including the memory 12 and the processor 11.
Bus 13 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
Memory 12 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)121 and/or cache memory 122, and may further include Read Only Memory (ROM) 123.
Memory 12 may also include a program/utility 125 having a set (at least one) of program modules 124, such program modules 124 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Computing device 10 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, etc.), with one or more devices that enable a user to interact with computing device 10, and/or with any devices (e.g., router, modem, etc.) that enable computing device 10 to communicate with one or more other computing devices. Such communication may be via an input/output (I/O) interface 15. Moreover, computing device 10 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via network adapter 16. As shown, network adapter 16 communicates with other modules for computing device 10 over bus 13. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computing device 10, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Fig. 2 is a schematic view of an application scenario of the container-based resource adjustment method according to the embodiment of the present invention. The user 10 requests the host machine 11 to allocate resources through the terminal device 13 according to the service requirement of the user, and the host machine 11 allocates corresponding container resources to the user according to the user request to operate the container 12 so as to process the user service. In specific implementation, when the user 10 configures resources, such as a CPU capability value (ECU), for its own container, only the normal load condition needs to be considered, for example, the user 10 needs 30 ECUs more than 90% of the time according to its own service evaluation, then the 30 ECUs may be set to be configured for the container cord, the host computer may calculate the service cost according to the 30 ECUs, if the service flow suddenly increases, resources larger than 30 ECUs may be temporarily used, and resources exceeding 30 ECUs are used for free. For the host, since the container is usually used alternately with resources exceeding the soft wire ECU value, the entire host only needs to reserve a small amount of buffer resources. It should be noted that if some services use resources for a long time and exceed the value of the cord ECU configured by the user, minute-level expansion is triggered, that is, the capacity is expanded by increasing the number of containers.
The connection between the terminal device 13 and the host 11 may be via a communication network, which may be a local area network, a wide area network, etc. The terminal device 13 may be a portable device (e.g., a mobile phone, a tablet, a notebook Computer, etc.), or may be a Personal Computer (PC), etc.
The following describes in detail a container-based resource adjustment method provided by an embodiment of the present invention with reference to fig. 1 and fig. 2, and as shown in fig. 3, the method may include the following steps:
s31, receiving a container resource configuration request, wherein the container resource configuration request carries a second resource threshold.
In specific implementation, a user sends a container resource configuration request to a host according to a service operation requirement of the user, wherein the container resource configuration request carries a second resource threshold value, namely a soft ECU value, set by the user according to the service operation requirement of the user.
And S32, the host machine determines a first resource threshold value of the actual available resource of the container according to the second resource threshold value.
After receiving the container resource configuration request, the host determines a first resource threshold value, namely a hard ECU value, of the actual available resource of the container according to a second resource threshold value carried in the container resource configuration request, wherein the first resource threshold value is not less than the second resource threshold value.
And S33, determining the average load of the host machine in the current adjusting period.
And S34, adjusting the first resource threshold value of each container in the next adjustment period according to the average load.
In this way, at the end of each adjustment period, the first resource threshold actually available for each container can be dynamically adjusted by looping through steps S33 and S34.
In specific implementation, if the first resource threshold is set too low, the resource utilization rate of the host is not obviously increased, and if the first resource threshold is set too high, the machine load may be too high, so that the service failure rate and the consumed time of the service in the container are increased. If the average load in the current adjustment period is increased compared to the last adjustment period, decreasing the first resource threshold, otherwise, if the average load in the current adjustment period is decreased compared to the last adjustment period, increasing the first resource threshold. Specifically, if the average load of the host in the current adjustment period is smaller than a first load threshold, increasing the first resource threshold, for example, increasing the first resource threshold according to a first preset proportion; if the average load of the host in the current adjustment period is greater than the second load threshold, the first resource threshold is decreased, for example, the first resource threshold may be decreased according to a second preset proportion.
In specific implementation, the duration of the adjustment period, the first preset proportion, the second preset proportion, the first load threshold and the second load threshold may be set according to empirical values, for example, the adjustment period may be set to 15s, that is, the host calculates the average load of the host in the current adjustment period every 15s, and adjusts the first resource threshold of the actually available resource of each container in the next adjustment period according to the calculation result. The first load threshold may be set to 40% based on empirical values. As for the second load threshold, the item pressure measurement result shows that when the resource utilization rate of most of the services reaches above 70%, the service processing time consumption and the failure rate start to increase, so in the embodiment of the present invention, the upper limit of the second load threshold is 70%, for example, the second load threshold may be set to 65%. The first preset proportion threshold may be set to 10% based on an empirical value, and the second preset proportion may be set to 10% based on an empirical value. For example, when the average load of a host in the current adjustment period is less than 40%, the first resource threshold, i.e., the quota of the hard-line ECU value, of all containers deployed on the host rises by 10%, and when the average load of the host in the current adjustment period is greater than 65%, the first resource threshold, i.e., the quota of the hard-line ECU value, of all containers deployed on the host falls by 10%.
In specific implementation, the hard-line ECU cannot be smaller than the soft ECU, because the soft ECU uses the average resource usage rate after evaluation or pressure measurement according to each service, and in order to ensure the service quality of the service operated in the container, it is necessary to ensure that the resource available to each container is greater than or equal to the soft ECU value at any time.
However, in specific implementation, if the hard-line ECU values of all the containers increase by the first preset ratio, the buffer resources of the entire host may be insufficient, so as to cause a host downtime, and in order to solve the problem, in the embodiment of the present invention, while the first resource threshold is increased according to the first preset ratio, the upper limit value of the adjusted first resource threshold may also be determined according to the second resource threshold and/or the sum of the available resources of the host.
Based on this, in implementation, the upper limit value of the adjusted first resource threshold may be determined in any one of the following manners:
the first mode,
Determining an upper limit value of the adjusted first resource threshold according to the following formula:
Figure BDA0001579033670000101
wherein:
yan upper limit value representing the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
If M is 9, the flexible wire ECU value is 9, and the upper limit of the adjustment of the hard wire ECU value is 9 ECU; the flexible wire ECU value is 0.5ECU, and the upper limit of the adjustment of the hard wire ECU value is 2.1 ECU. According to the above formula, the larger the cord ECU value is for the container, the larger the upper limit value affecting the ECU is, as shown in FIG. 4. The hard-line ECU value of each container is determined through the formula, so that the available resource of each container on the host machine at any time is ensured to be more than or equal to the soft ECU value, and the service quality of the service operated by each container cannot be influenced by over-allocation.
Second, the single container hardwired ECU value cannot be greater than a preset percentage R of the host's available resources, for example, R may be set to 90%. Reserved resources can be used as buffer resources on one hand, and on the other hand, the host operating system itself occupies a part of resources.
And in a third mode, determining that the sum of the adjusted first resource threshold and the first resource thresholds corresponding to all service containers deployed on the host is not more than K times of the sum of the available resources of the host, wherein K is an integer larger than 1.
In specific implementation, the value of K may be determined according to the service characteristic pressure measurement. For example, K may be set to 2, and if each container on the host uses resources at an off-peak time, that is, the peak usage of each container is no longer at the same time point, the value K may continue to be a larger value, so that the overall resource usage rate of the host may continuously increase, but the service quality of the service running in the container deployed on the host needs to be ensured.
It should be appreciated that, in particular implementations, the upper limit value of the first resource threshold may be determined in combination with at least one of the above three ways.
In the method for adjusting resources based on containers provided in the embodiments of the present invention, two resource thresholds are respectively configured for containers running on a host, where an upper limit of a container resource set by a user is a second resource threshold, but a container resource actually available to the user is a first resource threshold, where the first resource threshold is not less than the second resource threshold, and in a service running process, an actually available resource of each container is dynamically adjusted according to an average load of the host over a period of time, and since an excess resource is a pre-configured resource, it can be ensured that the excess configured resource is used immediately when a container resource demand suddenly rises, thereby achieving fast capacity expansion and reducing service processing delay; on the other hand, because buffer resources do not need to be reserved for each container, each host machine can be mixed with more containers, the utilization rate of the whole host machine is obviously improved, and excess resources are generally used alternately among the containers, so that the whole host machine only needs to reserve a small amount of buffer resources for sharing and using of the containers, the resource waste of the host machine is reduced, and the resource utilization rate of the host machine is improved.
Based on the same inventive concept, the embodiment of the present invention further provides a resource adjusting device based on a container, and because the principle of solving the problem of the device is similar to that of the resource adjusting method based on the container, the implementation of the device can refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 5, which is a schematic structural diagram of a container-based resource adjustment apparatus according to an embodiment of the present invention, the container-based resource adjustment apparatus may include:
a first determining unit 51, configured to determine an average load of the hosts in a current adjustment period;
a resource adjusting unit 52, configured to adjust a first resource threshold of each container in a next adjustment period according to the average load, where the first resource threshold of each container is not less than a second resource threshold of the container, and the second resource threshold of each container is carried in a container resource configuration request sent for the container.
Optionally, the resource adjusting unit is specifically configured to decrease the first resource threshold when the average load in the current adjustment period is increased compared with the previous adjustment period, and otherwise, increase the first resource threshold when the average load in the current adjustment period is decreased compared with the previous adjustment period.
Optionally, the resource adjusting unit is specifically configured to increase the first resource threshold if the average load is smaller than a first load threshold; decreasing the first resource threshold if the average load is greater than a second load threshold.
Optionally, the resource adjusting unit is specifically configured to increase the first resource threshold according to a first preset proportion if the average load is smaller than the first load threshold; and if the average load is larger than a second load threshold, reducing the first resource threshold according to a second preset proportion.
Optionally, the apparatus for adjusting resources based on a container provided in the embodiment of the present invention further includes:
a second determining unit, configured to increase the first resource threshold according to a first preset ratio by the resource adjusting unit, and determine an upper limit of the adjusted first resource threshold according to the second resource threshold and/or a sum of available resources of the host; or determining that the sum of the adjusted first resource threshold and the first resource thresholds corresponding to all the service containers deployed on the host is not more than K times of the sum of the available resources of the host, where K is an integer greater than 1.
The resource adjusting unit is specifically configured to determine, according to the second resource threshold and the sum of the available resources of the host, an upper limit value of the adjusted first resource threshold according to the following formula:
Figure BDA0001579033670000131
wherein:
y represents an upper limit value of the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
For convenience of description, the above parts are separately described as modules (or units) according to functional division. Of course, the functionality of the various modules (or units) may be implemented in the same or in multiple pieces of software or hardware in practicing the invention.
Based on the same technical concept, an embodiment of the present application further provides an electronic device 600, as shown in fig. 6, the device includes: one or more processors 610 and a memory 620, where one processor 610 is taken as an example in fig. 6, the electronic device may further include: an input device 630 and an output device 640.
The processor 610, the memory 620, the input device 630, and the output device 640 may be connected by a bus or other means, such as the bus connection in fig. 6.
The memory 620, as a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the method for simulating a sensor in a software test in an embodiment of the present invention (for example, the receiving unit 51, the first determining unit 52, and the resource adjusting unit 53 shown in fig. 5). The processor 610 executes various functional applications of the server and data processing by running the non-volatile software programs, instructions and modules stored in the memory 620, that is, implements the container-based resource adjustment method in the above method embodiment.
The memory 620 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from device usage of the simulated sensor in the software test, and the like. Further, the memory 620 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 620 optionally includes memory located remotely from processor 610, which may be connected over a network to a processing device operating the list items. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 630 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the device simulating the sensor in the software test. The output device 640 may include a display device such as a display screen.
The one or more modules are stored in the memory 620 and, when executed by the one or more processors 610, perform the container-based resource adjustment method of any of the method embodiments described above.
The embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions required to be executed by the processor, and includes a program required to be executed by the processor.
In some possible embodiments, the aspects of the container-based resource adjustment method provided by the present invention may also be implemented as a program product, which includes program code for causing a terminal device to execute the steps in the container-based resource adjustment method according to various exemplary embodiments of the present invention described above in this specification when the program product runs on the terminal device, for example, an electronic device may execute step S31 shown in fig. 3, receive a container resource configuration request, where the container resource configuration request carries a second resource threshold, step S32, determine a first resource threshold of resources actually available to a container according to the second resource threshold, and step S33, determine an average load of hosts in a current adjustment period; step 34, adjusting the first resource threshold value of each container in the next adjustment period according to the average load; in step S35, when the next adjustment cycle arrives, the process returns to step S33.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A 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 (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
The program product for container-based resource adjustment of embodiments of the present invention may employ a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a computing device. However, the program product of the present invention is not limited in this regard and, in the present document, a 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.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device over any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., over the internet using an internet service provider).
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more of the units described above may be embodied in one unit, according to embodiments of the invention. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (12)

1. A method for adjusting resources based on containers, comprising:
determining the average load of a host machine in the current adjustment period;
according to the average load, adjusting a first resource threshold value of each container in a next adjustment period, wherein the first resource threshold value of each container is not less than a second resource threshold value of the container, the first resource threshold value of each container is set based on actual available resources allocated to the container, and the second resource threshold value of each container is carried in a container resource configuration request sent to the container;
wherein, according to the average load, adjusting the first resource threshold of each container in the next adjustment period specifically includes:
if the average load is smaller than a first load threshold, increasing the first resource threshold according to a first preset proportion, and simultaneously determining the upper limit value of the adjusted first resource threshold according to the second resource threshold and the sum of available resources of the host;
determining an upper limit value of the adjusted first resource threshold according to the second resource threshold and the sum of the available resources of the host machine and the following formula:
Figure FDF0000013616010000011
wherein:
y represents an upper limit value of the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
2. The method of claim 1, wherein adjusting the first resource threshold of each container in a next adjustment period according to the average load comprises:
if the average load in the current adjustment period is increased compared with the previous adjustment period, the first resource threshold is decreased, otherwise, if the average load in the current adjustment period is decreased compared with the previous adjustment period, the first resource threshold is increased.
3. The method of claim 1, wherein adjusting the first resource threshold for each container for a next adjustment period based on the average load further comprises:
decreasing the first resource threshold if the average load is greater than a second load threshold.
4. The method of claim 3,
the reducing the first resource threshold specifically includes: and reducing the first resource threshold according to a second preset proportion.
5. The method of claim 1, further comprising:
determining that the sum of the adjusted first resource threshold and the first resource thresholds corresponding to all containers deployed on the host is not more than K times of the sum of the available resources of the host, wherein K is an integer greater than 1.
6. A container-based resource adjustment apparatus, comprising:
the first determining unit is used for determining the average load of the host machine in the current adjusting period;
a resource adjusting unit, configured to adjust, according to the average load, a first resource threshold of each container in a next adjustment period, where the first resource threshold of each container is not smaller than a second resource threshold of the container, the first resource threshold of each container is set based on an actual available resource allocated to the container, and the second resource threshold of each container is carried in a container resource configuration request sent for the container;
wherein the resource adjusting unit is specifically configured to:
if the average load is smaller than a first load threshold, increasing the first resource threshold according to a first preset proportion, and simultaneously determining the upper limit value of the adjusted first resource threshold according to the second resource threshold and the sum of available resources of the host;
the resource adjusting unit is specifically configured to determine, according to the second resource threshold and a sum of available resources of the host, an upper limit value of the adjusted first resource threshold according to the following formula:
Figure FDF0000013616010000021
wherein:
y represents an upper limit value of the adjusted first resource threshold;
x represents the second resource threshold;
m represents the sum of the available resources of the host.
7. The apparatus of claim 6,
the resource adjustment unit is further configured to increase the first resource threshold if the average load in the current adjustment period is reduced compared with the average load in the previous adjustment period.
8. The apparatus of claim 6,
the resource adjusting unit is specifically configured to decrease the first resource threshold if the average load is greater than a second load threshold.
9. The apparatus of claim 8,
the resource adjusting unit is specifically configured to decrease the first resource threshold according to a second preset proportion if the average load is greater than a second load threshold.
10. The apparatus of claim 6, further comprising:
a second determining unit, configured to determine that a sum of the adjusted first resource threshold and first resource thresholds corresponding to all service containers deployed on the host is not more than K times a sum of available resources of the host, where K is an integer greater than 1.
11. A computing device comprising at least one processor and at least one memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1 to 5.
12. A computer-readable medium, in which a computer program executable by a terminal device is stored, which program, when run on the terminal device, causes the terminal device to carry out the steps of the method according to any one of claims 1 to 5.
CN201810146699.0A 2018-02-12 2018-02-12 Container-based resource adjustment method, device and medium Active CN108415772B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810146699.0A CN108415772B (en) 2018-02-12 2018-02-12 Container-based resource adjustment method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810146699.0A CN108415772B (en) 2018-02-12 2018-02-12 Container-based resource adjustment method, device and medium

Publications (2)

Publication Number Publication Date
CN108415772A CN108415772A (en) 2018-08-17
CN108415772B true CN108415772B (en) 2022-02-18

Family

ID=63128634

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810146699.0A Active CN108415772B (en) 2018-02-12 2018-02-12 Container-based resource adjustment method, device and medium

Country Status (1)

Country Link
CN (1) CN108415772B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739649B (en) * 2018-12-28 2023-07-18 深圳前海微众银行股份有限公司 Resource management method, device, equipment and computer readable storage medium
CN109976771B (en) * 2019-03-28 2023-06-27 新华三技术有限公司 Application deployment method and device
CN111736981A (en) * 2019-08-01 2020-10-02 北京京东尚科信息技术有限公司 Container resource allocation method, device, equipment and storage medium
CN110413382A (en) * 2019-08-06 2019-11-05 山东超越数控电子股份有限公司 A kind of method, equipment and the readable medium of the resource dynamic adjustment of Docker container
CN110780989B (en) * 2019-08-29 2023-03-24 腾讯科技(深圳)有限公司 Overload protection method, device, equipment and medium
CN112099957B (en) * 2020-11-02 2021-04-13 腾讯科技(深圳)有限公司 Resource allocation method, system, device and electronic equipment
CN118349313A (en) * 2023-01-16 2024-07-16 华为技术有限公司 Container resource adjustment method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912403A (en) * 2016-04-14 2016-08-31 青岛海信传媒网络技术有限公司 Resource management method and device of Docker container
CN107209682A (en) * 2014-12-05 2017-09-26 亚马逊技术有限公司 The automatic management of resource adjustment
CN107562545A (en) * 2017-09-11 2018-01-09 南京奥之云信息技术有限公司 A kind of container dispatching method based on Docker technologies

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150268865A1 (en) * 2014-03-18 2015-09-24 Vmware, Inc. Methods and systems for calculating the cost of logical capacity containers
PT3037964T (en) * 2014-12-22 2018-11-13 Rovio Entertainment Ltd Virtual application manager in a cloud computing environment
CN105183565B (en) * 2015-09-30 2018-12-07 华为技术有限公司 Computer, method for controlling quality of service and device
CN107045455B (en) * 2017-06-19 2019-06-11 华中科技大学 A kind of Docker Swarm cluster resource method for optimizing scheduling based on load estimation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107209682A (en) * 2014-12-05 2017-09-26 亚马逊技术有限公司 The automatic management of resource adjustment
CN105912403A (en) * 2016-04-14 2016-08-31 青岛海信传媒网络技术有限公司 Resource management method and device of Docker container
CN107562545A (en) * 2017-09-11 2018-01-09 南京奥之云信息技术有限公司 A kind of container dispatching method based on Docker technologies

Also Published As

Publication number Publication date
CN108415772A (en) 2018-08-17

Similar Documents

Publication Publication Date Title
CN108415772B (en) Container-based resource adjustment method, device and medium
US9841998B2 (en) Processor power optimization with response time assurance
US10241843B2 (en) Application processing allocation in a computing system
US9612878B2 (en) Resource allocation in job scheduling environment
EP3698247B1 (en) An apparatus and method for providing a performance based packet scheduler
CN110058966B (en) Method, apparatus and computer program product for data backup
CN109451051B (en) Service request processing method and device, electronic equipment and storage medium
US9929894B2 (en) Determining the graphic load of a virtual desktop
US9361154B2 (en) Tunable computerized job scheduling
US9098379B2 (en) Computing reusable image components to minimize network bandwidth usage
CN115794337B (en) Resource scheduling method, device, cloud platform, equipment and storage medium
WO2016115000A1 (en) Hybrid scheduler and power manager
CN109656691A (en) Processing method, device and the electronic equipment of computing resource
CN105743808A (en) Method and device of adapting QoS
CN112527509B (en) Resource allocation method and device, electronic equipment and storage medium
US9471387B2 (en) Scheduling in job execution
CN113849271A (en) Cloud desktop display method, device, equipment, system and storage medium
US9594596B2 (en) Dynamically tuning server placement
CN115454637A (en) Image rendering method, device, equipment and medium
US20200326942A1 (en) Parameter management between programs
CN117369990A (en) Method, device, system, equipment and storage medium for scheduling computing power resources
CN116866280A (en) Resource allocation method and scheduling device of cloud server
CN116450290A (en) Computer resource management method and device, cloud server and storage medium
CN112156453B (en) Example adaptive adjustment method, apparatus, computer readable storage medium and device
CN112148448B (en) Resource allocation method, apparatus, device and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230922

Address after: 309 West, floor 3, No. 49, Zhichun Road, Haidian District, Beijing 100080

Patentee after: TENCENT CLOUD COMPUTING (BEIJING) Co.,Ltd.

Address before: 35th floor, Tencent building, Keji Zhongyi Road, high tech Zone, Nanshan District, Shenzhen City, Guangdong Province

Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

TR01 Transfer of patent right