CN113485838A - Server distribution method and device, electronic equipment and computer readable storage medium - Google Patents

Server distribution method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN113485838A
CN113485838A CN202110847576.1A CN202110847576A CN113485838A CN 113485838 A CN113485838 A CN 113485838A CN 202110847576 A CN202110847576 A CN 202110847576A CN 113485838 A CN113485838 A CN 113485838A
Authority
CN
China
Prior art keywords
server
task
target
target task
candidate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110847576.1A
Other languages
Chinese (zh)
Inventor
段志强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110847576.1A priority Critical patent/CN113485838A/en
Publication of CN113485838A publication Critical patent/CN113485838A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The disclosure provides a server distribution method and device, electronic equipment and a computer readable storage medium. The present disclosure relates to the field of computer technologies, and the server allocation method includes: determining whether an exclusive server is to be allocated to the target task, wherein the exclusive server is a server which does not execute the allocation task at present, and the allocation task is an executing task; under the condition that the exclusive server does not need to be allocated to the target task, according to a preset matching rule, the target server is determined from the candidate servers so as to allocate the target server to the target task; the candidate server is a server executing the allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the allocation task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.

Description

Server distribution method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a server allocation method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
Background
In a service system, in the process of executing a service, system applications related to the service need to be started to complete service execution, and for some application processes, timing tasks need to be executed.
Disclosure of Invention
In view of the above, the present disclosure provides a server allocation method and apparatus, an electronic device, and a computer-readable storage medium.
One aspect of the present disclosure provides a server allocation method, including:
determining whether an exclusive server is to be allocated to the target task, wherein the exclusive server is a server which does not execute the allocation task at present, and the allocation task is an executing task; and
under the condition that the exclusive server does not need to be allocated to the target task, according to a preset matching rule, the target server is determined from the candidate servers so as to allocate the target server to the target task;
the candidate server is a server executing the allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the allocation task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.
According to an embodiment of the present disclosure, wherein the predetermined index includes at least one of: CPU utilization rate, memory utilization rate and disk utilization rate.
According to an embodiment of the present disclosure, wherein determining the target server from the plurality of candidate servers comprises:
determining a preselected server from a plurality of candidate servers, wherein under the condition that a target task and an allocation task are simultaneously executed in the preselected server, at least one preset index is smaller than a preset threshold value; and determining a target server from the plurality of preselected servers.
According to an embodiment of the present disclosure, wherein determining the preselected server from the plurality of candidate servers comprises:
acquiring a historical execution record of the target task in a preset time period, wherein the historical execution record comprises a historical record value of a preset index consumed by the target task each time the target task is executed;
determining a preset index historical record peak value of the target task from the historical execution records;
respectively calculating each preset index pre-estimated value of each candidate server, wherein the preset index pre-estimated value is the sum of the current consumption value of a preset index of the candidate server and the historical record peak value of the preset index of the target task;
and determining the candidate servers of which the predicted values of the preset indexes are smaller than a preset threshold value as the preselected servers.
According to an embodiment of the present disclosure, wherein determining the target server from the plurality of preselected servers comprises:
determining an average index value of each pre-selected server, wherein the average index value is an average value of respective historical highest recorded values of at least one predetermined index of the pre-selected servers in a preset time period;
and determining the preselected server with the highest average index value as the target server.
According to an embodiment of the present disclosure, wherein determining whether to allocate an exclusive server for the target task comprises:
determining whether the target task is to be executed in a separate server according to the attribute of the target task; and in the event that it is determined that the target task is to be executed in a separate server, allocating an exclusive server for the target task.
According to an embodiment of the present disclosure, wherein determining whether to allocate an exclusive server for the target task comprises:
determining whether the target task has not been executed;
and under the condition that the target task is determined not to be executed, allocating an exclusive server for the target task.
According to an embodiment of the present disclosure, further comprising:
determining whether to reclaim the target server in response to completion of execution of the target task in the target server;
adding the target server to a waiting server queue if it is determined that the target server is not to be recycled;
in response to receiving an indication to re-execute the target task, a target server is assigned for the target task.
A server distribution device comprises a first determination module and a second determination module.
The first determining module is used for determining whether an exclusive server is to be allocated to the target task, wherein the exclusive server is a server which does not execute the allocation task at present, and the allocation task is an executing task; the second determining module is used for determining a target server from the candidate servers according to a preset matching rule under the condition that the target task does not need to be allocated with an exclusive server, so that the target server is allocated to the target task; the candidate server is a server executing the allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the allocation task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.
According to an embodiment of the present disclosure, wherein the predetermined index includes at least one of: CPU utilization rate, memory utilization rate and disk utilization rate.
According to an embodiment of the present disclosure, wherein the second determining module includes: a first determination unit and a second determination unit.
The system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining a preselected server from a plurality of candidate servers, and under the condition that a target task and an allocation task are simultaneously executed in the preselected server, at least one preset index is smaller than a preset threshold value; a second determining unit for determining a target server from the plurality of preselected servers.
According to an embodiment of the present disclosure, the first determining unit includes an obtaining subunit, a first determining subunit, a calculating subunit, and a second determining subunit.
An acquisition subunit, configured to acquire a history execution record of the target task within a predetermined period, where the history execution record includes a predetermined index history value consumed by the target task each time the target task is executed;
a first determining subunit, configured to determine a predetermined index history peak value of the target task from the history execution records;
the calculation subunit is used for calculating each preset index pre-estimated value of each candidate server respectively, wherein the preset index pre-estimated value is the sum of the current consumption value of the preset index of the candidate server and the historical record peak value of the preset index of the target task;
and the second determining subunit is used for determining the candidate servers of which all the preset index predicted values are smaller than the preset threshold value as the preselected servers.
According to the embodiment of the disclosure, the second determination unit comprises a third determination subunit and a fourth determination subunit.
The third determining subunit is used for determining an average index value of each pre-selected server, wherein the average index value is an average value of respective historical highest recorded values of at least one predetermined index of the pre-selected servers in a preset time period; and the fourth determining subunit is used for determining the preselected server with the highest average index value as the target server.
According to the embodiment of the disclosure, the first determining module comprises a third determining unit and a fourth determining unit.
The third determining unit is used for determining whether the target task is to be executed in the independent server or not according to the attribute of the target task; a fourth determination unit configured to, in a case where it is determined that the target task is to be executed in the separate server, allocate an exclusive server to the target task.
According to the embodiment of the disclosure, the first determination module comprises a fifth determination unit and a sixth determination unit.
The fifth determining unit is used for determining whether the target task is not executed; and the sixth determining unit is used for allocating the exclusive server to the target task under the condition that the target task is determined not to be executed.
According to the embodiment of the disclosure, the device further comprises a third determining module, an adding module and an allocating module.
The third determining module is used for responding to the completion of the target task executed in the target server and determining whether to recycle the target server; the adding module is used for adding the target server to the waiting server queue under the condition that the target server is determined not to be recycled; and the allocation module is used for responding to the received instruction of executing the target task again and allocating the target server for the target task.
Another aspect of the present disclosure provides an electronic device including: one or more processors, and a memory; wherein the memory is for storing one or more programs; wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the server allocation method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the server allocation method as described above when executed.
Another aspect of the disclosure provides a computer program product comprising computer executable instructions for implementing the server allocation method as described above when executed.
According to the embodiment of the disclosure, by the server allocation method, whether exclusive servers need to be allocated to the target tasks is judged, and under the condition that the exclusive servers do not need to be allocated to the target timed tasks, shared server resources are allocated to the target timed tasks, so that the server resources are reasonably allocated and utilized. Under the condition that exclusive servers do not need to be allocated to the target timing tasks, shared server resources are allocated to the target timing tasks according to a preset matching rule, server resources with low resource utilization rate can be fully utilized, and the problem of server resource waste is solved. And the preset matching rules are established to ensure that each preset index of the candidate server does not exceed the preset threshold under the condition that the candidate server executes the target task and distributes the task at the same time, so that the target task cannot be executed when the preset threshold is exceeded, and the normal execution of the task is ensured on the premise of fully utilizing the server resources.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the server allocation method and apparatus of the present disclosure may be applied;
FIG. 2 schematically illustrates a flow chart of a server allocation method according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow diagram for determining a preselected server from a plurality of candidate servers according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a block diagram of a server distribution apparatus according to an embodiment of the present disclosure; and
fig. 5 schematically shows a block diagram of an electronic device for implementing a server allocation method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Before the embodiments of the present disclosure are explained in detail, the system structure and the application scenario related to the method provided by the embodiments of the present disclosure are described as follows.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the server allocation methods and apparatus of the present disclosure may be applied. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include a task allocation server 101 and a task execution service cluster 102. The task distribution server 101 and the task execution service cluster 102 may communicate with each other via a network, which may include various connection types, such as wired and/or wireless communication links, and so on.
In the application scenario of the present disclosure, in the process of executing a service, for some service application processes, it needs to be completed by executing a timing task. The task allocation server 101 may be configured to perform timed task allocation, that is, to allocate each timed task to a corresponding execution server in the task execution service cluster 102 according to allocation logic. The task execution service cluster 102 may include a plurality of execution servers for executing timed tasks. Each executive server may currently be in a task execution state or an idle state.
According to the embodiment of the disclosure, before executing a service, a one-to-one association relationship needs to be established between a service application and a corresponding timing task in advance, so as to match the corresponding timing task for each service application. According to the embodiment of the present disclosure, the service application information, the timing task information, and the information of each execution server in the task execution service cluster 102 also need to be registered in the task allocation server 101, so that the task allocation server 101 performs timing task allocation, and allocates each timing task to a corresponding execution server in the task execution service cluster 102 according to allocation logic.
It should be noted that the server allocation method provided by the embodiment of the present disclosure may be generally executed by the task allocation server 101. Accordingly, the server distribution apparatus provided by the embodiment of the present disclosure may be generally disposed in the distribution server 101. The server allocation method provided by the embodiment of the present disclosure may also be executed by a terminal device, a server, or a server cluster that is different from the allocation server 101 and is capable of communicating with the task execution service cluster 102.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
In the process of executing the service, for some service application processes, timing tasks need to be executed, currently, each timing task is executed once a day in a fixed-point execution mode, and after the execution is completed, the server is in an idle state, or the number of executed tasks in some servers is small, the resource utilization rate is low, and the resource waste of the server is caused.
In view of this, embodiments of the present disclosure provide a server allocation method.
Fig. 2 schematically shows a flow chart of a server allocation method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S202.
In operation S201, it is determined whether an exclusive server is to be allocated to the target task, where the exclusive server is a server that does not currently execute the allocation task, and the allocation task is an executing task.
In operation S202, in a case where it is determined that an exclusive server does not need to be allocated for the target task, a target server is determined from a plurality of candidate servers according to a preset matching rule so as to allocate the target server for the target task. The candidate server is a server executing the allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the allocation task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value. According to the embodiment of the disclosure, the predetermined index may be, for example, a CPU usage rate, a memory usage rate, a disk usage rate, or the like of the server.
According to the embodiment of the disclosure, in the application scenario of the embodiment of the disclosure, the target task may be a timed task to be executed corresponding to each business application process, or may also be other non-timed computing tasks to be executed, and the like.
According to an embodiment of the present disclosure, performing the above-described server allocation method may be performed in a task allocation server that may be used alone to perform an allocation task, and may not be used to perform a target task.
According to the embodiment of the disclosure, the target tasks can be executed in the execution servers in the task execution service cluster, and each target task is distributed to the corresponding execution server in the task execution service cluster according to the distribution logic by executing the distribution method. The candidate server is a part of the execution servers in the task execution service cluster. In the task execution service cluster, each execution server can be in a task execution state or an idle state currently, and the candidate server is the execution server executing the distributed task.
According to the embodiment of the disclosure, before executing a service, a one-to-one association relationship needs to be established between a service application and a corresponding target task in advance, so as to match the corresponding target task for each service application. According to the embodiment of the present disclosure, the service application information, the target task information, and the information of each execution server in the task execution service cluster need to be registered in the task allocation server, so that the task allocation server performs server allocation according to the information.
According to the embodiment of the present disclosure, it is first necessary to determine whether an exclusive server is to be allocated for a target task in operation S201. For example, since some target tasks consume relatively large computing resources, the shared servers with other tasks affect the task execution efficiency, and thus exclusive servers need to be allocated to the tasks. When determining that the exclusive server needs to be allocated to the target task, allocating the exclusive server to the target task, executing the target task in the exclusive server, automatically saving an execution record, such as information of a CPU (central processing unit), a JVM (internal storage) and the occupation condition of the disk capacity during the operation, and automatically backing up the record information in an operation log.
According to the embodiment of the present disclosure, in a case that it is determined that an exclusive server does not need to be allocated to the target task, in operation S202, the target server is screened and matched from a plurality of candidate servers, that is, execution servers that are executing the allocation task, according to a preset matching rule, so as to allocate the target server to the target task, execute the target task in the target server, and automatically save execution records, such as information of CPU, JVM (memory), disk capacity occupation, and the like during running, and automatically backup the record information in a running log.
According to the embodiment of the disclosure, when the target server meeting the matching condition does not exist in the server resource pool, the idle server is waited, and if the target server meeting the matching condition does not exist after waiting for the preset time period, the server can be reapplied so as to avoid that the waiting time is too long and the task execution is influenced.
According to the embodiment of the disclosure, by the server allocation method, whether exclusive servers need to be allocated to the target tasks is judged, and under the condition that the exclusive servers do not need to be allocated to the target timed tasks, shared server resources are allocated to the target timed tasks, so that the server resources are reasonably allocated and utilized. Under the condition that exclusive servers do not need to be allocated to the target timing tasks, shared server resources are allocated to the target timing tasks according to a preset matching rule, server resources with low resource utilization rate can be fully utilized, and the problem of server resource waste is solved. And the preset matching rules are established to ensure that each preset index of the candidate server does not exceed the preset threshold under the condition that the candidate server executes the target task and distributes the task at the same time, so that the target task cannot be executed when the preset threshold is exceeded, and the normal execution of the task is ensured on the premise of fully utilizing the server resources.
According to an embodiment of the present disclosure, wherein the predetermined index includes at least one of: CPU utilization rate, memory utilization rate and disk utilization rate. The predetermined index may also include other indexes that can be used to characterize the operating performance of the server besides the above examples, and the embodiment of the present disclosure does not limit the type of the predetermined index.
According to an embodiment of the present disclosure, wherein determining whether to allocate an exclusive server for the target task comprises: determining whether the target task is to be executed in a separate server according to the attribute of the target task; and in the event that it is determined that the target task is to be executed in a separate server, allocating an exclusive server for the target task. The attributes of the target task may be, for example, the server memory resources that need to be consumed for executing the target task, the required CPU execution speed, the disk capacity that needs to be occupied, and the like. For example, since the computing memory resources consumed by some target tasks are large, the shared servers with other tasks affect the task execution efficiency, and it is necessary to allocate exclusive servers for the tasks.
According to the embodiment of the disclosure, whether the exclusive server needs to be allocated to the target task is determined, so that the attributes of the target task can be considered, and the purpose of reasonably allocating server resources is achieved.
According to an embodiment of the present disclosure, wherein determining whether to allocate an exclusive server for the target task comprises: determining whether the target task has not been executed; and under the condition that the target task is determined not to be executed, allocating an exclusive server for the target task. According to the embodiment of the present disclosure, determining whether the target task has not been executed may be performed on the basis of determining whether the target task is to be executed in a separate server according to the attributes of the target task as described above. For example, after analyzing the attribute information of the target task, it is determined that the target task does not need to be executed in a separate server, and it may be further determined whether the target task has not been executed, and if the target task has not been executed, an exclusive server may be allocated to the target task, and the target task is executed in the separate server, so as to accurately record the occupation situation of the server resource of the task, such as the CPU occupation ratio, the JVM (memory) occupation ratio, and the disk capacity occupation situation.
According to an embodiment of the present disclosure, wherein determining the target server from the plurality of candidate servers comprises:
determining a preselected server from a plurality of candidate servers, wherein under the condition that a target task and an allocation task are simultaneously executed in the preselected server, at least one preset index is smaller than a preset threshold value;
a target server is determined from a plurality of preselected servers.
According to an embodiment of the present disclosure, determining a target server from a plurality of the preselected servers may be: and selecting one of the pre-selected servers as the target server.
According to the embodiment of the disclosure, when a plurality of pre-selection servers exist, since each preset index is smaller than the preset threshold value when the target task and the assignment task are executed simultaneously in the pre-selection servers, the assignment of the target task to the pre-selection servers does not cause the target task to be unable to be executed, and therefore one of the pre-selection servers can be arbitrarily selected to be determined as the target server.
According to the embodiment of the present disclosure, in order to ensure that the server resources are more optimally and fully utilized, the following method may also be adopted as the server allocation method.
According to an embodiment of the present disclosure, wherein determining the target server from the plurality of preselected servers comprises:
determining an average index value of each pre-selected server, wherein the average index value is an average value of at least one preset index of the pre-selected servers; and determining the preselected server with the highest average index value as the target server.
According to the embodiment of the disclosure, when a plurality of pre-selection servers exist, each preset index is smaller than the preset threshold value when the pre-selection servers execute the target task and the allocation task at the same time, one of the pre-selection servers can be randomly selected from the pre-selection servers in principle to be determined as the target server, and the follow-up task with relatively more server resource consumption possibly exists is considered, so that the server with the most current server resource consumption in the servers meeting the allocation condition at present is preferentially allocated to the current target task, so that other servers with less current resource consumption are allocated to the follow-up task with relatively more resource consumption, the waste of the server resources with the most current resource consumption is avoided, and the server resources are more optimally and fully utilized.
FIG. 3 schematically illustrates a flow diagram for determining a preselected server from a plurality of candidate servers according to an embodiment of the disclosure; as shown in FIG. 3, the method includes operations S301-304.
In operation S301, a historical execution record of the target task in a predetermined period is acquired, wherein the historical execution record comprises a historical record value of a predetermined index consumed each time the target task is executed;
determining a predetermined index history peak value of the target task from the history execution records in operation S302;
in operation S303, respectively calculating a pre-determined index pre-estimated value of each candidate server, where the pre-determined index pre-estimated value is a sum of a current consumption value of a pre-determined index of the candidate server and a historical record peak value of the pre-determined index of the target task;
in operation S304, candidate servers, each of which has a predetermined index estimation value smaller than a preset threshold value, are determined as preselected servers.
For ease of understanding, the following examples describe specific methods of the above operations:
table 1 shows a list of candidate servers that are currently performing other assignment tasks. The table shows the numerical values of the predetermined indices (CPU utilization, memory utilization, disk utilization) of the respective candidate servers, and the average value of the three predetermined indices.
And determining the pre-selection server according to a rule that each preset index is smaller than a preset threshold value under the condition that the target task and the distribution task are simultaneously executed in the pre-selection server.
TABLE 1
Figure BDA0003180201950000121
Table 2 is an example of a historical execution record of a target task over a predetermined period of time (e.g., over the last week).
TABLE 2
Figure BDA0003180201950000131
And after the historical execution record is acquired, determining a preset index historical record peak value of the target task from the historical execution record. For example, according to the records in table 2, the predetermined index history peaks of the target task can be determined as: the CPU utilization rate is 40 percent (calculated according to the CPU occupation value 4 Ghz), the memory utilization rate is 25 percent (calculated according to the JVM occupation value 2 GB), and the disk utilization rate is 1 percent (calculated according to the disk occupation value 5G).
Then, the pre-estimated value of each predetermined index of each candidate server is calculated respectively, namely the sum of the current consumption value of the predetermined index of the candidate server and the historical peak value of the predetermined index of the target task is calculated. For example, it is calculated from the data records in tables 1 and 2:
the predicted values of the predetermined indexes of the candidate server No. 1 are respectively as follows: CPU usage (78% + 40%), memory usage (40% + 25%), disk usage (50% + 1%).
The predicted values of the predetermined indexes of the candidate server No. 2 are respectively as follows: CPU usage (40% + 40%), memory usage (40% + 25%), disk usage (40% + 1%).
The predicted values of the predetermined indexes of the candidate server No. 3 are respectively as follows: CPU usage (10% + 40%), memory usage (10% + 25%), disk usage (10% + 1%).
And finally, determining the candidate servers of which the predicted values of all the preset indexes are smaller than a preset threshold value as preselected servers.
For example, the preset threshold of the predetermined index may be set to 80%, and the estimated CPU utilization of server No. 1 is greater than 80%, and server No. 1 cannot be matched. And the predicted values of all the preset indexes of the server No. 2 and the server No. 3 are smaller than a preset threshold value. The two servers may be determined to be pre-selected servers.
Further, in the case that a plurality of pre-selection servers exist, since each predetermined index is smaller than the preset threshold, one of the two pre-selection servers can be arbitrarily selected in principle to be determined as the target server, and in consideration of the possibility that a task with relatively more server resource consumption exists subsequently, the server with the highest current server resource consumption (i.e., the server No. 2 with the larger average index value) is preferentially allocated to the current target task.
According to an embodiment of the present disclosure, further comprising:
determining whether to reclaim the target server in response to completion of execution of the target task in the target server;
adding the target server to a waiting server queue if it is determined that the target server is not to be recycled;
in response to receiving an indication to re-execute the target task, a target server is assigned for the target task.
According to the embodiment of the disclosure, after the target task is executed in the target server, whether the server is recycled can be determined according to the attribute of the target task. Under the condition that the target server is determined not to be recycled, the target server is added to the waiting server queue, so that the target server is directly allocated to the target task when the target task is executed again, the server does not need to be matched with the target task again, and the allocation efficiency is improved.
Fig. 4 schematically shows a block diagram of a server distribution apparatus 400 according to an embodiment of the present disclosure.
The server distribution apparatus 400 may be used to implement the method described with reference to fig. 2.
As shown in fig. 4, the load prediction apparatus 400 includes: comprises a first determining module 410 and a second determining module 420.
The first determining module 410 is configured to determine whether to allocate an exclusive server to the target task, where the exclusive server is a server that does not currently execute the allocation task, and the allocation task is an executing task; a second determining module 420, configured to determine, according to a preset matching rule, a target server from the multiple candidate servers so as to allocate the target server to the target task, if it is determined that an exclusive server does not need to be allocated to the target task; the candidate server is a server executing the allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the allocation task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.
According to the embodiment of the disclosure, the first determining module 410 first determines whether an exclusive server needs to be allocated to the target task, and allocates a shared server resource to the target timed task under the condition that the exclusive server does not need to be allocated to the target timed task, so that the server resource is reasonably allocated and utilized. Under the condition that exclusive servers do not need to be allocated to the target timing tasks, the first determining module 410 is used for allocating shared server resources to the target timing tasks according to the preset matching rules, so that the server resources with low resource utilization rate can be fully utilized, and the problem of server resource waste is solved. And the preset matching rules are established to ensure that each preset index of the candidate server does not exceed the preset threshold under the condition that the candidate server executes the target task and distributes the task at the same time, so that the target task cannot be executed when the preset threshold is exceeded, and the normal execution of the task is ensured on the premise of fully utilizing the server resources.
According to an embodiment of the present disclosure, wherein the predetermined index includes at least one of: CPU utilization rate, memory utilization rate and disk utilization rate.
According to an embodiment of the present disclosure, wherein the second determining module 420 includes: a first determination unit and a second determination unit.
The system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining a preselected server from a plurality of candidate servers, and under the condition that a target task and an allocation task are simultaneously executed in the preselected server, at least one preset index is smaller than a preset threshold value; a second determining unit for determining a target server from the plurality of preselected servers.
According to an embodiment of the present disclosure, the first determining unit includes an obtaining subunit, a first determining subunit, a calculating subunit, and a second determining subunit.
The acquisition subunit is used for acquiring a historical execution record of the target task in a preset time period, wherein the historical execution record comprises a historical record value of a preset index consumed by the target task each time the target task is executed; a first determining subunit, configured to determine a predetermined index history peak value of the target task from the history execution records; the calculation subunit is used for calculating each preset index pre-estimated value of each candidate server respectively, wherein the preset index pre-estimated value is the sum of the current consumption value of the preset index of the candidate server and the historical record peak value of the preset index of the target task; and the second determining subunit is used for determining the candidate servers of which all the preset index predicted values are smaller than the preset threshold value as the preselected servers.
According to the embodiment of the disclosure, the second determination unit comprises a third determination subunit and a fourth determination subunit.
The third determining subunit is used for determining an average index value of each pre-selected server, wherein the average index value is an average value of respective historical highest recorded values of at least one predetermined index of the pre-selected servers in a preset time period; and the fourth determining subunit is used for determining the preselected server with the highest average index value as the target server.
According to the embodiment of the disclosure, the first determining module 410 includes a third determining unit and a fourth determining unit.
The third determining unit is used for determining whether the target task is to be executed in the independent server or not according to the attribute of the target task; a fourth determination unit configured to, in a case where it is determined that the target task is to be executed in the separate server, allocate an exclusive server to the target task.
According to the embodiment of the disclosure, the first determination module comprises a fifth determination unit and a sixth determination unit.
The fifth determining unit is used for determining whether the target task is not executed; and the sixth determining unit is used for allocating the exclusive server to the target task under the condition that the target task is determined not to be executed.
According to the embodiment of the disclosure, the device further comprises a third determining module, an adding module and an allocating module.
The third determining module is used for responding to the completion of the target task executed in the target server and determining whether to recycle the target server; the adding module is used for adding the target server to the waiting server queue under the condition that the target server is determined not to be recycled; and the allocation module is used for responding to the received instruction of executing the target task again and allocating the target server for the target task.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any number of the first determining module 410 and the second determining module 420 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the first determining module 410 and the second determining module 420 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware. Alternatively, at least one of the first determining module 410, the second determining module 420 may be at least partially implemented as a computer program module, which when executed may perform the respective functions.
Fig. 5 schematically shows a block diagram of an electronic device for implementing a server allocation method according to an embodiment of the present disclosure.
The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, an electronic device 500 according to an embodiment of the present disclosure includes a processor 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. The processor 501 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 501 may also include onboard memory for caching purposes. Processor 501 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 503, various programs and data necessary for the operation of the electronic apparatus 500 are stored. The processor 501, the ROM502, and the RAM 503 are connected to each other by a bus 504. The processor 501 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM502 and/or the RAM 503. Note that the programs may also be stored in one or more memories other than the ROM502 and the RAM 503. The processor 501 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, electronic device 500 may also include an input/output (I/O) interface 505, input/output (I/O) interface 505 also being connected to bus 504. The system 500 may also include one or more of the following components connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure 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 storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program, when executed by the processor 501, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: 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), 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 disclosure, 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.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include ROM502 and/or RAM 503 and/or one or more memories other than ROM502 and RAM 503 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the server allocation method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 501, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 509, and/or installed from the removable medium 511. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
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 disclosure. 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. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (12)

1. A server allocation method, comprising:
determining whether an exclusive server is to be allocated to a target task, wherein the exclusive server is a server which does not execute an allocation task currently, and the allocation task is an executing task; and
under the condition that the exclusive server does not need to be allocated to the target task, according to a preset matching rule, a target server is determined from a plurality of candidate servers so as to allocate the target server to the target task;
wherein the candidate server is a server executing the allocation task, and the preset matching rule is: and under the condition that the candidate server executes the target task and the distribution task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.
2. The method of claim 1, wherein the predetermined metric comprises at least one of: CPU utilization rate, memory utilization rate and disk utilization rate.
3. The method of claim 1, wherein the determining a target server from a plurality of candidate servers comprises:
determining a preselected server from the plurality of candidate servers, wherein at least one of the predetermined metrics is less than the preset threshold value when the target task and the assignment task are simultaneously executed in the preselected server;
a target server is determined from a plurality of the preselected servers.
4. The method of claim 3, wherein said determining a preselected server from a plurality of said candidate servers comprises:
acquiring a historical execution record of the target task in a preset time period, wherein the historical execution record comprises a historical record value of a preset index consumed by the target task each time the target task is executed;
determining a predetermined index historical record peak value of the target task from the historical execution records;
respectively calculating each preset index pre-estimated value of each candidate server, wherein the preset index pre-estimated value is the sum of the current consumption value of a preset index of the candidate server and the historical record peak value of the preset index of the target task;
and determining the candidate server of which each preset index estimated value is smaller than the preset threshold value as the preselected server.
5. The method of claim 3, wherein said determining a target server from a plurality of said preselected servers comprises:
determining an average indicator value for each of the pre-selected servers, wherein the average indicator value is an average of at least one of the predetermined indicators for the pre-selected servers;
and determining the preselected server with the highest average index value as the target server.
6. The method of claim 1, wherein the determining whether to allocate an exclusive server for the target task comprises:
determining whether the target task is to be executed in a separate server according to the attribute of the target task; and
in a case where it is determined that the target task is to be executed in a separate server, the exclusive server is allocated for the target task.
7. The method of claim 1, wherein the determining whether to allocate an exclusive server for the target task comprises:
determining whether the target task has not been executed;
and under the condition that the target task is determined not to be executed, allocating the exclusive server to the target task.
8. The method of claim 1, further comprising:
determining whether to reclaim the target server in response to completion of executing the target task in the target server;
in the event that it is determined that the target server is not reclaimed, adding the target server to a waiting server queue;
in response to receiving an indication to re-execute the target task, allocating the target server for the target task.
9. A server distribution apparatus comprising:
the system comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining whether an exclusive server is required to be allocated to a target task, the exclusive server is a server which does not execute an allocation task at present, and the allocation task is an executing task; and
a second determining module, configured to determine, according to a preset matching rule, a target server from multiple candidate servers so as to allocate the target server to the target task, if it is determined that the exclusive server does not need to be allocated to the target task;
wherein the candidate server is a server executing an allocation task, and the preset matching rule is as follows: and under the condition that the candidate server executes the target task and the distribution task at the same time, at least one preset index of the candidate server is smaller than a preset threshold value.
10. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-8.
11. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 8.
12. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 8 when executed.
CN202110847576.1A 2021-07-26 2021-07-26 Server distribution method and device, electronic equipment and computer readable storage medium Pending CN113485838A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110847576.1A CN113485838A (en) 2021-07-26 2021-07-26 Server distribution method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110847576.1A CN113485838A (en) 2021-07-26 2021-07-26 Server distribution method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113485838A true CN113485838A (en) 2021-10-08

Family

ID=77942777

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110847576.1A Pending CN113485838A (en) 2021-07-26 2021-07-26 Server distribution method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113485838A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114610575A (en) * 2022-03-14 2022-06-10 北京百度网讯科技有限公司 Method, apparatus, device, and medium for calculating updated peak values for branches
WO2024125251A1 (en) * 2022-12-16 2024-06-20 华为技术有限公司 Resource allocation method and apparatus

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114610575A (en) * 2022-03-14 2022-06-10 北京百度网讯科技有限公司 Method, apparatus, device, and medium for calculating updated peak values for branches
CN114610575B (en) * 2022-03-14 2024-05-14 北京百度网讯科技有限公司 Method, apparatus, device and medium for calculating updated peak value of branch
WO2024125251A1 (en) * 2022-12-16 2024-06-20 华为技术有限公司 Resource allocation method and apparatus

Similar Documents

Publication Publication Date Title
US8595740B2 (en) Priority-based management of system load level
RU2697700C2 (en) Equitable division of system resources in execution of working process
US20120084777A1 (en) Virtual Machine and/or Multi-Level Scheduling Support on Systems with Asymmetric Processor Cores
CN110196770B (en) Cloud system memory data processing method, device, equipment and storage medium
CN113485838A (en) Server distribution method and device, electronic equipment and computer readable storage medium
US10452443B2 (en) Dynamic tuning of multiprocessor/multicore computing systems
CN111638953B (en) Method, device and storage medium for realizing GPU virtualization
US20200249969A1 (en) Electronic device having multi-operating system and method for managing dynamic memory for same
US9547576B2 (en) Multi-core processor system and control method
US20140259022A1 (en) Apparatus and method for managing heterogeneous multi-core processor system
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
US20170255246A1 (en) Reducing Power by Vacating Subsets of CPUs and Memory
US20160034012A1 (en) Dynamic Power Budgeting in a Chassis
CN111813541B (en) Task scheduling method, device, medium and equipment
CN112463361A (en) Method and equipment for distributing elastic resources of distributed computation
CN116881003A (en) Resource allocation method, device, service equipment and storage medium
CN107391262B (en) Job scheduling method and device
CN115599304A (en) Data processing method, device and equipment applied to storage node and storage medium
CN115617515A (en) Memory allocation method and device for intelligent Internet of things operating system and storage medium
CN111352710B (en) Process management method and device, computing equipment and storage medium
JP2010009288A (en) Multiprocessor system and program execution method
CN114610575B (en) Method, apparatus, device and medium for calculating updated peak value of branch
US20240004693A1 (en) Batch workload control based on capacity consumption
CN115065685B (en) Cloud computing resource scheduling method, device, equipment and medium
CN115391042B (en) Resource allocation method and device, electronic equipment 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