CN113448717A - Resource scheduling method and device - Google Patents
Resource scheduling method and device Download PDFInfo
- Publication number
- CN113448717A CN113448717A CN202010219853.XA CN202010219853A CN113448717A CN 113448717 A CN113448717 A CN 113448717A CN 202010219853 A CN202010219853 A CN 202010219853A CN 113448717 A CN113448717 A CN 113448717A
- Authority
- CN
- China
- Prior art keywords
- equipment
- resource
- weight
- utilization rate
- scheduling
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000013507 mapping Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012163 sequencing technique Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 claims description 7
- 238000012544 monitoring process Methods 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 3
- 239000013585 weight reducing agent Substances 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000012549 training Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 239000000835 fiber Substances 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000032683 aging Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000013468 resource allocation Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
- H04L67/1008—Server selection for load balancing based on parameters of servers, e.g. available memory or workload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a resource scheduling method and device, and relates to the technical field of computers. One embodiment of the method comprises: counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device; taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate; and performing weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received. In the embodiment, under a distributed cluster environment, according to the average value of the utilization rate of the existing cluster CPU, the equipment with the utilization rate exceeding the average value is automatically adjusted, if a weight reduction method is adopted, manual operation is not required on the whole, and the dynamic balance of the utilization rate of the whole cluster CPU is realized.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a resource scheduling method and apparatus.
Background
In the internet environment, the user access amount is usually in the tens of millions or even hundreds of millions, so that the number of application clusters providing services is small, and the quality of the whole cluster service is affected by the level of a Central Processing Unit (CPU) resource of each device.
In the existing equipment management, the problem of unstable service supply is caused by over-high utilization rate of some equipment CPUs (central processing units) and over-low utilization rate of some equipment CPUs due to the aging of equipment hardware or unbalanced resource distribution. Developers usually select a resource monitoring alarm mode, and manually offline equipment with too high CPU utilization rate can reduce the load weight value of the equipment, so that the CPU resource consumption is reduced by reducing resource access.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
the number of devices in the distributed cluster is large, and the mode of manually processing the devices with overhigh CPU utilization rate is time-consuming and labor-consuming.
Disclosure of Invention
In view of this, embodiments of the present invention provide a resource scheduling method and apparatus, which can at least solve the problem in the prior art that manual adjustment is required for a device with an excessively high CPU utilization.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a resource scheduling method, including:
counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device;
taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
and carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
Optionally, the performing weight adjustment on the first device according to a preset manner includes:
acquiring a preset weight of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weight;
if so, adjusting the weight of the first equipment to be a first weight;
if not, calculating a difference value between the resource utilization rate of the first equipment and the average resource utilization rate, combining the preset weight to obtain a second weight, and further adjusting the weight of the first equipment to the second weight.
Optionally, the method further includes:
the method comprises the steps that an IP address and preset weight of a single device are obtained and uploaded to a data center, and data of the single device are transmitted to a resource scheduling module through the data center; the data comprises an IP address, a resource utilization rate and a preset weight;
after the determining the scheduling amount of each device resource, the method further includes:
and the resource scheduling module transmits the IP address of the equipment to second equipment which sends the resource scheduling request according to the scheduling result so that the second equipment carries out resource scheduling through the transmitted IP address.
Optionally, the transmitting data of the single device to the resource scheduling module through the data center includes: and when monitoring that the data of the equipment in the data center changes, the resource scheduling module acquires the changed data of the equipment from the data center.
Optionally, before the transmitting the IP address of the device to the second device that sends the resource scheduling request, the method further includes: and acquiring the scheduling request quantity of each second device for the resource, determining that the sum of the scheduling request quantities is at least one second device of the scheduling quantity, and further establishing a mapping relation between the devices and the at least one second device.
Optionally, before the transmitting the IP address of the device to the second device that sends the resource scheduling request, the method further includes:
sequencing the scheduling quantity of each equipment resource according to the determined scheduling quantity to obtain an equipment queue;
sequencing the scheduling request quantity of the resources according to each second device to obtain a second device queue;
and according to a round-robin mode, allocating the second equipment in the second equipment queue to the equipment in the equipment queue, and further establishing a mapping relation between the equipment and the second equipment.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a resource scheduling apparatus, including:
the resource calculation module is used for counting the resource adjustment amount of the single equipment in a preset period aiming at the same application cluster so as to determine the resource utilization rate of the single equipment;
the device extraction module is used for taking the ratio of the sum of the resource utilization rates to the number of devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
and the weight adjusting module is used for adjusting the weight of the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
Optionally, the weight adjusting module is configured to:
acquiring a preset weight of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weight;
if so, adjusting the weight of the first equipment to be a first weight;
if not, calculating a difference value between the resource utilization rate of the first equipment and the average resource utilization rate, combining the preset weight to obtain a second weight, and further adjusting the weight of the first equipment to the second weight.
Optionally, the system further includes a service providing module, configured to:
the method comprises the steps that an IP address and preset weight of a single device are obtained and uploaded to a data center, and data of the single device are transmitted to a resource scheduling module through the data center; the data comprises an IP address, a resource utilization rate and a preset weight;
a resource scheduling module to:
and the resource scheduling module transmits the IP address of the equipment to second equipment which sends the resource scheduling request according to the scheduling result so that the second equipment carries out resource scheduling through the transmitted IP address.
Optionally, the service providing module is configured to: and when monitoring that the data of the equipment in the data center changes, the resource scheduling module acquires the changed data of the equipment from the data center.
Optionally, the resource scheduling module is further configured to: and acquiring the scheduling request quantity of each second device for the resource, determining that the sum of the scheduling request quantities is at least one second device of the scheduling quantity, and further establishing a mapping relation between the devices and the at least one second device.
Optionally, the resource scheduling module is further configured to:
sequencing the scheduling quantity of each equipment resource according to the determined scheduling quantity to obtain an equipment queue;
sequencing the scheduling request quantity of the resources according to each second device to obtain a second device queue;
and according to a round-robin mode, allocating the second equipment in the second equipment queue to the equipment in the equipment queue, and further establishing a mapping relation between the equipment and the second equipment.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a resource scheduling electronic device.
The electronic device of the embodiment of the invention comprises: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement any of the above-mentioned resource scheduling methods.
To achieve the above object, according to a further aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, the program, when executed by a processor, implementing any of the above resource scheduling methods.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: under the distributed cluster environment, according to the average value of the utilization rate of the existing cluster CPU, automatically adjusting the equipment with the utilization rate exceeding the average value, if a weight reduction method is adopted, and the whole cluster CPU does not need manual operation, thereby realizing the dynamic balance of the utilization rate of the whole cluster CPU.
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 main flow chart of a resource scheduling method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an alternative resource scheduling method according to an embodiment of the present invention;
FIG. 3 is a frame diagram of a resource scheduling method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of main blocks of a resource scheduling apparatus according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 6 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the 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.
Referring to fig. 1, a main flowchart of a resource scheduling method provided in an embodiment of the present invention is shown, including the following steps:
s101: counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device;
s102: taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
s103: and carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
In the foregoing embodiment, regarding steps S101 and S102, the present invention is mainly applied in a distributed cluster environment to implement dynamic scheduling of CPU resource utilization of a device.
The control center is provided with a resource scheduling module, and after the module is started, the average value of the CPU utilization rates of all available devices in the whole application cluster is calculated at first, specifically:
1) calculating the utilization rate of the CPU of a single device, for example, calculating the scheduling quantity of the CPU of the device in a preset time period/preset period to obtain;
2) counting the number of devices, namely the number of available devices in the unified application cluster;
3) and calculating the sum of the CPU utilization rate of the equipment/the number of available equipment, and taking the obtained quotient as the average CPU utilization rate of the equipment under the whole application cluster.
The above may be configured with a timing task to periodically find the average CPU utilization of the devices under the application cluster, for example, every 5 minutes.
And classifying the devices under the application cluster into two types according to the calculated average CPU utilization rate, wherein one type is a first device with the CPU utilization rate more than or equal to the average CPU utilization rate, and the other type is a residual device. Considering that the performance of the whole application cluster may be affected by the high utilization rate of the CPU, the present invention mainly aims at the first device.
For step S103, the resource scheduling module periodically adjusts the weight of the CPU scheduling amount by each device to achieve the purpose of dynamically adjusting the CPU utilization rate; the weight is an allocation strategy of resource scheduling, and the larger the weight is, the more the resource scheduling request amount is allocated.
Determining whether the CPU utilization of the first device exceeds its preset weight, e.g., 100%:
1) if so, directly returning the weight to the first weight, for example, 0, which means that the first device will not participate in load subsequently, and no traffic/resource scheduling assignment is performed;
2) if not, carrying out weight adjustment according to a preset algorithm, specifically: the preset weight- (CPU utilization-CPU average utilization) x 100%.
And then, after receiving a resource scheduling request transmitted by the second device, the resource allocation module allocates resource scheduling amount to each device according to the readjusted weight, and the CPU utilization rate of the device with smaller scheduling amount is gradually reduced. And when the next period is reached, all the devices under the application cluster participate in the next weight adjustment, and finally, the utilization rate of the whole CPU is dynamically adjusted to be gradually reduced to be lower than the average value.
The method provided by the embodiment dynamically adjusts the load weight of the equipment in the whole application cluster according to the CPU utilization rate of the equipment in the distributed cluster environment, so as to avoid the condition that the CPU utilization rate of part of the equipment is too high and the service quality of the whole cluster is influenced.
Referring to fig. 2, a schematic flowchart of an alternative resource scheduling method according to an embodiment of the present invention is shown, including the following steps:
s201: counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device;
s202: the method comprises the steps that an IP address and preset weight of a single device are obtained and uploaded to a data center, and data of the device are transmitted to a resource scheduling module through the data center; the data comprises an IP address, a resource utilization rate and a preset weight;
s203: taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
s204: acquiring a preset weight of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weight;
s205: if so, adjusting the weight of the first equipment to be a first weight;
s206: if not, calculating the difference value between the resource utilization rate of the first equipment and the average resource utilization rate, combining the preset weight to obtain a second weight, and further adjusting the weight of the first equipment to the second weight
S207: when a resource scheduling request is received, determining the scheduling amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resources;
s208: and the resource scheduling module transmits the IP address of the equipment to second equipment which sends the resource scheduling request according to the scheduling result so that the second equipment performs resource scheduling through the transmitted IP address.
In the above embodiment, the descriptions of steps S101 to S103 shown in fig. 1 can be referred to for steps S201 and S203 to S207, and are not repeated herein.
In the above embodiment, for step S202, the device mentioned in the present invention may be regarded as a server providing resource scheduling. The service providing module (server) and the resource calculating module can be deployed in the same device as different components.
After the service providing module is started, the IP address and the preset weight (for example, 100%) of the device are actively acquired and uploaded to the distributed data center. And after the data uploading of the service providing module is finished, the starting of the resource calculating module is automatically triggered. After the resource calculation module is started, the scheduling amount of the CPU in a preset period of a single device is counted, the CPU utilization rate (second level and minute level) is calculated, and the CPU utilization rate is synchronized to the distributed data center.
It should be noted that the device start-up must be better than the second device (sending the resource scheduling request), and the resource calculation module needs to be started after the service providing module synchronizes data, otherwise, the service is easily unavailable.
The modules associated with the distributed data center, in addition to the service providing modules and resource calculating modules in the devices, also include a resource scheduling module for dynamically adjusting the CPU utilization/weight of the devices.
After the resource scheduling module is started, data (including an IP address, a CPU utilization rate and a preset seed cutoff) of equipment in the distributed data center is subscribed, and when the data is monitored to be changed, the data can be actively pulled from the distributed data center, so that the purpose of data synchronization is achieved.
It should be noted that the resource scheduling module is not integral with the distributed data center. The distributed data center may be considered a zookeeper (here, merely an example) based control center for storing data.
In addition, heartbeat monitoring is arranged between the distributed data center and the service providing module, when the condition that the data provided by the service providing module is abnormal is monitored, the data can be automatically removed from the data center, and the removed data are synchronized to the resource scheduling module.
For step S208, the second device aims to schedule the CPU resource in the device, and therefore, the second device is usually started after the device is started, or started before the device is started, and waits for the device to be started and then sends the resource scheduling request.
For the determined device serving the second device, it may be calculated as follows:
1) comparing the resource scheduling request amount of the second device with the determined resource scheduling amount of the device, and finally obtaining the second device with the sum of the scheduling request amounts, for example, the resource scheduling amount of the device a is 100, the resource scheduling request amount of the second device I is 50, the resource scheduling request amount of the second device I is 20 and 50, and the mapping relationships among the device a, the second device I, the second device II and the second device III are finally obtained;
2) sequential training mode:
firstly, establishing a device queue, such as a device a, a device b, a device c and a device d … …, according to the resource scheduling amount of the device
Establishing a second device queue, e.g. second device I, second device II, second device III … …, according to the amount of scheduling requests for resources by the second device
And secondly, distributing the second equipment I to the equipment a, distributing the second equipment II to the equipment b and the like according to a round training mode.
It should be noted that, during the round training, it is necessary to compare whether the scheduling request amount of the second device for the resource is greater than the resource scheduling amount (or the scheduling amount — the allocated scheduling request amount) of the corresponding device, if so, only a part of the resource is allocated, and the second device is moved to the tail of the second device queue, and at this time, one second device may correspond to multiple devices, and both devices present a many-to-many relationship.
3) Random round training mode
The difference from the above 2) is that the second device is randomly allocated to the device, and the resource scheduling request amount and the resource scheduling amount are compared at the same time.
And after the mapping relation between the equipment and the second equipment is determined, transmitting the IP address of the equipment to the corresponding second equipment. And the second equipment can communicate with the equipment only after acquiring the IP address of the equipment, so as to access the CPU resource in the equipment.
The method provided by the above embodiment establishes a mapping relationship between the device and the second device based on the sum of resource scheduling request amounts, the sequential round-robin manner, the random round-robin manner, and the like, so as to realize rationalization of resource scheduling in the device.
Referring to fig. 3, a schematic diagram of a resource scheduling framework according to an embodiment of the present invention is shown, including a distributed data center, a device, a second device, and a resource scheduling module:
1) an apparatus comprising a service providing module (server) and a resource calculating module:
the system comprises a service providing module, a distributed data center and a service processing module, wherein the service providing module actively acquires an IP address and preset weight of equipment and uploads the IP address and the preset weight to the distributed data center;
the resource calculation module counts the scheduling amount of the CPU of a single device in a preset period to calculate the utilization rate of the CPU in response to the completion of data uploading of the service providing module, and then synchronizes the utilization rate of the CPU to the distributed data center;
2) distributed data center: the data storage device is used for storing data of equipment, and comprises an IP address, a preset weight and a CPU utilization rate;
3) the resource scheduling module is associated with the distributed data center and used for acquiring equipment data, dynamically adjusting the weight of each equipment according to the equipment data and determining the mapping relation between the equipment and the second equipment;
4) and the second equipment is used for sending the resource scheduling request.
The method provided by the embodiment of the invention automatically adjusts the equipment with the overhigh CPU utilization rate in the distributed cluster environment, and adopts the weight reduction mode to dynamically balance the CPU utilization rate of the equipment in the whole cluster.
Referring to fig. 4, a schematic diagram of main modules of a resource scheduling apparatus 400 according to an embodiment of the present invention is shown, including:
the resource calculation module 401 is configured to count resource adjustment amounts of a single device in a preset period for a same application cluster, so as to determine a resource utilization rate of the single device;
an equipment extracting module 402, configured to use a ratio of a sum of resource utilization rates to the number of equipment as an average resource utilization rate of the equipment in the application cluster, and extract a first equipment with a resource utilization rate greater than or equal to the average resource utilization rate;
a weight adjusting module 403, configured to perform weight adjustment on the first device according to a preset manner, so as to determine, when a resource scheduling request is received, an amount of scheduling for each device resource based on the weight of each device and the total amount of scheduled resources.
In the device for implementing the present invention, the weight adjusting module 403 is configured to:
acquiring a preset weight of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weight;
if so, adjusting the weight of the first equipment to be a first weight;
if not, calculating a difference value between the resource utilization rate of the first equipment and the average resource utilization rate, combining the preset weight to obtain a second weight, and further adjusting the weight of the first equipment to the second weight.
The device for implementing the present invention further includes a service providing module 404 (not shown in the figure) for:
the method comprises the steps that an IP address and preset weight of a single device are obtained and uploaded to a data center, and data of the single device are transmitted to a resource scheduling module through the data center; the data comprises an IP address, a resource utilization rate and a preset weight;
a resource scheduling module 405 (not shown) for:
and the resource scheduling module transmits the IP address of the equipment to second equipment which sends the resource scheduling request according to the scheduling result so that the second equipment carries out resource scheduling through the transmitted IP address.
In the device for implementing the present invention, the service providing module 404 is configured to:
and when monitoring that the data of the equipment in the data center changes, the resource scheduling module acquires the changed data of the equipment from the data center.
In the device for implementing the present invention, the resource scheduling module 405 is further configured to:
and acquiring the scheduling request quantity of each second device for the resource, determining that the sum of the scheduling request quantities is at least one second device of the scheduling quantity, and further establishing a mapping relation between the devices and the at least one second device.
In the device for implementing the present invention, the resource scheduling module 405 is further configured to:
sequencing the scheduling quantity of each equipment resource according to the determined scheduling quantity to obtain an equipment queue;
sequencing the scheduling request quantity of the resources according to each second device to obtain a second device queue;
and according to a round-robin mode, allocating the second equipment in the second equipment queue to the equipment in the equipment queue, and further establishing a mapping relation between the equipment and the second equipment.
In addition, the detailed implementation of the device in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 to which embodiments of the invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505 (by way of example only). The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 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 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503.
It should be noted that the method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 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. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 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 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
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 comprises a resource calculation module, a device extraction module and a weight adjustment module. The names of these modules do not in some cases constitute a limitation on the module itself, and for example, the weight adjustment module may also be described as a "device weight adjustment module".
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:
counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device;
taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
and carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
According to the technical scheme of the embodiment of the invention, under a distributed cluster environment, equipment with the utilization rate exceeding the average value is automatically adjusted according to the average value of the utilization rate of the existing cluster CPU, for example, a weight reduction method is adopted, manual operation is not required on the whole, and the dynamic balance of the utilization rate of the whole cluster CPU is realized.
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 (9)
1. A method for scheduling resources, comprising:
counting the resource adjustment amount of a single device in a preset period aiming at the same application cluster to determine the resource utilization rate of the single device;
taking the ratio of the sum of the resource utilization rates to the number of the devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
and carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
2. The method of claim 1, wherein the performing the weight adjustment on the first device according to the preset manner comprises:
acquiring a preset weight of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weight;
if so, adjusting the weight of the first equipment to be a first weight;
if not, calculating a difference value between the resource utilization rate of the first equipment and the average resource utilization rate, combining the preset weight to obtain a second weight, and further adjusting the weight of the first equipment to the second weight.
3. The method of claim 1, further comprising:
the method comprises the steps that an IP address and preset weight of a single device are obtained and uploaded to a data center, and data of the single device are transmitted to a resource scheduling module through the data center; the data comprises an IP address, a resource utilization rate and a preset weight;
after the determining the scheduling amount of each device resource, the method further includes:
and the resource scheduling module transmits the IP address of the equipment to second equipment which sends the resource scheduling request according to the scheduling result so that the second equipment carries out resource scheduling through the transmitted IP address.
4. The method of claim 3, wherein transmitting data of the single device to a resource scheduling module through the data center comprises:
and when monitoring that the data of the equipment in the data center changes, the resource scheduling module acquires the changed data of the equipment from the data center.
5. The method of claim 3, further comprising, prior to the transmitting the IP address of the device to the second device that sent the resource scheduling request:
and acquiring the scheduling request quantity of each second device for the resource, determining that the sum of the scheduling request quantities is at least one second device of the scheduling quantity, and further establishing a mapping relation between the devices and the at least one second device.
6. The method of claim 3, further comprising, prior to the transmitting the IP address of the device to the second device that sent the resource scheduling request:
sequencing the scheduling quantity of each equipment resource according to the determined scheduling quantity to obtain an equipment queue;
sequencing the scheduling request quantity of the resources according to each second device to obtain a second device queue;
and according to a round-robin mode, allocating the second equipment in the second equipment queue to the equipment in the equipment queue, and further establishing a mapping relation between the equipment and the second equipment.
7. A resource scheduling apparatus, comprising:
the resource calculation module is used for counting the resource adjustment amount of the single equipment in a preset period aiming at the same application cluster so as to determine the resource utilization rate of the single equipment;
the device extraction module is used for taking the ratio of the sum of the resource utilization rates to the number of devices as the average resource utilization rate of the devices under the application cluster, and extracting the first devices of which the resource utilization rates are greater than or equal to the average resource utilization rate;
and the weight adjusting module is used for adjusting the weight of the first equipment according to a preset mode so as to determine the adjustment amount of each equipment resource based on the weight of each equipment and the total amount of the scheduled resource when a resource scheduling request is received.
8. An electronic device, 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.
9. 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.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010219853.XA CN113448717A (en) | 2020-03-25 | 2020-03-25 | Resource scheduling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010219853.XA CN113448717A (en) | 2020-03-25 | 2020-03-25 | Resource scheduling method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113448717A true CN113448717A (en) | 2021-09-28 |
Family
ID=77806794
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010219853.XA Pending CN113448717A (en) | 2020-03-25 | 2020-03-25 | Resource scheduling method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113448717A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115277417A (en) * | 2022-07-29 | 2022-11-01 | 中国人民解放军国防科技大学 | Method for improving resource utilization rate of communication equipment based on weight constraint of coefficient of variation |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101719082A (en) * | 2009-12-24 | 2010-06-02 | 中国科学院计算技术研究所 | Method and system for dispatching application requests in virtual calculation platform |
US9465630B1 (en) * | 2013-02-20 | 2016-10-11 | Ca, Inc. | Assigning dynamic weighted variables to cluster resources for virtual machine provisioning |
CN107124472A (en) * | 2017-06-26 | 2017-09-01 | 杭州迪普科技股份有限公司 | Load-balancing method and device, computer-readable recording medium |
CN107748691A (en) * | 2017-10-30 | 2018-03-02 | 平安科技(深圳)有限公司 | Virtual machine deployment method, device, equipment and computer-readable recording medium |
CN110362391A (en) * | 2019-06-12 | 2019-10-22 | 北京达佳互联信息技术有限公司 | Resource regulating method, device, electronic equipment and storage medium |
-
2020
- 2020-03-25 CN CN202010219853.XA patent/CN113448717A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101719082A (en) * | 2009-12-24 | 2010-06-02 | 中国科学院计算技术研究所 | Method and system for dispatching application requests in virtual calculation platform |
US9465630B1 (en) * | 2013-02-20 | 2016-10-11 | Ca, Inc. | Assigning dynamic weighted variables to cluster resources for virtual machine provisioning |
CN107124472A (en) * | 2017-06-26 | 2017-09-01 | 杭州迪普科技股份有限公司 | Load-balancing method and device, computer-readable recording medium |
CN107748691A (en) * | 2017-10-30 | 2018-03-02 | 平安科技(深圳)有限公司 | Virtual machine deployment method, device, equipment and computer-readable recording medium |
CN110362391A (en) * | 2019-06-12 | 2019-10-22 | 北京达佳互联信息技术有限公司 | Resource regulating method, device, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
YANG, CT等: "A method for managing green power of a virtual machine cluster in cloud", FUTURE GENERATION COMPUTER SYSTEMS, vol. 37, 31 December 2014 (2014-12-31), pages 26 - 36 * |
黄凯;孟庆永;谢雨来;冯丹;秦磊华;: "基于Docker swarm集群的动态加权调度策略", 计算机应用, no. 05, 26 December 2017 (2017-12-26) * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115277417A (en) * | 2022-07-29 | 2022-11-01 | 中国人民解放军国防科技大学 | Method for improving resource utilization rate of communication equipment based on weight constraint of coefficient of variation |
CN115277417B (en) * | 2022-07-29 | 2024-01-16 | 中国人民解放军国防科技大学 | Method for improving resource utilization rate of communication equipment based on variation coefficient weight constraint |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108696374B (en) | Method and device for updating client configuration | |
CN107341050B (en) | Service processing method and device based on dynamic thread pool | |
US10003550B1 (en) | Smart autoscaling of a cluster for processing a work queue in a distributed system | |
US20170126583A1 (en) | Method and electronic device for bandwidth allocation based on online media services | |
CN107832143B (en) | Method and device for processing physical machine resources | |
CN105610939B (en) | Client, the file download control method of server-side, apparatus and system | |
CN104239150B (en) | A kind of method and device of hardware resource adjustment | |
CN112887228B (en) | Cloud resource management method and device, electronic equipment and computer readable storage medium | |
CN104714851A (en) | Method and device for realizing resource distribution | |
CN112445857A (en) | Resource quota management method and device based on database | |
CN114116173A (en) | Method, device and system for dynamically adjusting task allocation | |
CN109428926B (en) | Method and device for scheduling task nodes | |
CN112749002A (en) | Method and device for dynamically managing cluster resources | |
CN108965364B (en) | Resource allocation method, device and system | |
CN110113176B (en) | Information synchronization method and device for configuration server | |
CN113448717A (en) | Resource scheduling method and device | |
CN111831503A (en) | Monitoring method based on monitoring agent and monitoring agent device | |
CN114327918A (en) | Method and device for adjusting resource amount, electronic equipment and storage medium | |
CN108683608B (en) | Method and device for distributing flow | |
CN112561301A (en) | Work order distribution method, device, equipment and computer readable medium | |
CN106657195B (en) | Task processing method and relay device | |
CN113765969A (en) | Flow control method and device | |
CN113765966A (en) | Load balancing method and device | |
CN109842665B (en) | Task processing method and device for task allocation server | |
WO2022242470A1 (en) | Cdn scheduling method, apparatus and device, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |