Resource scheduling method, device, equipment, medium and product
By allocating the resources of offline tasks according to the resource limit information of offline tasks and the resource quantity of the target node, and adjusting the resources of the offline task when receiving the resource expansion request of the online task, the resource scheduling problem in the primary mixed scene scene is solved. Improve resource utilization and scheduling efficiency.
Patent Information
- Application Number
- CN202411604186.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-01-28
AI Technical Summary
In the cloud-native hybrid scenario, the resource utilization rate of online applications on nodes is different, which makes it difficult to unify the resource scheduling of offline applications and makes it difficult to fully utilize resources.
By allocate the operating resources of offline tasks based on the resource limit information of offline tasks and the current resource leisure of the target node, and when the resource expansion request received the resource expansion of the online task, determine the resource scheduling and adjust the operation resources of the offline task to achieve resources to achieve resources Dynamic adjustment.
It improves the flexibility and resource utilization of resource scheduling, ensure the normal operation of online tasks and offline tasks, while avoiding waste of resources.
Smart Images

Figure CN119376949A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to the field of cloud computing technology, and specifically to resource scheduling methods, devices, equipment, media and products. Background Art
[0002] In cloud-native co-location scenarios, since online service resource utilization has more obvious peaks and troughs, many co-location systems use offline jobs to fill in idle resources in various periods of online services, thereby improving overall resource utilization and reducing enterprise costs.
[0003] Under the existing technology, the resources corresponding to multiple instances of offline applications need to be scheduled uniformly. However, due to the different resource utilization rates of online applications on different nodes, the idle amount of resources on different nodes is different, which makes it difficult to fully utilize the node resources when the running resource amount is uniformly specified. Summary of the invention
[0004] The present disclosure provides a resource scheduling method, apparatus, device, medium and product, which can improve the flexibility of resource scheduling and resource utilization.
[0005] According to a first aspect of the present disclosure, a resource scheduling method is provided, comprising the following steps:
[0006] According to the resource restriction information of the offline task and the current idle amount of resources of the target node, configure the running resources of the offline task and update the current idle amount of resources of the target node;
[0007] In response to receiving a resource expansion request of an online task and the current idle amount of resources of the target node being less than the resource expansion amount corresponding to the resource expansion request, determining a resource scheduling amount and sending it to the offline task;
[0008] According to the resource scheduling amount, adjust the running resources of the offline task and update the current resource idle amount of the target node.
[0009] According to a second aspect of the present disclosure, a resource scheduling device is provided, comprising an offline resource configuration module, a resource scheduling amount determination module and an offline resource adjustment module, wherein:
[0010] The offline resource configuration module is configured to configure the running resources of the offline task according to the resource restriction information of the offline task and the current resource idle amount of the target node, and update the current resource idle amount of the target node;
[0011] The resource scheduling amount determination module is configured to, in response to receiving a resource expansion request of an online task and the current idle amount of resources of the target node being less than the resource expansion amount corresponding to the resource expansion request, determine the resource scheduling amount and send it to the offline task;
[0012] The offline resource adjustment module is configured to adjust the running resources of the offline task according to the resource scheduling amount, and update the current resource idle amount of the target node.
[0013] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0014] at least one processor; and
[0015] a memory communicatively connected to at least one processor; wherein,
[0016] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to execute the method provided by the first aspect.
[0017] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method provided in the first aspect.
[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method provided according to the first aspect when executed by a processor.
[0019] According to the resource scheduling method provided by the present disclosure, the running resources of the offline task are first configured according to the resource restriction information of the offline task and the current resource idle amount of the target node; during the running process of the offline task, when a resource expansion request of the online task is received and it is determined that the resource expansion amount of the resource expansion request is greater than the current resource idle amount of the target node, the resource scheduling amount is determined and sent to the offline task, and then the running resources of the offline task are adjusted accordingly, the offline task is resource compressed, and the current resource idle amount of the target node is updated. This scheme configures the running resources of the offline task based on the resource restriction information of the offline task and the current resource idle amount of the target node, which can make full use of the idle resources of the target node and improve resource utilization; and when a resource expansion request of the online task is received, the offline task is resource compressed in combination with the resource expansion amount and the current resource idle amount of the target node, so as to realize dynamic adjustment of the running resources of the offline task, and effectively ensure the normal operation of the online task and the offline task while ensuring the resource utilization of the target node.
[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0022] Figure 1 is an exemplary system architecture diagram to which the resource scheduling method of the present disclosure can be applied;
[0023] Figure 2 is a schematic diagram of a first embodiment of a resource scheduling method according to the present disclosure;
[0024] Figure 3 is a schematic diagram of resource usage on a node in a resource scheduling method according to the present disclosure;
[0025] Figure 4 It is a schematic diagram of a monitoring structure of the current idle amount of resources of a node in the resource scheduling method disclosed in the present invention;
[0026] Figure 5 is a schematic diagram of a second embodiment of a resource scheduling method according to the present disclosure;
[0027] Figure 6a It is a schematic diagram of an implementation scenario of the resource scheduling method disclosed in the present invention;
[0028] Figure 6b It is a schematic diagram of an execution process of the resource scheduling method disclosed in the present invention;
[0029] Figure 7 is a schematic diagram of an embodiment of a resource scheduling device according to the present disclosure;
[0030] Figure 8 It is a block diagram of an electronic device used to implement the resource scheduling method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0032] The Internet environment of an enterprise usually runs two types of applications: online applications and offline applications. Among them, online applications include message streams, shopping malls, payments, etc., which have extremely high service SLA (Service-Level Agreement) requirements, and service traffic and resource utilization have tidal characteristics; offline applications (for example, big data Spark jobs) have high resource utilization during operation, are not sensitive to latency, have high fault tolerance, and generally allow re-operation after interruption. Among them, an online application can correspond to multiple online tasks deployed on multiple nodes, occupying the resources on the node to run online tasks, and realizing the stable operation of the online application. Correspondingly, an offline application can also deploy multiple offline tasks to multiple nodes, using the remaining resources on the node to run, thereby improving resource utilization.
[0033] Existing cloud-native hybrid systems generally calculate the idle resources, that is, the offline available resources, based on the online application resource utilization of each node. These can be used to deploy instance tasks of offline applications to improve resource utilization.
[0034] Under the existing technology, due to the different resource utilization of online applications on each node, the available resources of offline applications are different, so multiple instance tasks of offline applications cannot be uniformly deployed on multiple nodes. For example, the idle resources of two nodes are 10 cores and 15 cores respectively, and it is expected to deploy two offline tasks to these two nodes. If the running resources of the offline task are specified as 10 cores, the resources of 5 cores on the other node will not be fully utilized, resulting in resource waste; if the running resources of the offline task are specified as 15 cores, the other offline task cannot be deployed on the node.
[0035] The present disclosure provides a resource scheduling method, which can not only deploy the running resources of offline tasks according to the current idle amount of resources on the node, but also compress the running resources of offline tasks according to the resource expansion request of online tasks to schedule them for use by online tasks, thereby realizing vertical expansion and contraction of node resources and effectively improving the scheduling efficiency and resource utilization of resources on the node.
[0036] It should be pointed out that in the technical solution of the present disclosure, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0037] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the resource scheduling method or apparatus of the present disclosure can be applied.
[0038] like Figure 1As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The network 102 is used to provide a communication link between the terminal device 101 and the server 103, and may include various connection types, such as a wired communication link, a wireless communication link or an optical fiber cable.
[0039] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send information, etc. Various client applications can be installed on the terminal device 101, such as social applications, human-computer interaction applications, leisure or entertainment applications, etc.
[0040] The terminal device 101 can be hardware or software. When the terminal device 101 is hardware, it can be various electronic devices, including but not limited to independent electronic devices such as smart phones, tablet computers, laptop computers and desktop computers. When the terminal device 101 is software, it can be installed in the above electronic devices. It can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.
[0041] The server 103 may be hardware or software. When the server 103 is hardware, it may be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server 103 is software, it may be implemented as multiple software or software modules (for example, for providing distributed services), or as a single software or software module. No specific limitation is made here.
[0042] The resource scheduling method provided in the embodiment of the present disclosure is generally executed by the server 103 , and accordingly, the resource scheduling device is generally disposed in the server 103 .
[0043] It should be noted that Figure 1 The number of terminal devices 101, networks 102 and servers 103 in the embodiment is only for illustration. Any number of terminal devices 101, networks 102 and servers 103 may be provided according to implementation requirements.
[0044] Figure 2 A process 200 of an embodiment of a resource scheduling method according to the present disclosure is shown, referring to Figure 2 As shown, the resource scheduling method includes the following steps:
[0045] Step S201, according to the resource restriction information of the offline task and the current idle amount of resources of the target node, the running resources of the offline task are configured, and the current idle amount of resources of the target node is updated.
[0046] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1The server 103 shown configures the running resources of the offline task on the target node based on the resource restriction information of the offline task to be constructed and the current resource idleness of the target node where the offline task can be deployed, and updates the current resource idleness of the target node after the offline task is configured.
[0047] The resource restriction information of the offline task includes the lower limit of the startup resources and the upper limit of the running resources of the offline task.
[0048] Exemplarily, the execution subject can configure the resource restriction information of the offline task in the following manner, taking the starting resource lower limit as 5 cores and the running resource upper limit as 128 cores as an example:
[0049] max:128#The upper limit of a single pod specification
[0050] min:5#Lower limit of a single pod specification
[0051] The above-mentioned execution entity determines that the current idle amount of resources on the target node at least meets the minimum resource requirement in the resource restriction information of the offline task, builds the offline task on the target node, and configures corresponding running resources for the offline task; and after configuring the running resources for the offline task, updates the current idle information of resources on the target node.
[0052] Exemplarily, the execution subject may configure running resources for the offline task according to the current idle amount of resources on the target node; or may configure running resources according to the running requirements of the offline task, for example, according to the upper limit of running resources in the resource restriction information.
[0053] When the above execution subject deploys offline tasks to an online node, it needs to know how many idle resources are available in the node, that is, the current idle amount of resources of the node.
[0054] In some implementations of the embodiments of the present disclosure, the current idle amount of resources of the target node is determined by the following steps: the current idle amount of resources of the target node is determined according to the task information and resource configuration information currently running on the target node.
[0055] In this solution, the execution subject calculates the current resource idle amount of the target node based on the task information and resource configuration information currently running on the target node.
[0056] The task information of the target node represents the type of tasks (such as online tasks, offline tasks, etc.) and the number of tasks deployed on the target node. The resource configuration information may include at least one of the following: the total amount of resources on the target node, the resource type and the amount of resources under different types, the amount of running resources configured for each deployed task, the allowed usage of resources or the allowed configuration conditions or the allowed configuration ratio, etc.
[0057] Figure 3 A schematic diagram showing resource usage on a node in an embodiment is shown, referring to Figure 3 As shown in the figure, online applications are divided into levels and annotated in the form of Pod labels. For example, online applications can be divided into resource-exclusive applications, resource-reserved applications, and resource-sharing applications. Among them, the resources requested by resource-exclusive applications are exclusive, that is, even if the resources configured for the application are not used, they are not allowed to be allocated to other applications. The resources requested by resource-reserved applications are isolated from other online applications, and different resources are allocated to different instances. For resource-sharing applications, multiple tasks share the remaining resources after the above two applications are allocated.
[0058] Exemplarily, the idle resource calculation method of the node can be configured in the following manner: "colocation-cpu:#supports separate control of multiple resources".
[0059] If the resources requested by resource-reserved applications and resource-sharing applications are not fully used, the remaining part is considered to be idle resources and can be re-allocated to the offline tasks corresponding to the offline applications. The total amount of idle resources remaining on the node in the current state is the current idle amount of resources, which can be calculated as follows: Current idle amount of resources = total amount of node resources - coefficient 1 × exclusive application resources - coefficient 2 × reserved application used resources - coefficient 3 × shared application used resources. Different resources have different weight coefficients, which are estimated based on the stability of the overall scheduling system.
[0060] In order to avoid unknown exceptions caused by excessive resource utilization on the node, a safety level (proportional value, such as 90% or 80%) can be set on each node. For example, the safety level can be set by node labels. Only resources below the safety level can be used as idle resources. In this case, the current idle amount of resources = (total node resources - coefficient 1 × exclusive application resources) × safety level - coefficient 2 × reserved application used resources - coefficient 3 × shared application used resources.
[0061] Figure 4A schematic diagram of the monitoring structure of the current idle amount of resources of a node in an embodiment is shown. The execution subject can manage tasks of different priorities (online tasks have a higher priority than offline tasks) on the node by deploying a colocation agent on node 401. For example, when an online task needs to expand resources, the colocation agent can compress or even eliminate offline tasks to meet the resource requirements of online tasks; it is also used to isolate the resources of offline tasks from those of online tasks to prevent the same resources from being used by different tasks, thereby ensuring the operational stability of each task; the colocation agent can also calculate the current idle amount of resources on the node in real time based on the resource usage of each task.
[0062] Reference Figure 4 As shown, the colocation agent listens to the node information from the kube-apiserver, reads the total resources of node 401 from the node information, and obtains the value of the safety water level (e.g., 85%) from the node label. The colocation agent can also listen to each Pod on the node from the kube-apiserver to obtain the Pod application level information; then the colocation agent periodically reads the resource usage data from the process control group of the underlying operating system according to different Pods and their application level information, such as reading the CPU, memory and other usage from the Linux Cgroup subsystem. The specific matters may include: the colocation agent first obtains the usage of all CPUs from the process control group of the operating system; then reads the CPU serial number (exclusive used resources) bound to the exclusive Pod from the corresponding position of the underlying system; summarizes the usage of all CPUs (total resource usage), deducts the CPU usage of the exclusive Pod, and obtains the used resources of other online tasks.
[0063] Based on the above information, the calculation formula of the current idle amount of resources is used to obtain the current idle amount of resources on the node, and then the kube-apiserver is called to update the node interface to report the current idle amount of resources to the node status of the node in the form of scalable resources, for example, "jdos.jd.com / colocation-cpu:"15"#node idle resources, that is, offline available resources".
[0064] In this scheme, the execution entity calculates the current resource idleness of the target node in real time based on the task information currently running on the target node and the resource configuration information on the target node, effectively ensuring the accuracy and real-time nature of its current resource idleness, avoiding task deployment failure or resource scheduling failure caused by untimely update of the current resource idleness, and improving resource scheduling efficiency and resource utilization.
[0065] In some implementations of the embodiments of the present disclosure, the above-mentioned execution entity may also specify the idle resource ratio. For example, the current idle amount of resources of the target node is 10 cores. If the idle resource ratio is preset to 50% (for example, "scheduleRatio:50# whole machine schedulable colocation-cpu ratio"), after all the idle resources of the target node are deployed to the offline task, it is necessary to deploy running resources to the offline task according to the idle resource ratio, and the running resources are 10×50%=5 cores.
[0066] Step S202 , in response to receiving a resource expansion request of an online task and the current idle amount of resources of the target node being less than the resource expansion amount corresponding to the resource expansion request, determining a resource scheduling amount and sending it to the offline task.
[0067] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1 The server 103 shown, after receiving the resource expansion request of the online task on the target node, determines the resource expansion amount corresponding to the resource expansion request, and when it is determined that the current resource idle amount of the target node does not meet the resource expansion amount, determines the resource scheduling amount, and sends the determined resource scheduling amount to the offline task to compress an appropriate amount of resources from the running resources of the offline task to expand the online task.
[0068] The resource expansion request is a resource expansion requirement for an online task on a target node, that is, resources need to be dispatched from the target node to the online task to expand the running resource volume of the online task. The resource expansion volume corresponding to the resource expansion request represents the running resource volume required to be expanded for the online task.
[0069] The resource scheduling amount may represent the difference between the current idle amount of the target node and the resource expansion amount corresponding to the resource expansion request, or may represent the resource expansion amount.
[0070] In some implementations, the execution entity can determine the resource scheduling amount based on the difference between the current resource idle amount and the resource expansion amount of the target node, and send it to the offline task to compress the resources of the resource scheduling amount from the running resources of the offline task, and combine them with the current resource idle amount to configure them to the online task as the resource expansion amount, so as to ensure that the resource expansion request of the online task is met and the smooth operation of the online task is guaranteed, and the resource utilization on the target node can also be guaranteed.
[0071] In some implementations, the executing entity may also directly send the resource expansion amount as the resource scheduling amount to the offline task when it determines that the current idle amount of resources does not meet the resource expansion amount, compress sufficient resources from the running resources of the offline task as expansion resources, and allocate them to the online task, so as to quickly expand resources to the online task and ensure the smooth and safe operation of the online task.
[0072] Exemplarily, after expanding resources for an online task, the executor updates the current idle amount of resources on the target node. If the current idle amount of resources is not 0 and no new resource expansion request is received, the executor can configure offline tasks whose resources have not reached the upper limit to run on the target node based on the current idle amount of resources of the target node, so as to further improve the resource utilization of the target node.
[0073] In this scheme, after the execution entity determines the resource scheduling amount based on the current resource idle amount of the target node and the resource expansion amount corresponding to the resource expansion request, the resource scheduling amount is sent to the offline task, and the offline task autonomously adjusts its various processes according to the resource scheduling amount. For example, the less important processes are closed according to the importance of each process to provide sufficient resource compression space and ensure that the offline task can still run normally, avoiding the offline task from being stagnant or restarted or running abnormally due to directly compressing the running resources of the offline task.
[0074] In some implementations of the embodiments of the present disclosure, the resource scheduling range on the node can be preset. Exemplarily, when the required amount of operating resources differs from the current amount of operating resources by more than a set resource threshold, for example, the resource scheduling amount is greater than the set resource threshold, or the resource expansion amount of the online task is greater than the set resource threshold, resource scheduling is performed to avoid too frequent resource scheduling on the node and affect node management and task operation stability on the node. For example, the set resource threshold for limiting resource scheduling can be preset to 5 cores ("threshold: 5# changes within 5 cores, and specification updates are not performed").
[0075] Step S203: adjust the running resources of the offline task according to the resource scheduling amount, and update the current resource idle amount of the target node.
[0076] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1 The server 103 shown, after notifying the offline task of the resource scheduling amount, adjusts the running resources of the offline task according to the resource scheduling amount, and removes the resources that meet the resource scheduling amount by reducing the running resources of the offline task to ensure that the resource idle amount of the target node can meet the needs of the resource expansion request.
[0077] In some implementations of the present solution, after determining the resource scheduling amount, the execution subject may directly compress the running resources of the offline task and update the current idle amount of the target node.
[0078] In some optional implementations, after determining the resource scheduling amount and sending it to the offline task, the above-mentioned execution entity can wait for a preset period of time or adjust the running resources of the offline task after receiving a confirmation notification from the offline task, thereby freeing up enough resources for the online task to expand and update the current resource idle amount of the target node.
[0079] In some implementations of the embodiments of the present disclosure, in response to the duration of receiving the resource expansion request or the duration of sending the resource scheduling amount reaching a preset delay threshold, the running resources of the offline task are compressed according to the resource scheduling amount.
[0080] In this solution, after determining the resource scheduling amount and sending it to the offline task, the above-mentioned execution entity does not directly adjust the running resources of the offline task, but waits until the time for receiving the request reaches the preset delay threshold, or waits until the time for sending the resource scheduling amount to the offline task reaches the preset delay threshold, and then compresses the running resources of the offline task.
[0081] For example, taking the preset delay threshold as 5s as an example, the preset delay threshold can be set in the following manner:
[0082] delay:5s#Notify before adjusting the specification, and then adjust the specification after 5s
[0083] This solution gives offline tasks enough time to automatically shut down less important processes by waiting for the preset delay threshold, avoiding the shutdown of main processes due to direct compression of running resources, causing abnormal operation or even restart of offline tasks. While ensuring that sufficient expansion resources are provided for online tasks, the normal operation of offline tasks is effectively guaranteed, and the running resources of offline tasks are elegantly compressed, reducing the impact on offline tasks.
[0084] In this scheme, the way in which the execution entity compresses the running resources of offline tasks may include at least one of the following: expelling low-priority or less important offline tasks according to the priority or importance level of the offline tasks; closing low-priority or less important processes according to the priority or importance level of each process in the offline task, etc.
[0085] According to the resource scheduling method provided by the embodiment of the present disclosure, the running resources of the offline task are first configured according to the resource restriction information of the offline task and the current resource idle amount of the target node; during the running process of the offline task, when a resource expansion request of the online task is received and it is determined that the resource expansion amount of the resource expansion request is greater than the current resource idle amount of the target node, the resource scheduling amount is determined and sent to the offline task, and then the running resources of the offline task are adjusted accordingly, the offline task is resource compressed, and the current resource idle amount of the target node is updated. This scheme configures the running resources of the offline task based on the resource restriction information of the offline task and the current resource idle amount of the target node, which can make full use of the idle resources of the target node and improve resource utilization; and when a resource expansion request of the online task is received, the offline task is resource compressed in combination with the resource expansion amount and the current resource idle amount of the target node, so as to realize dynamic adjustment of the running resources of the offline task, and effectively ensure the normal operation of the online task and the offline task while ensuring the resource utilization of the target node.
[0086] Figure 5 The process 500 of the second embodiment of the resource scheduling method according to the present disclosure is shown. Figure 5 As shown, the resource scheduling method includes the following steps:
[0087] Step S501, determining a target node to which an offline task can be deployed from the candidate nodes according to the upper limit of the running tasks and the current task volume of the candidate nodes.
[0088] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1 The server 103 shown determines a target node to which the offline task can be deployed from each candidate node according to the upper limit of the running tasks allowed by each candidate node and the current amount of tasks deployed on each candidate node.
[0089] When receiving an offline task deployment request, the execution subject selects a target node that can be used to deploy the offline task from each candidate node in the container cluster. The screening rule at least includes that the current amount of tasks deployed on the candidate node does not reach the upper limit of the running tasks of the candidate node.
[0090] In some implementations, the number of tasks that can be deployed for the same application can be preset on a node. For example, in some servers, only one offline task can be deployed on a node at a time through the Kubernetes native application anti-affinity function. For another example, in some servers, application performance can be improved by binding NUMA (Non Uniform Memory Access), such as binding two NUMAs to a node, where one offline task can be deployed on each NUMA at a time.
[0091] For example, the task number limit plug-in can be configured by extending the scheduler, and the limit range can be a node or a NUMA on a node. For example, the upper limit of the running tasks of a node can be preset by limiting "the number of tasks of the same application on the same node" or "the number of tasks of the same application on the same NUMA of the same node".
[0092] In some implementations, the following two annotations can be used to set task limits on nodes when deploying offline applications:
[0093] jdos.jd.com / pod.count.limit:1#The number of applications in the same node (or numa) is limited
[0094] jdos.jd.com / pod.count.limit.scope:numa#Can be specified as node or numa, the default is node
[0095] Before deploying offline tasks, this solution first determines whether the current task volume on each candidate node has reached the upper limit, which can ensure that the offline tasks can be successfully deployed on the selected target nodes. From the perspective of the task volume on the target node, the deployment success rate of the offline tasks is guaranteed, avoiding the failure of offline task deployment due to the current task volume on the target node reaching the upper limit.
[0096] Step S502: deploy the offline task on the target node according to the lower limit of the startup resources of the offline task.
[0097] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1 The server 103 shown deploys the offline task on the target node with the minimum resources required for starting the offline task according to the lower limit of the starting resources of the offline task.
[0098] The execution entity deploys offline tasks based on the lower limit of the startup resources of offline tasks, which can effectively ensure that the offline tasks can be successfully deployed on the target node, taking into account the deployment success rate of offline tasks and the resource utilization rate of the target node.
[0099] Step S503: configuring the running resources of the offline task according to the current idle amount of the target node and the upper limit of the running resources of the offline task.
[0100] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1The server 103 shown, after deploying the offline task, configures running resources for the offline task according to the current idle amount of resources on the target node and the upper limit of the running resources of the offline task, thereby realizing resource expansion of the offline task, further improving the resource utilization rate on the target node, and ensuring the running stability and efficiency of the offline task.
[0101] For example, if two offline tasks need to be deployed, and it is determined that there are two target nodes available, whose current idle resources are 10 cores and 15 cores respectively, the native application anti-affinity feature of kubernetes can be used to control the deployment of one offline task on each of the two target nodes. If the lower limit of the startup resources of the offline task is configured to be 2 cores and the upper limit of the running resources is 50 cores, the offline tasks are deployed on the two target nodes with an initial resource of 2 cores respectively, and then the resources of the deployed offline tasks are expanded according to their respective current idle resources, which can be expanded to 10 cores and 15 cores respectively, so that the idle resources on the two nodes with different idle resources can be fully utilized.
[0102] This scheme first deploys offline tasks on the target node with the lower limit of the offline task's startup resources to ensure the success rate of offline task deployment. Then, taking into account the current idle resources of the target node and the upper limit of the offline task's running resources, the running resources are expanded for the offline task within the upper limit of the offline task's running resources, thereby realizing the dynamic expansion of offline task running resources and effectively improving the resource utilization of the target node.
[0103] In some implementations of the embodiments of the present disclosure, the operating resources of the offline task are configured according to the current idle amount of resources of the target node and the upper limit of the operating resources of the offline task, including: in response to the current idle amount of resources of the target node being greater than or equal to the upper limit of the operating resources of the offline task, the operating resources of the offline task are configured according to the upper limit of the operating resources of the offline task; in response to the current idle amount of resources of the target node being less than the upper limit of the operating resources of the offline task, the operating resources of the offline task are configured according to the current idle amount of resources of the target node.
[0104] When the above-mentioned execution entity determines that the current idle amount of resources of the target node is greater than or equal to the upper limit of the running resources of the offline task, it schedules resources to the offline task from the current idle amount of resources of the target node according to the resource amount corresponding to the upper limit of the running resources, that is, the running resources are configured for the offline task according to the upper limit of the running resources; when the current idle amount of resources of the target node does not meet the upper limit of the running resources of the offline task, all the current idle amount of resources is configured to the offline task.
[0105] This solution combines the current idle resources of the target node and the upper limit of the running resources of the offline task, taking both aspects into consideration, fully guaranteeing the running efficiency and stability of the offline task, and ensuring the resource utilization of the target node, thus reducing resource waste.
[0106] Step S504, in response to receiving the resource expansion request of the online task and the current idle amount of the target node being less than the resource expansion amount corresponding to the resource expansion request, determining the resource scheduling amount and sending it to the offline task.
[0107] Step S504 and Figure 2 Step S202 of the illustrated embodiment is basically the same, and the specific implementation method can refer to the above description of step S202, which will not be repeated here.
[0108] Step S505: adjust the running resources of the offline task according to the resource scheduling amount, and update the current resource idle amount of the target node.
[0109] Step S505 and Figure 2 Step S203 of the illustrated embodiment is basically the same, and the specific implementation method can refer to the above description of step S203, which will not be repeated here.
[0110] Step S506 , in response to the current idle amount of the target node being greater than or equal to the resource expansion amount corresponding to the resource expansion request, the running resources of the online task are expanded according to the resource expansion amount, and the current idle amount of the target node is updated.
[0111] In the embodiment of the present disclosure, the execution subject of the resource scheduling method, for example Figure 1 The server 103 shown, after adjusting the running resources of the offline task and updating the current resource idle amount of the target node, again compares the current resource idle amount of the target node with the resource expansion amount corresponding to the resource expansion request, and when the current resource idle amount meets the resource expansion amount, according to the resource expansion amount, schedules resources from the idle resources of the target node to expand the running resources of the online task, and then updates the current resource idle amount of the target node.
[0112] Exemplarily, if after adjusting the running resources of the offline task, the updated current resource idle amount of the target node is still less than the resource expansion amount corresponding to the resource expansion request, the execution entity can update the resource scheduling amount again according to the resource expansion amount and the current resource idle amount, and send it to the offline task. After a preset delay period, the running resources of the offline task on the target node are compressed again so that the current resource idle amount of the target node meets the needs of the resource expansion request.
[0113] In this scheme, when the executor determines that the current idle resources of the target node meet the resource expansion amount, it schedules the idle resources of the target node to expand the running resources of the online task, realizes the vertical expansion of the running resources of the online task and the dynamic scheduling of the target node resources, takes into account the resource expansion request of the online task and the running stability of the offline task, fully meets the running requirements of the online task, and improves the resource scheduling efficiency and resource utilization.
[0114] Figure 6a A schematic diagram showing an implementation scenario 500 of the resource scheduling method disclosed in the present invention is shown. Figure 6b A schematic diagram of an execution process of the resource scheduling method in this scenario is shown.
[0115] Reference Figure 6a As shown, in the scenario 500, a colocation agent is deployed on each node to monitor the node information and the Pod information on the node from the kube-apiserver, and extract information such as the safety water level value therefrom to determine the current idle amount of resources of the node.
[0116] The kube-apiserver is used to manage nodes in the container cluster and to provide API (Application Program Interface) services to the outside world. For example, operation and maintenance personnel can set node resource scheduling policies (including node resource safety levels, task restrictions on nodes, node resource scaling policies, scheduling restrictions, etc.) and other information through the kube-apiserver; users can create or enable online applications or offline applications through the kube-apiserver, and can also set deployment resource restriction information and vertical scaling policies for offline tasks through the kube-apiserver. For example, to query how many resources each node has, how many tasks are running on each node, etc., all node information, resource information, and instance information in the cluster can be obtained through the kube-apiserver and can also be reported to the kube-apiserver.
[0117] The kube-apiserver also calls the vertical scaling controller to vertically scale the running resources of each task on the node.
[0118] The kube-scheduler is responsible for scheduling the nodes in the cluster based on the information in the kube-apiserver. For example, it determines which nodes to deploy new tasks on based on the task running status on each node in the cluster.
[0119] Comprehensive reference Figure 6a and Figure 6b As shown, the specific execution process of the resource scheduling method disclosed in the present invention may include:
[0120] The colocation agent listens to node information from the kube-apiserver, obtains the safety level, calculates the current idle amount of the node based on it, and reports the calculated current idle amount of resources to the kube-apiserver;
[0121] After the user creates or selects a vertical scaling strategy through the kube-apiserver, the user can specify the vertical scaling strategy to be used on the node through the node label, and can also specify that offline tasks on the node allow adaptive resource scaling;
[0122] The vertical scaling controller listens to the vertical scaling policy from the kube-apiserver, marks the vertical scaling policy corresponding to each node and returns it to the kube-apiserver; it also listens to the Pod information on the node from the kube-apiserver in real time, analyzes the Pod tasks with resource scaling requests (for example, a certain online task has a resource expansion request), marks the Pod tasks as requiring resource scheduling and returns them to the kube-apiserver; it then listens to the Pod's running requirements and other information from the kube-apiserver, calculates the target resource volume of the Pod, and then marks and feeds back the target resource volume of the Pod to the kube-apiserver;
[0123] The colocation agent periodically or in real time monitors the target resource volume of each Pod task from the kube-apiserver, and calculates whether there are Pod tasks that need to schedule resources based on the resource deployment status on the node, and calculates the corresponding resource scheduling volume. The resource scheduling volume is then written into a notification file and sent to the offline container to notify the offline tasks that need to be scheduled. For example, if the colocation agent monitors that the target resource volume of an online Pod is greater than its current running resource volume, and the current idle resource volume on the node is less than the difference between the target resource volume and the current running resource volume, it determines that the offline task needs to be compressed, and calculates the resource compression volume of the offline task as the resource scheduling volume, and notifies the offline container where the offline task is located in the form of a notification file.
[0124] In this process, the vertical scaling controller calculates whether the delay duration reaches the preset delay threshold. If the preset delay threshold is not reached, the resources on the node are scaled up or down. After the preset delay threshold is reached, the Pod's running resources are adjusted through the kube-apiserver according to the resource scaling policy corresponding to the node, for example, the running resources of the offline Pod tasks are compressed, and then the running resources of the online tasks are expanded.
[0125] The colocation agent monitors the information of each Pod from the kube-apiserver, identifies the running resource adjustment information of the online task Pod and the offline task Pod, and modifies the resource deployment information on the node to the container management system OS / Containerd to make the resource deployment information on this node in the container management system consistent with the adjusted deployment information; and writes a notification file to the offline container to notify the offline task in the offline container of the adjusted running resource amount.
[0126] As an implementation of the resource scheduling method shown in the above figures, Figure 7 FIG. 700 shows an embodiment of a resource scheduling device according to the present disclosure. Figure 2 Corresponding to the method embodiment shown, the device can be applied to various electronic devices.
[0127] Reference Figure 7 As shown, the resource scheduling device 700 provided by the embodiment of the present disclosure includes: an offline resource configuration module 701, a resource scheduling amount determination module 702 and an offline resource adjustment module 703. The offline resource configuration module 701 is configured to configure the running resources of the offline task according to the resource restriction information of the offline task and the current resource idle amount of the target node, and update the current resource idle amount of the target node; the resource scheduling amount determination module 702 is configured to, in response to receiving a resource expansion request of an online task and the current resource idle amount of the target node being less than the resource expansion amount corresponding to the resource expansion request, determine the resource scheduling amount and send it to the offline task; the offline resource adjustment module 703 is configured to adjust the running resources of the offline task according to the resource scheduling amount, and update the current resource idle amount of the target node.
[0128] In the resource scheduling device 700 of the embodiment of the present disclosure, the specific processing of the offline resource configuration module 701, the resource scheduling amount determination module 702 and the offline resource adjustment module 703 and the technical effects thereof can be referred to in detail. Figure 2 The relevant descriptions of steps S201-S203 in the corresponding embodiment are not repeated here.
[0129] In some implementations of the embodiments of the present disclosure, the resource limitation information includes a startup resource lower limit and an operating resource upper limit, and the offline resource configuration module is further configured to: deploy the offline task on the target node according to the startup resource lower limit of the offline task; configure the operating resources of the offline task according to the current resource idle amount of the target node and the operating resource upper limit of the offline task.
[0130] In the resource scheduling device of the embodiment of the present disclosure, the specific processing of the offline resource configuration module and the technical effects brought about by it can be referred to Figure 5The relevant descriptions of steps S502-S503 in the corresponding embodiment are not repeated here.
[0131] In some implementations of the embodiments of the present disclosure, the operating resources of the offline task are configured according to the current idle amount of resources of the target node and the upper limit of the operating resources of the offline task, including: in response to the current idle amount of resources of the target node being greater than or equal to the upper limit of the operating resources of the offline task, the operating resources of the offline task are configured according to the upper limit of the operating resources of the offline task; in response to the current idle amount of resources of the target node being less than the upper limit of the operating resources of the offline task, the operating resources of the offline task are configured according to the current idle amount of resources of the target node.
[0132] In some implementations of the embodiments of the present disclosure, the resource scheduling device also includes a node selection module, which is configured to determine a target node to which the offline task can be deployed from the candidate nodes based on the upper limit of the running tasks and the current task volume of the candidate nodes.
[0133] In the resource scheduling device of the embodiment of the present disclosure, the specific processing of the node selection module and the technical effects brought about by it can be referred to Figure 5 The relevant description of step S501 in the corresponding embodiment will not be repeated here.
[0134] In some implementations of the embodiments of the present disclosure, the current idle amount of resources of the target node is determined by the following steps: the current idle amount of resources of the target node is determined according to the task information and resource configuration information currently running on the target node.
[0135] In some implementations of the embodiments of the present disclosure, the offline resource adjustment module is configured to: in response to the duration of receiving the resource expansion request reaching a preset delay threshold, compress the running resources of the offline task according to the resource scheduling amount.
[0136] In some implementations of the embodiments of the present disclosure, the resource scheduling device also includes an online resource expansion module, which is configured to: in response to the current resource idle amount of the target node being greater than or equal to the resource expansion amount corresponding to the resource expansion request, expand the running resources of the online application according to the resource expansion amount, and update the current resource idle amount of the target node.
[0137] In the resource scheduling device of the embodiment of the present disclosure, the specific processing of the online resource expansion module and the technical effects brought by it can be referred to Figure 5 The relevant description of step S506 in the corresponding embodiment will not be repeated here.
[0138] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0139] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0140] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0141] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0142] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the resource scheduling method. For example, in some embodiments, the resource scheduling method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the resource scheduling method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the resource scheduling method in any other appropriate manner (e.g., by means of firmware).
[0143] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0144] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0145] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0146] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0147] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0148] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0150] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A resource scheduling method, comprising: According to the resource restriction information of the offline task and the current idle amount of resources of the target node, the running resources of the offline task are configured, and the current idle amount of resources of the target node is updated; In response to receiving a resource expansion request of an online task and the current idle amount of the target node being less than the resource expansion amount corresponding to the resource expansion request, determining a resource scheduling amount and sending it to the offline task; The running resources of the offline task are adjusted according to the resource scheduling amount, and the current resource idle amount of the target node is updated.
2. The method according to claim 1, wherein: The resource restriction information includes the startup resource lower limit and the operation resource upper limit, and The configuring the running resources of the offline task according to the resource restriction information of the offline task and the current idle amount of resources of the target node includes: Deploy the offline task on the target node according to the lower limit of the startup resources of the offline task; The running resources of the offline task are configured according to the current idle amount of the target node and the upper limit of the running resources of the offline task.
3. The method according to claim 2, wherein: The configuring the running resources of the offline task according to the current idle amount of the target node and the upper limit of the running resources of the offline task includes: In response to the current idle amount of the target node being greater than or equal to the upper limit of the running resources of the offline task, configuring the running resources of the offline task according to the upper limit of the running resources of the offline task; In response to the current idle amount of the target node being less than the upper limit of the running resources of the offline task, the running resources of the offline task are configured according to the current idle amount of the target node.
4. The method according to claim 1, further comprising: According to the upper limit of running tasks and the current task volume of the candidate nodes, a target node on which the offline task can be deployed is determined from the candidate nodes.
5. The method according to claim 1, wherein: The current idle amount of resources of the target node is determined by the following steps: The current idle amount of resources of the target node is determined according to the task information and resource configuration information currently running on the target node.
6. The method according to claim 1, wherein: The adjusting the running resources of the offline task according to the resource scheduling amount includes: In response to the duration of receiving the resource expansion request or the duration of sending the resource scheduling amount reaching a preset delay threshold, the running resources of the offline task are compressed according to the resource scheduling amount.
7. The method according to any one of claims 1 to 6, further comprising: In response to the current idle amount of the target node being greater than or equal to the resource expansion amount corresponding to the resource expansion request, the running resources of the online task are expanded according to the resource expansion amount, and the current idle amount of the target node is updated.
8. A resource scheduling device, comprising: An offline resource configuration module is configured to configure the running resources of the offline task according to the resource restriction information of the offline task and the current resource idle amount of the target node, and update the current resource idle amount of the target node; A resource scheduling amount determination module is configured to determine a resource scheduling amount and send it to an offline task in response to receiving a resource expansion request of an online task and the current idle amount of resources of the target node being less than the resource expansion amount corresponding to the resource expansion request; The offline resource adjustment module is configured to adjust the running resources of the offline task according to the resource scheduling amount, and update the current resource idle amount of the target node.
9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
11. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.