CN113448717B - Resource scheduling method and device - Google Patents
Resource scheduling method and deviceInfo
- Publication number
- CN113448717B CN113448717B CN202010219853.XA CN202010219853A CN113448717B CN 113448717 B CN113448717 B CN 113448717B CN 202010219853 A CN202010219853 A CN 202010219853A CN 113448717 B CN113448717 B CN 113448717B
- Authority
- CN
- China
- Prior art keywords
- equipment
- weight
- resource
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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 OR CALCULATING; 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)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a resource scheduling method and device, and relates to the technical field of computers. The method comprises the steps of counting the resource scheduling amount of a single device in a preset period for 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 devices as the average resource utilization rate of the devices under the application cluster, extracting first devices with the resource utilization rate being greater than or equal to the average resource utilization rate, and carrying out weight adjustment on the first devices according to a preset mode to determine the resource scheduling amount of each device based on the weight of each device and the total amount of the scheduled resources when a resource scheduling request is received. In the distributed cluster environment, the embodiment automatically adjusts the equipment with the utilization rate exceeding the average value according to the average value of the utilization rate of the existing cluster CPU, if a weight reduction method is adopted, manual operation is not needed in the whole, and 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 method and an apparatus for scheduling resources.
Background
In the internet environment, the access amount of users is usually tens or even hundreds of millions, so that the number of application clusters for providing services is small, and the quality of the whole cluster service is affected by the level of resources of each device CPU (Central Proc essing Unit ).
In the existing equipment management, due to the problems of equipment hardware aging or unbalanced resource allocation, the utilization rate of some equipment CPUs is too high, and the utilization rate of some equipment CPUs is too low, so that the problem of unstable service provision is caused. A developer usually selects a resource monitoring alarm mode, and equipment with over-high CPU utilization rate is manually disconnected to reduce the load weight value of the equipment, so that the CPU resource consumption is reduced by reducing resource access.
In carrying out the present invention, the inventors have found that at least the following problems exist in the prior art:
the number of the devices in the distributed cluster is large, and a mode of manually processing the devices with too high CPU utilization rate is selected, so that time and labor are consumed.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and an apparatus for scheduling resources, which at least can solve the problem in the prior art that the device with too high CPU utilization needs to be manually adjusted.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a resource scheduling method, including:
For the same application cluster, counting the resource scheduling amount of the single equipment in a preset period to determine the resource utilization rate of the single equipment;
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 first devices with the resource utilization rate 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 scheduling amount of the resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when the resource scheduling request is received.
Optionally, the weight adjustment of the first device according to a preset manner includes:
acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
If yes, the weight of the first equipment is adjusted to be a first weight;
If not, calculating the difference between the resource utilization rate of the first equipment and the average resource utilization rate, and combining the preset weight to obtain a second weight, so that the weight of the first equipment is adjusted to be the second weight.
Optionally, the method further comprises:
Acquiring an IP address and a preset weight of a single device and uploading the IP address and the preset weight to a data center so as to transmit data of the single device to a resource scheduling module through the data center, wherein the data comprises the IP address, the resource utilization rate and the preset weight;
after determining the scheduling amount of each device resource, the method further comprises:
and the resource scheduling module transmits the IP address of the equipment to the second equipment for sending the resource scheduling request according to the scheduling result, so that the second equipment performs resource scheduling through the transmitted IP address.
Optionally, the data transmission of the single device to the resource scheduling module through the data center includes that the resource scheduling module acquires the changed data from the data center when the change of the data of the device in the data center is monitored.
Optionally, before the IP address of the device is transmitted to the second device sending the resource scheduling request, the method further comprises the steps of obtaining the scheduling request quantity of each second device for the resource, determining that the sum of the scheduling request quantity is at least one second device of the scheduling quantity, and further establishing a mapping relation between the device and the at least one second device.
Optionally, before the IP address of the device is transmitted to the second device that sends the resource scheduling request, the method further includes:
sequencing the scheduling amount of each equipment resource according to the determined scheduling amount 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 distributing the second equipment in the second equipment queue to the equipment in the equipment queue according to a training mode, and further establishing a mapping relation between the equipment and the second equipment.
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 first devices with the resource utilization rate greater than or equal to the average resource utilization rate;
And the weight adjustment module is used for carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of the resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when the resource scheduling request is received.
Optionally, the weight adjustment module is configured to:
acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
If yes, the weight of the first equipment is adjusted to be a first weight;
If not, calculating the difference between the resource utilization rate of the first equipment and the average resource utilization rate, and combining the preset weight to obtain a second weight, so that the weight of the first equipment is adjusted to be the second weight.
Optionally, the system further comprises a service providing module for:
Acquiring an IP address and a preset weight of a single device and uploading the IP address and the preset weight to a data center so as to transmit data of the single device to a resource scheduling module through the data center, wherein the data comprises the IP address, the resource utilization rate and the preset weight;
a resource scheduling module, configured to:
and the resource scheduling module transmits the IP address of the equipment to the second equipment for sending the resource scheduling request according to the scheduling result, so that the second equipment performs resource scheduling through the transmitted IP address.
Optionally, the service providing module is configured to, when the resource scheduling module monitors that the data of the device in the data center changes, obtain the data after the device changes from the data center.
Optionally, the resource scheduling module is further configured to obtain a scheduling request amount of each second device for resources, determine that a sum of the scheduling request amounts is at least one second device of the scheduling amounts, and further establish a mapping relationship between the device and the at least one second device.
Optionally, the resource scheduling module is further configured to:
sequencing the scheduling amount of each equipment resource according to the determined scheduling amount 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 distributing the second equipment in the second equipment queue to the equipment in the equipment queue according to a training mode, 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 equipment comprises one or more processors and a storage device, wherein the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize any one of the resource scheduling methods.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements any of the above-described resource scheduling methods.
According to the scheme provided by the invention, one embodiment of the invention has the advantages that under the 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, such as a weight reduction method is adopted, manual operation is not needed in the whole, and dynamic balance of the utilization rate of the whole cluster CPU is realized.
Further effects of the above-described non-conventional alternatives are 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 flow diagram of a resource scheduling method according to an embodiment of the present invention;
FIG. 2 is a flow chart of an alternative resource scheduling method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a resource scheduling method framework according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of main modules 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 applied;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered 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 by an embodiment of the present invention is shown, including the following steps:
S101, counting the resource scheduling 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 and the number of devices as the average utilization rate of the resources of the devices under the application cluster, and extracting first devices with the resource utilization rate greater than or equal to the average utilization rate of the resources;
And S103, carrying out weight adjustment on the first equipment according to a preset mode so as to determine the scheduling amount of the resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when the resource scheduling request is received.
In the above embodiment, for steps S101 and S102, the present invention is mainly applied in a distributed cluster environment, so as to implement dynamic scheduling of the device CPU resource utilization.
The control center is provided with a resource scheduling module, and after the module is started, the average value of the CPU utilization rate of all available devices in the whole application cluster is calculated firstly, specifically:
1) Calculating the CPU utilization rate of a single device, for example, calculating the scheduling amount of the CPU of the device in a preset time period/a preset period;
2) Counting the number of devices, namely the number of available devices under a unified application cluster;
3) Calculating the sum of the CPU utilization rates of the devices and/or the number of the available devices, and taking the obtained quotient as the average CPU utilization rate of the devices under the whole application cluster.
The above may set a timing task to periodically find the average CPU utilization of the devices under the application cluster, e.g. updated every 5 minutes.
And classifying the devices under the application cluster into two types according to the calculated average utilization rate of the CPU, wherein one type is the first device with the CPU utilization rate larger than or equal to the average utilization rate of the CPU, and the other type is the rest device. Considering that the CPU utilization rate is too high and the performance of the whole application cluster can be influenced, the invention mainly aims at the first equipment.
For step S103, the resource scheduling module periodically adjusts the weight of each device to the CPU scheduling amount so as to realize the purpose of dynamically adjusting the CPU utilization rate, wherein the weight is an allocation strategy of resource scheduling, and the larger the weight is, the more the allocated resource scheduling request amount is.
Judging whether the CPU utilization of the first device exceeds a preset weight, for example, 100%:
1) If so, directly homing the weight to a first weight, for example, 0, namely, indicating that the first equipment is not involved in load later and no flow/resource scheduling allocation exists;
2) If not, the weight adjustment is performed according to a predetermined algorithm, specifically, the weight- (CPU utilization-CPU average utilization) ×100% is preset.
And then, after receiving the resource scheduling request transmitted by the second device, the resource allocation module allocates the resource scheduling amount to each device according to the readjusted weight, and the CPU utilization rate of the device with smaller scheduling amount can be gradually reduced. And when the next period is reached, all the devices in the application cluster participate in the next weight adjustment, and finally, the utilization rate of the overall CPU is dynamically adjusted to be gradually reduced below the average value.
According to the method provided by the embodiment, under the distributed cluster environment, the load weight of the equipment under the whole application cluster is dynamically adjusted according to the CPU utilization rate of the equipment, so that the situation that the service quality of the whole cluster is affected due to the fact that the CPU utilization rate of part of the equipment is too high is avoided.
Referring to fig. 2, a 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 scheduling 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, acquiring an IP address and a preset weight of a single device and uploading the IP address and the preset weight to a data center so as to transmit data of the device to a resource scheduling module through the data center, wherein the data comprises the IP address, the resource utilization rate and the preset weight;
S203, taking the ratio of the sum of the resource utilization rates and the number of devices as the average utilization rate of the resources of the devices under the application cluster, and extracting first devices with the resource utilization rate greater than or equal to the average utilization rate of the resources;
s204, acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
s205, if yes, 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 be the second weight
S207, when a resource scheduling request is received, determining the scheduling amount of the resources of each device based on the weight of each device and the total amount of the scheduled resources;
And S208, the resource scheduling module transmits the IP address of the equipment to the second equipment for sending 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 steps S201, S203 to S207 may be referred to the descriptions of the steps S101 to S103 shown in fig. 1, and will not be repeated here.
In the above embodiment, for step S202, the device mentioned in the present invention may be regarded as a service end for providing resource scheduling. The service providing module (server) and the resource computing 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 service providing module finishes uploading the data, automatically triggering the starting of the resource calculating module. After the resource calculation module is started, the adjustment amount of a single device to the CPU in a preset period is counted, so that the CPU utilization rate (second level and minute level) is calculated and obtained, 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 up after the service providing module synchronizes the data, otherwise, the service is not available easily.
The module associated with the distributed data center comprises a resource scheduling module in addition to a service providing module and a resource calculating module in the equipment, and is used for dynamically adjusting the CPU utilization rate/weight of the equipment.
After the resource scheduling module is started, subscribing the data (including IP address, CPU utilization rate and preset broken seed) of the equipment in the distributed data center, and actively pulling the data from the distributed data center when the data is monitored to be changed, so that the aim of data synchronization is fulfilled.
It should be noted that the resource scheduling module is not integral with the distributed data center. A distributed data center may be considered a zookeeper-based (here, by way of example only) control center for storing data.
In addition, heartbeat monitoring is arranged between the distributed data center and the service providing module, when abnormal data states provided by the service providing module are monitored, the data are automatically removed from the data center, and the deleted data are synchronized to the resource scheduling module.
For step S208, the second device aims at scheduling CPU resources in the device, so that it is usually restarted after the device is started, or it may be started before the device is started, and wait for the device to start and then send a resource scheduling request.
For a determined device serving a second device, the calculation may be as follows:
1) Comparing the scheduling request quantity of the second device to the resource with the determined scheduling request quantity of the second device to obtain a second device of the sum of the scheduling request quantities, for example, the scheduling request quantity of the second device I to the resource is 50, the scheduling request quantity of the second device II to the resource is 20 and 50, and the mapping relation among the device a-second device I, the second device II and the second device III is finally obtained;
2) Sequential training mode:
① First, a device queue, e.g., device a, device b, device c, device d., is established according to the amount of resource modulation for the device.
A second device queue, e.g., second device I, second device II, second device iii, is established according to the amount of scheduling requests for resources by the second device.
② In a training manner, a second device I is assigned to device a, a second device II is assigned to device b, and so on.
It should be noted that, when the scheduling request amount of the second device for the resource needs to be compared during the training, whether the scheduling request amount is greater than the resource scheduling amount (or the scheduling amount-the allocated scheduling request amount) of the corresponding device is required, if so, only a part of the scheduling request amount is allocated, and the second device is moved to the tail of the second device queue, at this time, one second device can correspond to a plurality of devices, and the two devices show a many-to-many relationship.
3) Random training mode
The difference from 2) above is that the second device is randomly allocated to the devices while comparing the resource scheduling request amount and the resource scheduling amount.
And after the mapping relation between the equipment and the second equipment is determined, the equipment IP address is transmitted to the corresponding second equipment. The second device can communicate with the device only after the device IP address is acquired, thereby accessing the CPU resources in the device.
The method provided by the embodiment establishes the mapping relation between the equipment and the second equipment based on the sum of the resource scheduling request amounts, the sequential training mode, the random training mode and the like, so as to realize rationalization of resource scheduling in the equipment.
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 computing module:
① The service providing module actively acquires the IP address and the preset weight of the equipment and uploads the IP address and the preset weight to the distributed data center;
② The resource calculation module is used for counting the scheduling quantity of the CPU in a preset period by a single device to calculate to obtain the CPU utilization rate in response to the completion of the data uploading by the service providing module, and then synchronizing the CPU utilization rate to the distributed data center;
2) The distributed data center is used for storing data of the equipment, and comprises an IP address, preset weight and CPU utilization rate;
3) The resource scheduling module is associated with the distributed data center and is 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.
In the method provided by the embodiment of the invention, the equipment with the over-high CPU utilization rate is automatically adjusted in the distributed cluster environment, and the CPU utilization rate of the equipment in the whole cluster is dynamically balanced in a weight reduction mode.
Referring to fig. 4, a schematic diagram of main modules of a resource scheduling apparatus 400 provided by an embodiment of the present invention is shown, including:
The resource calculation module 401 is configured to count, for the same application cluster, a resource adjustment amount of a single device in a preset period, so as to determine a resource utilization rate of the single device;
the device extraction module 402 is configured to take a ratio of a sum of resource utilization rates to a number of devices as a resource average utilization rate of devices under the application cluster, and extract a first device with a resource utilization rate greater than or equal to the resource average utilization rate;
the weight adjustment module 403 is 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, a scheduling amount of resources of each device based on the weight of each device and the total amount of resources scheduled.
In the embodiment of the present invention, the weight adjustment module 403 is configured to:
acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
If yes, the weight of the first equipment is adjusted to be a first weight;
If not, calculating the difference between the resource utilization rate of the first equipment and the average resource utilization rate, and combining the preset weight to obtain a second weight, so that the weight of the first equipment is adjusted to be the second weight.
The implementation device of the present invention further includes a service providing module 404 (not shown in the figure) for:
Acquiring an IP address and a preset weight of a single device and uploading the IP address and the preset weight to a data center so as to transmit data of the single device to a resource scheduling module through the data center, wherein the data comprises the IP address, the resource utilization rate and the preset weight;
A resource scheduling module 405 (not shown) for:
and the resource scheduling module transmits the IP address of the equipment to the second equipment for sending the resource scheduling request according to the scheduling result, so that the second equipment performs resource scheduling through the transmitted IP address.
In the embodiment of the present invention, the service providing module 404 is configured to:
And the resource scheduling module acquires the changed data of the equipment from the data center when detecting the change of the data of the equipment in the data center.
In the embodiment of 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 at least one second device with the sum of the scheduling request quantity as the scheduling quantity, and further establishing a mapping relation between the device and the at least one second device.
In the embodiment of the present invention, the resource scheduling module 405 is further configured to:
sequencing the scheduling amount of each equipment resource according to the determined scheduling amount 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 distributing the second equipment in the second equipment queue to the equipment in the equipment queue according to a training mode, and further establishing a mapping relation between the equipment and the second equipment.
In addition, the implementation of the apparatus in the embodiments of the present invention has been described in detail in the above method, so that the description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 in which embodiments of the present 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 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various communication client applications can be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type 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 performed 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, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which 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 required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Connected to the I/O interface 605 are an input section 606 including a keyboard, a mouse, and the like, an output section 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, 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, and the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to 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 shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a 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 context of this document, 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, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. 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 of the foregoing. 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, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts 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 involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, a processor may be described as including a resource calculation module, a device extraction module, and a weight adjustment module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, the weight adjustment module may also be described as a "device weight adjustment module".
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
For the same application cluster, counting the resource scheduling amount of the single equipment in a preset period to determine the resource utilization rate of the single equipment;
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 first devices with the resource utilization rate 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 scheduling amount of the resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when the resource scheduling request is received.
According to the technical scheme of the embodiment of the invention, under the distributed cluster environment, according to the average value of the utilization rate of the existing cluster CPU, equipment with the utilization rate exceeding the average value is automatically adjusted, for example, a weight reduction method is adopted, manual operation is not needed in the whole, and the dynamic balance of the utilization rate of the whole cluster CPU is realized.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (8)
1. A method for scheduling resources, comprising:
For the same application cluster, counting the resource scheduling amount of the single equipment in a preset period to determine the resource utilization rate of the single equipment;
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 first devices with the resource utilization rate greater than or equal to the average resource utilization rate;
The method comprises the steps of carrying out weight adjustment on first equipment according to a preset mode to determine the scheduling amount of resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when a resource scheduling request is received, wherein the weight is an allocation strategy of resource scheduling, the larger the weight is, the more the allocated resource scheduling request amount is, and carrying out weight adjustment on the first equipment according to the preset mode, wherein the method comprises the following steps:
acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
If yes, the weight of the first equipment is adjusted to be a first weight, wherein the first weight indicates that the first equipment does not participate in load subsequently, and no flow/resource scheduling distribution exists;
If not, calculating the difference value between the resource utilization rate of the first equipment and the average resource utilization rate, and combining the preset weight to obtain a second weight, so that the weight of the first equipment is adjusted to be the second weight, wherein the second weight is the difference between the preset weight and the difference value.
2. The method as recited in claim 1, further comprising:
Acquiring an IP address and a preset weight of a single device and uploading the IP address and the preset weight to a data center so as to transmit data of the single device to a resource scheduling module through the data center, wherein the data comprises the IP address, the resource utilization rate and the preset weight;
after determining the scheduling amount of each device resource, the method further comprises:
and the resource scheduling module transmits the IP address of the equipment to the second equipment for sending the resource scheduling request according to the scheduling result, so that the second equipment performs resource scheduling through the transmitted IP address.
3. The method of claim 2, wherein the transmitting, by the data center, the data of the single device to the resource scheduling module comprises:
And the resource scheduling module acquires the changed data of the equipment from the data center when detecting the change of the data of the equipment in the data center.
4. The method of claim 2, further comprising, prior to said 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 at least one second device with the sum of the scheduling request quantity as the scheduling quantity, and further establishing a mapping relation between the device and the at least one second device.
5. The method of claim 2, further comprising, prior to said transmitting the IP address of the device to the second device that sent the resource scheduling request:
sequencing the scheduling amount of each equipment resource according to the determined scheduling amount 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 distributing the second equipment in the second equipment queue to the equipment in the equipment queue according to a training mode, and further establishing a mapping relation between the equipment and the second equipment.
6. 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 first devices with the resource utilization rate greater than or equal to the average resource utilization rate;
The weight adjustment module is used for carrying out weight adjustment on the first equipment according to a preset mode so as to determine the adjustment amount of the resources of each equipment based on the weight of each equipment and the total amount of the scheduled resources when the resource scheduling request is received, wherein the weight is an allocation strategy of resource scheduling, the larger the weight is, the more the allocated resource scheduling request amount is, and the weight adjustment is carried out on the first equipment according to the preset mode, and the weight adjustment module comprises the following steps:
acquiring preset weights of the first equipment, and judging whether the resource utilization rate of the first equipment is greater than or equal to the preset weights;
If yes, the weight of the first equipment is adjusted to be a first weight, wherein the first weight indicates that the first equipment does not participate in load subsequently, and no flow/resource scheduling distribution exists;
If not, calculating the difference value between the resource utilization rate of the first equipment and the average resource utilization rate, and combining the preset weight to obtain a second weight, so that the weight of the first equipment is adjusted to be the second weight, wherein the second weight is the difference between the preset weight and the difference value.
7. An electronic device, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010219853.XA CN113448717B (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 CN113448717B (en) | 2020-03-25 | 2020-03-25 | Resource scheduling method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113448717A CN113448717A (en) | 2021-09-28 |
| CN113448717B true CN113448717B (en) | 2025-09-16 |
Family
ID=77806794
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010219853.XA Active CN113448717B (en) | 2020-03-25 | 2020-03-25 | Resource scheduling method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113448717B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115016269B (en) * | 2022-05-31 | 2025-11-11 | 济南浪潮数据技术有限公司 | Power consumption adjusting method, system and device |
| CN115277417B (en) * | 2022-07-29 | 2024-01-16 | 中国人民解放军国防科技大学 | Method for improving resource utilization rate of communication equipment based on variation coefficient weight constraint |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102594869A (en) * | 2011-12-30 | 2012-07-18 | 深圳市同洲视讯传媒有限公司 | Method and device for dynamically distributing resources under cloud computing environment |
| CN107124472A (en) * | 2017-06-26 | 2017-09-01 | 杭州迪普科技股份有限公司 | Load-balancing method and device, computer-readable recording medium |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101719082B (en) * | 2009-12-24 | 2013-01-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 |
| US9948513B2 (en) * | 2015-03-13 | 2018-04-17 | International Business Machines Corporation | Managing servers with quality of service assurances |
| CN107748691B (en) * | 2017-10-30 | 2020-04-24 | 平安科技(深圳)有限公司 | Virtual machine deployment method, device, equipment and computer readable storage medium |
| CN108874640B (en) * | 2018-05-07 | 2022-09-30 | 北京京东尚科信息技术有限公司 | Cluster performance evaluation method and device |
| CN110362391B (en) * | 2019-06-12 | 2021-08-13 | 北京达佳互联信息技术有限公司 | Resource scheduling method and device, electronic equipment and storage medium |
-
2020
- 2020-03-25 CN CN202010219853.XA patent/CN113448717B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102594869A (en) * | 2011-12-30 | 2012-07-18 | 深圳市同洲视讯传媒有限公司 | Method and device for dynamically distributing resources under cloud computing environment |
| CN107124472A (en) * | 2017-06-26 | 2017-09-01 | 杭州迪普科技股份有限公司 | Load-balancing method and device, computer-readable recording medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113448717A (en) | 2021-09-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12368682B2 (en) | Software load balancer to maximize utilization | |
| CN108696374B (en) | Method and apparatus for updating client configuration | |
| CN109246229B (en) | Method and device for distributing resource acquisition request | |
| JP4984169B2 (en) | Load distribution program, load distribution method, load distribution apparatus, and system including the same | |
| CN108023953B (en) | High-availability implementation method and device for FTP service | |
| US20130346974A1 (en) | Systems and Methods for Transparently Optimizing Workloads | |
| CN112445857A (en) | Resource quota management method and device based on database | |
| CN105610939B (en) | Client, the file download control method of server-side, apparatus and system | |
| CN114116173B (en) | Method, device and system for dynamically adjusting task allocation | |
| CN114640681B (en) | Data processing method and system | |
| CN113448717B (en) | Resource scheduling method and device | |
| CN115134368A (en) | Load balancing method, device, equipment and storage medium | |
| CN109428926B (en) | A method and apparatus for scheduling task nodes | |
| CN116204273B (en) | Fragment distribution method, apparatus, electronic device and computer readable medium | |
| CN111770026B (en) | Network flow control method and device | |
| CN113765966B (en) | Load balancing method and device | |
| CN118467140B (en) | Task scheduling method and system | |
| CN111625344B (en) | Resource scheduling system, method and device in application system | |
| CN113064620B (en) | A method and device for processing system data | |
| CN113660298B (en) | Data migration method and device | |
| CN116961918A (en) | Token acquisition method and device | |
| CN115209486A (en) | Method, device, equipment and storage medium for acquiring uplink scheduling resources | |
| CN114268799A (en) | Streaming media transmission method and device, electronic equipment and medium | |
| CN113448715B (en) | Resource scheduling method and device | |
| CN113254225A (en) | Data synchronization method and device |
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 |