Container scheduling method and device, electronic device, and storage medium
By reusing the scheduling results of similar containers in the cache for container scheduling, the problem of low scheduling efficiency under limited resources in the existing technology is solved, and more efficient container scheduling is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-09-28
- Publication Date
- 2026-04-21
AI Technical Summary
Existing container scheduling methods have limited applicability when resources are limited, and the approach of increasing computing resources to improve efficiency has failed to optimize the scheduling process, resulting in limited efficiency gains.
By retrieving the scheduling results of containers of the same type as the container to be scheduled from the cache and reusing these results for scheduling, the number of scheduling calculations is reduced and scheduling efficiency is improved.
With the same computing resources, it effectively accelerates the container scheduling process, reduces the number of scheduling calculations, and improves the efficiency of container scheduling.
Smart Images

Figure CN115878253B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of container scheduling technology, and in particular to a container scheduling method and apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of microservices and virtualization technologies in software, software development and deployment are gradually moving away from traditional processes and technologies, and towards a cloud-native direction. Currently, more and more companies are microserviceing their software operations using container technology to facilitate iteration and deployment. As the number and scale of containers continue to increase, container orchestration technology has become particularly important, with Kubernetes being the most popular. Kubernetes enables comprehensive scheduling and management of containers. Normally, only a single container can be scheduled at a time, and different containers not only compete for CPU, memory, and resources during scheduling, but are also subject to scheduling dependencies due to complex scheduling strategies. To ensure Kubernetes performance, container scheduling needs to be accelerated, and existing acceleration methods primarily rely on multi-container parallel scheduling.
[0003] Generally, the parallel scheduling process first obtains the containers to be deployed and the current distribution of cluster nodes and containers from the server through the scheduler. Then, multiple schedulers are started, each controlling one container to run the scheduling algorithm based on the current distribution of cluster nodes and containers. After each container completes the scheduling algorithm, it obtains the scheduling result, and the scheduler performs conflict detection on each scheduling result.
[0004] However, its drawback lies in the fact that each container uses a separate thread for pre-selection and optimization of the scheduling algorithm. Therefore, it essentially improves scheduling efficiency by increasing computing resources, without optimizing the container scheduling process. This approach has limited applicability when resources are limited. Summary of the Invention
[0005] In view of this, embodiments of this application provide a container scheduling method and apparatus, an electronic device, and a storage medium.
[0006] This application provides a container scheduling method, the method comprising:
[0007] Determine that the container to be scheduled meets the preset conditions;
[0008] Retrieve the scheduling operation results of the same type of container as the container to be scheduled from the cache; the cache includes the scheduling operation results of various types of containers that have already been scheduled.
[0009] Based on the obtained scheduling operation results, the scheduling is performed to obtain the target scheduling result of the container to be scheduled.
[0010] Based on the above embodiments, this application also provides a container scheduling device, which includes: a determination module, an acquisition module, and a processing module;
[0011] The determination module is used to determine whether the container to be scheduled meets the preset conditions;
[0012] The acquisition module is used to acquire the same type of scheduling operation results corresponding to the same type of container as the container to be scheduled from the cache; the cache includes the scheduling operation results corresponding to various types of containers that have been scheduled.
[0013] The processing module is used to perform scheduling based on the obtained similar scheduling operation results to obtain the target scheduling result of the container to be scheduled.
[0014] Based on the above embodiments, this application also provides an electronic device, which includes a processor and a memory for storing a computer program capable of running on the processor;
[0015] When the processor runs the computer program, it executes the steps of the method described in the above embodiments.
[0016] Based on the above embodiments, this application also provides a computer-readable storage medium storing a computer program thereon, the computer program being executed by a processor to implement the steps of the method described in the above embodiments.
[0017] The container scheduling method provided in this application, after a container to be scheduled meets preset conditions, can retrieve the same type of scheduling operation result corresponding to a container of the same type as the container to be scheduled from the cache; then, it reuses the same type of scheduling operation result of the same type of container to perform scheduling, thereby obtaining the target scheduling result corresponding to the container to be scheduled. In this way, by reusing the same type of scheduling operation result of the same type of container, the scheduling process can be effectively accelerated and the number of scheduling calculations can be reduced under the condition of the same computing resources. Attached Figure Description
[0018] Figure 1 A schematic diagram illustrating the execution flow of the scheduling algorithm proposed for related technologies;
[0019] Figure 2 A schematic diagram of the parallel scheduling process proposed for related technologies;
[0020] Figure 3 A flowchart illustrating a container scheduling method provided in an embodiment of this application;
[0021] Figure 4A flowchart illustrating another container scheduling method provided in an embodiment of this application;
[0022] Figure 5 A schematic diagram illustrating the execution flow of a scheduling algorithm in a container scheduling method provided in this application embodiment;
[0023] Figure 6 This is a schematic diagram of the structure of a container scheduling device provided in an embodiment of this application;
[0024] Figure 7 A schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation
[0025] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0026] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0027] Typically, when using Kubernetes for container scheduling, only one container's scheduling algorithm can run at a time. The specific implementation process is as follows: Figure 1 As shown. See also Figure 1 When a container performs a scheduling algorithm, the process is divided into two phases: the scheduling phase and the binding phase. The scheduling phase is the main computational process of the scheduling algorithm, which is further divided into the scheduling operation phase and the verification operation phase, which verifies the results of the scheduling operation.
[0028] The scheduling operation phase can be further divided into a pre-selection scheduling operation phase and a preferred scheduling operation phase. The pre-selection scheduling operation phase selects nodes that match the container's description information, which includes information such as the container's resource requirements. The preferred scheduling operation phase scores and ranks the pre-selected nodes. The binding phase primarily applies the scheduling results to the cluster. The pre-selection scheduling operation phase can include a pre-filtering phase and a filtering phase. The preferred scheduling operation phase includes a pre-scoring phase and a scoring phase.
[0029] The verification operation phase also includes a standardization scoring phase, a result saving and licensing phase. These three phases standardize, select and confirm the calculation results of the scheduling algorithm, and finally obtain the target scheduling result of the container.
[0030] To ensure Kubernetes performance, container scheduling needs to be accelerated. The scheduling acceleration methods proposed by relevant technologies mainly focus on parallel scheduling, and their specific implementation process is shown in Figure 2. (See also...) Figure 2 First, the scheduler needs to obtain the containers to be deployed and the current distribution of cluster nodes and containers from the cluster's servers. Then, multiple schedulers are started. Each scheduler controls one container to run a scheduling algorithm based on the current distribution of cluster nodes and containers. After the algorithm runs, the scheduling results are first stored in a result cache. This result cache represents the scheduling results that have not yet been reported back to the server by all schedulers and is maintained jointly by all schedulers. After each container completes the execution of its scheduling algorithm, it stores the scheduling result in the result cache. The scheduler then performs conflict detection on different scheduling results to determine if there are any conflicts in node resources.
[0031] However, its drawback lies in the fact that each container uses a separate thread for pre-selection and optimization of the scheduling algorithm. Essentially, it still improves scheduling efficiency by increasing computing resources, without optimizing the container scheduling process. Therefore, the solution has low applicability when resources are limited.
[0032] In addition, the related technologies also propose a batch scheduling method based on open-source plugins, the specific process of which is as follows:
[0033] 1) The minimum number of schedulers for each batch scheduling is set manually;
[0034] 2) Obtain the containers to be deployed and the current distribution status of cluster nodes and containers from the cluster's servers;
[0035] 3) Start scheduling containers. If the number of containers to be scheduled is less than the minimum number of containers to be scheduled, the containers will be marked as schedulable, indicating that the containers to be scheduled can be scheduled in batches.
[0036] 4) After scheduling is completed, the containers will be confirmed. If the number of successfully scheduled containers is less than the minimum number of scheduled containers, the containers will be marked as waiting, indicating that the batch container scheduling was successful.
[0037] However, its shortcomings lie in its overly simplistic design. Essentially, it remains a separate scheduling process, only synchronizing the same group of containers before and after scheduling. Furthermore, when a cluster's resources are insufficient to schedule a batch of containers, all containers will fail to be scheduled, placing high demands on the manually set "minimum number of containers to schedule."
[0038] To address the aforementioned problems in related technologies, this application provides a container scheduling method, such as... Figure 3 As shown, the method may include the following steps:
[0039] S301. Determine that the container to be scheduled meets the preset conditions.
[0040] Here, the container to be scheduled can be a container that needs to be deployed in the cluster. The scheduler obtains the queue of containers to be deployed from the cluster's servers and controls the containers in the queue to execute the scheduling algorithm one by one, obtaining the target scheduling result for each container.
[0041] In some embodiments, the preset conditions may include: the existence of a container of the same type as the container to be scheduled in the cache.
[0042] In some embodiments, the preset conditions may further include: within a preset time period, no nodes in the cluster corresponding to the container to be scheduled have been added, deleted, or modified; and / or, the cluster resources corresponding to the container to be scheduled have not changed within the preset time period.
[0043] S302. Obtain the scheduling operation results of the same type of container as the container to be scheduled from the cache; wherein, the cache includes the scheduling operation results of various types of containers that have been scheduled.
[0044] Here, after identifying the containers to be scheduled that meet the preset conditions, the scheduler can find the same type of scheduling operation result corresponding to the same type of container in the cache. In this way, the scheduler can directly reuse the same type of scheduling operation result to complete the scheduling of the containers to be scheduled, avoiding the need to perform all the operations on the containers, thereby improving the efficiency of container scheduling.
[0045] Specifically, the cache can include the scheduling results of various types of containers that have been scheduled.
[0046] S303. Based on the obtained scheduling operation results of the same type, perform scheduling to obtain the target scheduling result of the container to be scheduled.
[0047] It should be noted that containers meeting the preset conditions only need to undergo necessary computational processing, and their process differs from full scheduling. Full scheduling means that the containers to be scheduled undergo complete scheduling computation processing in each scheduling computation stage. The processing flow for containers meeting the preset conditions differs from full scheduling in that the computational process of each scheduling stage is replaced by the following method: In each scheduling computation stage, the scheduling computation sub-result of similar containers in this stage is first retrieved from the cache. Further, based on the retrieved scheduling computation sub-result, the necessary computational processing of this stage is performed, and the resulting calculation is then applied to the next stage of calculation, thus completing the scheduling computation processing. Further, the scheduler will still perform the verification computation stage (i.e., the specification scoring stage, result saving, and licensing stage) on the containers to be scheduled to obtain the final target scheduling result.
[0048] Here, the final target scheduling result is equivalent to selecting the optimal deployment node for the container to be scheduled from among the many nodes in the cluster.
[0049] Therefore, the container scheduling method provided in this application embodiment can, after the container to be scheduled meets the preset conditions, obtain the same type of scheduling operation result corresponding to the same type of container as the container to be scheduled from the cache; then, reuse the same type of scheduling operation result of the same type of container to perform scheduling, and obtain the target scheduling result corresponding to the container to be scheduled. In this way, by reusing the same type of scheduling operation result of the same type of container, the scheduling process can be effectively accelerated and the number of scheduling calculations can be reduced under the condition of the same computing resources.
[0050] Based on the above embodiments, the preset conditions in S301 may include: the existence of a container of the same type as the container to be scheduled in the cache.
[0051] Here, the cache is used to store the scheduling results corresponding to various types of containers. If a container of the same type as the container to be scheduled exists in the cache, scheduling can be performed according to the steps in S302 and S303. The criterion for classifying containers of the same type is that their deployment templates are the same.
[0052] It's important to note that scheduling scenarios in container environments primarily occur during container application creation and expansion. Container applications typically have multiple instances, and the same instance will yield the same results in different schedulers. In other words, containers of the same type may produce different scheduling results; however, during certain stages of the scheduling algorithm's execution, similar containers will achieve the same outcome. For instance, a stage in the scheduling algorithm might require a certain type of container to be scheduled to marked nodes, while a step in the algorithm excludes unmarked nodes. In this step, similar containers will all produce the same result. Therefore, reusing the scheduling results corresponding to similar containers can improve container scheduling efficiency.
[0053] In some embodiments, the preset conditions may further include: within a preset time period, no nodes in the cluster resources corresponding to the container to be scheduled have been added, deleted, or modified; and / or, the cluster resources corresponding to the container to be scheduled have not changed within the preset time period.
[0054] Here, if no nodes in the cluster corresponding to the container to be scheduled are added, deleted, or modified within the preset time period, it can be understood that the nodes in the cluster remain unchanged within the preset time period. Alternatively, "no changes to the cluster resources corresponding to the container to be scheduled within the preset time period" can also mean that no new containers are deployed to the nodes in the cluster within the preset time period.
[0055] In other words, as long as the scheduler detects that the container to be scheduled meets at least one of the above conditions, it can determine that the container to be scheduled can improve the efficiency of container scheduling by reusing the scheduling operation results of similar containers.
[0056] Based on the above embodiments, the same type of scheduling operation results in the cache of S302 may include the scheduling operation sub-results corresponding to the same type of containers that have completed scheduling in multiple scheduling operation stages.
[0057] Furthermore, in S303, scheduling is performed based on the obtained results of similar scheduling operations to obtain the target scheduling result for the container to be scheduled, which may include:
[0058] S3021. Starting from i, which is 1, retrieve the i-th scheduling operation sub-result corresponding to the i-th scheduling operation stage of the same type of container from the cache in sequence; where i is an integer greater than or equal to 1 and less than or equal to N, and N is the total number of scheduling operation stages.
[0059] S3022. Based on the result of the i-th scheduling operation sub-process, perform the first operation processing to obtain the target scheduling operation sub-result of the container to be scheduled in the i-th scheduling operation stage; the first operation processing refers to the necessary operation processing in the full operation processing performed on the container to be scheduled in each scheduling operation stage; until i takes the value N, the target scheduling operation sub-result of the container to be scheduled in the N-th scheduling operation stage is obtained.
[0060] S3023. Based on the target scheduling operation sub-result of the Nth scheduling operation stage, determine the target scheduling result of the container to be scheduled.
[0061] Here, after determining that the container to be scheduled meets the preset conditions, the efficiency of container scheduling can be improved by finding the same type of container with the same type of scheduling operation result in the cache and reusing the same type of scheduling operation result.
[0062] It should be noted that the cache includes the scheduling operation sub-results for each type of container at various scheduling operation stages. The scheduling operation sub-results stored in the cache are indexed by two dimensions: scheduling operation stage and container type, saving the scheduling operation sub-results for each type of container at each scheduling operation stage. For example, the cache can save the scheduling operation sub-results for each type of container at the pre-filtering stage, filtering stage, pre-scoring stage, and scoring stage.
[0063] Specifically, in each scheduling operation phase, the scheduler can first retrieve the scheduling operation sub-results corresponding to the same type of container in the current scheduling operation phase from the cache. Then, based on the scheduling operation sub-results corresponding to the same type of container in the current scheduling operation phase, it performs the first operation processing to obtain the target scheduling operation sub-result corresponding to the container to be scheduled in the current scheduling operation phase.
[0064] Furthermore, the scheduler can input the target scheduling operation result of the current scheduling operation stage into the next scheduling operation stage for processing in the next scheduling operation stage, until all scheduling operation stages are completed, and the target scheduling operation result of the last scheduling operation stage is obtained, that is, the target scheduling operation result of the Nth scheduling operation stage.
[0065] It should be noted that the target scheduling operation result obtained in each scheduling operation stage will be used in the operation of the algorithm in the next scheduling operation stage. That is, the target scheduling operation result of the i-th scheduling operation stage will affect the target scheduling operation result of the (i+1)-th scheduling operation stage.
[0066] For example, the target scheduling operation result in the filtering phase could be to determine a set of available nodes for the container to be scheduled. In the pre-scoring phase, the scheduler can obtain the scheduling operation results of similar containers in this pre-scoring phase, and combine the scheduling operation results of similar containers in this pre-scoring phase with the target scheduling operation result (a set of available nodes) from the previous phase to determine the score of each available node. In other words, this scheduling operation phase reduces the scoring operation for each node, directly reusing the scheduling operation results of similar containers to score available nodes, thus improving the efficiency of the scheduling operation.
[0067] Here, the first computational processing refers to the necessary computational processing performed on the container to be scheduled. In other words, in each scheduling computation phase, only the necessary computational processing needs to be performed on the container to be scheduled; other computational processing can be omitted, and the scheduling sub-results of similar containers in the current scheduling computation phase can be directly reused. That is, the scheduler does not need to perform full computational processing on the container to be scheduled.
[0068] For example, refer to Figure 5 As shown, the scheduling sub-results of similar containers during the filtering phase are a set of available nodes. The scheduler can retrieve the scheduling sub-results of similar containers during the filtering phase from the cache, and then perform the necessary calculations for this phase based on these results, for example... Figure 5 The first operation processing step is the filtering stage.
[0069] In this embodiment of the application, after obtaining the target scheduling operation result of the Nth scheduling operation stage, the scheduler can perform a verification operation stage on the target scheduling operation result (i.e., Figure 5The process (including the scoring stage, result saving stage, and licensing stage) shown in the diagram yields the final target scheduling result.
[0070] In some embodiments, based on the above embodiments, the method may further include:
[0071] S3024. If the i-th scheduling operation sub-result does not exist in the cache, the second operation processing of the i-th scheduling operation stage is performed on the container to be scheduled to obtain the target scheduling operation sub-result corresponding to the i-th scheduling operation stage of the container to be scheduled. The second operation processing refers to the full operation processing performed on the container to be scheduled in each scheduling operation stage. Until i takes the value N, the target scheduling operation sub-result of the N-th scheduling operation stage of the container to be scheduled is obtained.
[0072] Here, if the cache does not contain the i-th scheduling operation sub-result corresponding to the same type of container in the i-th scheduling operation stage, then the target scheduling operation sub-result corresponding to the container to be scheduled in the i-th scheduling operation stage must be determined by full operation.
[0073] In this embodiment, the second operation process represents the full operation process. The second operation process may include the first operation process; that is, the first operation process is a part of the second operation process. Specifically, if the cache does not contain the scheduling operation sub-result corresponding to a certain scheduling operation stage of the same type of container, it is necessary to determine the target scheduling operation sub-result corresponding to the current scheduling operation stage through full calculation.
[0074] It should be noted that if the result of the i-th scheduling operation does not exist in the cache, it will affect the processing of the (i+1)-th scheduling operation stage. In other words, if the result of the scheduling operation of the same type of container in a certain scheduling operation stage cannot be reused, the scheduler needs to adjust the current scheduling operation stage and the subsequent scheduling operation stages into the full operation process. That is, the operation of the current scheduling operation stage and the subsequent scheduling operation stages is completed through the second operation to obtain the target scheduling operation result of the N-th scheduling operation stage.
[0075] Based on the above embodiments, after obtaining the target scheduling operation sub-result corresponding to the i-th scheduling operation stage of the container to be scheduled in S3023, the method further includes:
[0076] S3023a. Add the target scheduling operation sub-result corresponding to each scheduling operation stage of the container to be scheduled to the cache.
[0077] Here, after obtaining the target scheduling operation sub-results corresponding to each scheduling operation stage of the container to be scheduled through the second operation processing, the scheduler can add the calculated target scheduling operation sub-results corresponding to the current scheduling operation stage to the cache according to the two dimensions of scheduling operation stage and container type to complete the update of the information in the cache, so that other containers to be scheduled can use it during the scheduling operation process.
[0078] Based on the above embodiments, after performing scheduling based on the obtained similar scheduling operation results in S303 to obtain the target scheduling result for the container to be scheduled, the following may also be included:
[0079] S304. If the container to be scheduled does not meet the preset conditions, the scheduling is performed according to the full scheduling operation process to obtain the target scheduling result of the container to be scheduled.
[0080] Based on the above embodiments, the method may further include:
[0081] S305. Update the validity period of the container in the cache; the validity period is used to characterize the time range within which the scheduling operation results of the same type of container can be obtained.
[0082] Here, after the container scheduling is completed, the validity period of the container corresponding to the same type of container in the cache will be updated; the validity period is used to characterize the time range in which the scheduling operation results of the same type of container can be obtained.
[0083] Specifically, whether scheduling is accomplished by reusing the results of similar scheduling operations or through a full scheduling process, the Time To Live (TTL) of the container type in the cache will be updated to its initial value. For example, if the initial TTL of a certain type of container is 10, then after initialization, it means that for the next 10 seconds, containers of this type can be scheduled more quickly by reusing the results of similar scheduling operations. Furthermore, the TTL of similar containers decreases over time; when the TTL of a certain type of container reaches 0, that container type will be removed from the cache.
[0084] This application embodiment effectively accelerates the scheduling process by reusing scheduling operation results. Taking a cluster of 10 nodes as an example, assuming the cache contains scheduling operation results for containers of the same type as the container to be scheduled, ideally, compared to the original scheduling process using a full scheduling operation, reusing scheduling operation results can reduce 10*3*4 = 120 scheduling calculations, effectively accelerating the scheduling process.
[0085] Therefore, the container scheduling method provided in this application, after the container to be scheduled meets the preset conditions, retrieves the same type of scheduling operation result corresponding to the same type of container as the container to be scheduled from the cache; performs scheduling based on the same type of scheduling operation result to obtain the target scheduling operation result of the container to be scheduled. In this way, by reusing the same type of scheduling operation result, the scheduling process can be effectively accelerated and the number of scheduling calculations can be reduced under the condition of the same computing resources.
[0086] Based on the above embodiments, this application also provides a container scheduling method, such as... Figure 4 and Figure 5 As shown, the method includes:
[0087] S401. Determine that the container to be scheduled meets the preset conditions.
[0088] Here, the container to be scheduled can be a container that needs to be deployed in the cluster. The scheduler obtains the queue of containers to be deployed from the cluster's servers and controls the containers in the queue to execute the scheduling algorithm one by one, calculating the target scheduling result for each container.
[0089] Here, the preset conditions may include: the existence of a container of the same type as the container to be scheduled in the cache; no addition, deletion, or modification of nodes in the cluster corresponding to the container to be scheduled within a preset time period; and no change in the cluster resources corresponding to the container to be scheduled within a preset time period.
[0090] It's important to note that scheduling scenarios in container environments primarily occur during container application creation and expansion. Container applications typically have multiple instances, and the same instance will produce the same result in different schedulers. That is, containers of the same type may have different scheduling results; however, during certain stages of the scheduling algorithm's execution, similar containers will achieve the same outcome. For example, a scheduler might require a certain type of container to be scheduled to marked nodes, and the scheduling algorithm might include a step to exclude unmarked nodes. In this step, similar containers will all produce the same result. Therefore, reusing the results from the same scheduler can improve container scheduling efficiency.
[0091] The cache is specifically used to store the scheduling results corresponding to various types of containers. If a container of the same type as the container to be scheduled exists in the cache, the scheduler can reuse the scheduling result of that container to be scheduled. The criterion for classifying containers of the same type is that they have the same deployment template. Taking a 10-node cluster as an example, assuming... Figure 5The first four stages of the scheduling operation phase each contain 5 types of programs to be scheduled. Therefore, the container entering this scheduling algorithm needs to use 20 types of programs to perform scheduling calculations on 10 nodes respectively, and the total number of calculations is 20*10=200.
[0092] It should also be noted that within the first four scheduling operation phases, the scheduling processing within the same scheduling operation phase can be further divided into full operation processing and necessary operation processing. The classification standard is that the output results are consistent when the same type of container is in the same state of the cluster nodes.
[0093] Here, "same cluster node status" means that no cluster nodes have been added or deleted, the cluster computing resources have not changed, and there are no manual update operations, such as changes in labels or node taints.
[0094] Furthermore, the output results consistently vary across different stages. For example, in the filtering stage, the output results consistently show a set of identical nodes. Taking the filtering stage as an example, using the classification method described above, the classification results are as follows: NodeUnschedulable Plugins (determining whether a node is schedulable), NodeName Plugins (determining whether node names match), and NodePort Plugins (determining whether node ports are schedulable) are all reusable processing operations; while PodToPologySpread Plugins (determining the degree of container dispersion) and InterPodAffinityPlugins (determining the affinity between containers) are all necessary processing operations.
[0095] Specifically, in each stage of the scheduling algorithm calculation process, all reusable full processing operations are executed first to obtain reusable scheduling operation results. The scheduling operation results are then used to update or add information in the cache. At the same time, this result is used as input to execute the necessary processing operations of this stage.
[0096] S402. Retrieve the i-th scheduling operation sub-result corresponding to the i-th scheduling operation stage of the same type of container from the cache;
[0097] S403. Perform the first operation processing based on the i-th scheduling operation sub-result to obtain the target scheduling operation sub-result of the container to be scheduled in the i-th scheduling operation stage; where i is an integer greater than or equal to 1 and less than or equal to N, and N is the total number of scheduling operation stages; until i takes the value of N, the target scheduling operation sub-result of the container to be scheduled in the N-th scheduling operation stage is obtained.
[0098] Among them, the first operation processing refers to the necessary operation processing in the full operation processing performed on the container to be scheduled in each scheduling operation phase;
[0099] Here, after determining that the container to be scheduled meets the preset conditions, the same type of scheduling operation result corresponding to the same type of container to be scheduled can be found in the cache, and the same type of scheduling operation result can be reused, thereby improving the efficiency of container scheduling.
[0100] It should be noted that the cache includes the scheduling operation sub-results for various types of containers at different scheduling operation stages. The cache can be indexed by two dimensions: scheduling operation stage and container type, to store the scheduling operation sub-results for each stage.
[0101] Specifically, in the current scheduling operation phase (i.e., the i-th scheduling operation phase), the scheduler can first retrieve the i-th scheduling operation sub-result corresponding to the same type of container in the i-th scheduling operation phase from the cache. Then, based on the i-th scheduling operation sub-result, the first operation processing is performed to obtain the target scheduling operation sub-result corresponding to the container to be scheduled in the current i-th scheduling operation phase.
[0102] Here, the first operation refers to the necessary operations performed on the container to be scheduled. That is, in the i-th scheduling operation phase, only the necessary operations need to be performed on the container to be scheduled; other operations can be omitted, and the i-th scheduling operation sub-result corresponding to the same type of container in the i-th scheduling operation phase can be directly reused. In other words, the scheduler does not need to perform full operations on the container to be scheduled.
[0103] For example, refer to Figure 5 As shown, the scheduling sub-results of similar containers during the filtering phase are a set of available nodes. The scheduler can retrieve the scheduling sub-results of similar containers during the filtering phase from the cache, and then perform the necessary calculations for this phase based on these results, for example... Figure 5 The first operation in the filtering stage of the first operation processing.
[0104] After obtaining the target scheduling operation result of the i-th scheduling operation stage, the processing of the (i+1)-th scheduling operation stage continues.
[0105] Specifically, in the (i+1)th scheduling operation stage, the scheduler can continue to retrieve the (i+1)th scheduling operation sub-result corresponding to the same type of container in the (i+1)th scheduling operation stage from the cache, and perform the first operation processing based on the (i+1)th scheduling operation sub-result and the target scheduling operation sub-result corresponding to the ith scheduling operation stage to obtain the target scheduling operation sub-result of the container to be scheduled in the (i+1)th scheduling operation stage, until i takes the value N, to obtain the target scheduling operation sub-result of the container to be scheduled in the Nth scheduling operation stage.
[0106] Here, after determining the i-th scheduling operation sub-result, the next scheduling operation stage (i.e., the (i+1)-th scheduling operation stage) continues. The operation process of the (i+1)-th scheduling operation stage is similar to that of the i-th scheduling operation stage. Both involve searching the cache for the scheduling operation sub-result of the same type of container in the current stage (i.e., the (i+1)-th scheduling operation stage), and performing the first operation based on the scheduling operation sub-result to obtain the target scheduling operation sub-result of the container to be scheduled in the (i+1)-th scheduling operation stage.
[0107] It should be noted that the scheduler needs to perform the above processing for each scheduling operation stage until the target scheduling operation sub-result corresponding to the final Nth scheduling operation stage is obtained.
[0108] S404. If the result of the i-th scheduling operation does not exist in the cache, the container to be scheduled will be processed by the second operation in the i-th scheduling operation stage to obtain the target scheduling operation result corresponding to the container to be scheduled in the i-th scheduling operation stage.
[0109] The second operation processing refers to the full operation processing performed on the container to be scheduled in each scheduling operation phase.
[0110] Here, if the cache does not contain the i-th scheduling operation sub-result corresponding to the same type of container in the i-th scheduling operation stage, then the target scheduling operation sub-result corresponding to the container to be scheduled in the i-th scheduling operation stage must be determined by full operation.
[0111] In this embodiment, the second operation process represents the full operation process. The second operation process may include the first operation process; that is, the first operation process is a part of the second operation process. Specifically, if the cache does not contain the scheduling operation sub-result corresponding to a certain scheduling operation stage of the same type of container, it is necessary to determine the target scheduling operation sub-result corresponding to the current scheduling operation stage through the full operation process.
[0112] It should be noted that after obtaining the target scheduling operation result of the i-th scheduling operation stage, the full operation can be performed to process the (i+1)-th scheduling operation stage.
[0113] Specifically, in the (i+1)th scheduling operation stage, the scheduler can perform a second operation based on the target scheduling operation sub-result corresponding to the i-th scheduling operation stage, to obtain the target scheduling operation sub-result of the container to be scheduled in the (i+1)th scheduling operation stage, until i takes the value N, to obtain the target scheduling operation sub-result of the container to be scheduled in the N-th scheduling operation stage.
[0114] S405. Add the target scheduling operation sub-result corresponding to each scheduling operation stage of the container to be scheduled to the cache.
[0115] Here, the container to be scheduled is obtained through the second operation. After the target scheduling operation sub-result corresponding to the i-th scheduling operation stage, the calculated target scheduling operation sub-result is added to the cache according to the two dimensions of scheduling operation stage and container type to complete the update of the information in the cache.
[0116] S406. Based on the target scheduling operation sub-result of the Nth scheduling operation stage, determine the target scheduling result of the container to be scheduled.
[0117] In this embodiment of the application, after obtaining the target scheduling operation sub-result of the Nth scheduling operation stage, the scheduler can also execute based on the target scheduling operation sub-result of the Nth scheduling operation stage. Figure 5 The verification and processing of the standard scoring stage, storage stage, and licensing stage shown in the figure yield the final target scheduling result.
[0118] Here, after determining the target scheduling result, it is equivalent to determining the node with the highest score, and the node with the highest score is determined as the node to be deployed.
[0119] S407. If the container to be scheduled does not meet the preset conditions, the scheduling is performed according to the full scheduling operation process to obtain the target scheduling result of the container to be scheduled.
[0120] S408. Update the validity period of the container in the cache; the validity period is used to characterize the time range within which the scheduling operation results of the same type of container can be obtained.
[0121] Here, after the container scheduling is completed, the validity period of the container corresponding to the same type of container in the cache will be updated; the validity period is used to characterize the time range in which the scheduling operation results of the same type of container can be obtained.
[0122] Specifically, whether scheduling is accomplished by reusing the results of similar scheduling operations or through a full scheduling process, the Time To Live (TTL) of the container type in the cache will be updated to its initial value. For example, if the initial TTL of a certain type of container is 10, then after initialization, it means that for the next 10 seconds, containers of this type can be scheduled more quickly by reusing the results of similar scheduling operations. Furthermore, the TTL of similar containers decreases over time; when the TTL of a certain type of container reaches 0, that container type will be removed from the cache.
[0123] This application embodiment can effectively accelerate the scheduling process by reusing scheduling operation results. Here, taking a cluster with 10 nodes as an example, assuming that the cache contains scheduling operation results of containers of the same type as the program to be scheduled, then under ideal conditions, compared with the original scheduling operation process calculated by calculation, the scheduling operation result reuse method can reduce 10*3*4=120 scheduling calculations, effectively accelerating the scheduling process.
[0124] Therefore, the container scheduling method provided in this application, after the container to be scheduled meets the preset conditions, retrieves the same type of scheduling operation result corresponding to the same type of container as the container to be scheduled from the cache; performs scheduling based on the same type of scheduling operation result to obtain the target scheduling result of the container to be scheduled. In this way, by reusing the same type of scheduling operation result, the scheduling process can be effectively accelerated and the number of scheduling calculations can be reduced under the condition of the same computing resources.
[0125] Based on the above embodiments, this application also provides a container scheduling device 60, such as... Figure 6 As shown, the device 60 may include: a determination module 61, an acquisition module 62, and a processing module 63;
[0126] The determination module 61 is used to determine whether the container to be scheduled meets the preset conditions;
[0127] The acquisition module 62 is used to acquire the same type of scheduling operation results corresponding to the same type of container as the container to be scheduled from the cache; the cache includes the scheduling operation results corresponding to various types of containers that have been scheduled.
[0128] Processing module 63 is used to perform scheduling based on the obtained similar scheduling operation results to obtain the target scheduling result of the container to be scheduled.
[0129] Based on the above embodiments, the preset conditions include:
[0130] The cache contains containers of the same type as the container to be scheduled.
[0131] Based on the above embodiments, the preset conditions further include:
[0132] Within the preset time period, no nodes in the cluster corresponding to the container to be scheduled were added, deleted, or modified.
[0133] And / or,
[0134] The cluster resources corresponding to the container to be scheduled did not change within the preset time period.
[0135] Based on the above embodiments, the same type of scheduling operation results in the cache include the scheduling operation sub-results corresponding to the same type of containers that have completed scheduling in multiple scheduling operation stages;
[0136] The processing module 63 may further include: an acquisition submodule and a determination submodule, wherein...
[0137] The acquisition submodule is used to retrieve, starting from i with a value of 1, the i-th scheduling operation sub-result corresponding to the i-th scheduling operation stage of the same type of container from the cache; where i is an integer greater than or equal to 1 and less than or equal to N, and N is the total number of scheduling operation stages;
[0138] The first determining submodule is used to perform a first operation processing based on the i-th scheduling operation sub-result to obtain the target scheduling operation sub-result of the container to be scheduled in the i-th scheduling operation stage; the first operation processing refers to the necessary operation processing in the full operation processing performed on the container to be scheduled in each scheduling operation stage; until i takes the value N, the target scheduling operation sub-result of the container to be scheduled in the N-th scheduling operation stage is obtained; the target scheduling result is determined based on the target scheduling operation sub-result of the N-th scheduling operation stage.
[0139] Based on the above embodiments, the processing module 63 may further include: a second determining submodule, which is used to perform a second operation processing on the container to be scheduled in the i-th scheduling operation stage if the i-th scheduling operation sub-result does not exist in the cache, so as to obtain the target scheduling operation sub-result corresponding to the container to be scheduled in the i-th scheduling operation stage; the second operation processing refers to the full operation processing performed on the container to be scheduled in each scheduling operation stage.
[0140] Based on the above embodiments, the second determining submodule is further configured to add the target scheduling operation sub-result corresponding to each scheduling operation stage of the container to be scheduled to the cache.
[0141] Based on the above embodiments, the device 60 may further include: a calculation module, which is used to perform scheduling according to the full scheduling operation process to obtain the target scheduling result of the container to be scheduled if the container to be scheduled does not meet the preset conditions.
[0142] Based on the above embodiments, the device 60 may further include: an update module, which is used to update the validity period corresponding to the same type of container in the cache; the validity period is used to characterize the time range within which the same type of scheduling operation result corresponding to the same type of container can be obtained.
[0143] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0144] Based on the above embodiments, this application also provides an electronic device corresponding to a container scheduling method. In the embodiments of this application, the electronic device may integrate the container scheduling device or electronic device described in the above embodiments.
[0145] Figure 7 This is a schematic diagram of the hardware composition structure of the electronic device according to an embodiment of this application, such as... Figure 7 As shown, the electronic device proposed in this application embodiment may include a processor 71 and a memory 72 storing processor-executable instructions;
[0146] The processor 71 and the memory 72 are connected via a bus 73;
[0147] When the processor 71 runs the computer program stored in the memory 72, it can execute the following instructions:
[0148] Determine that the container to be scheduled meets the preset conditions;
[0149] Retrieve the scheduling operation results of the same type of container as the container to be scheduled from the cache; the cache includes the scheduling operation results of various types of containers that have already been scheduled.
[0150] Based on the obtained scheduling operation results, the scheduling is performed to obtain the target scheduling result of the container to be scheduled.
[0151] In the embodiments provided in this application, the processor 71 can be at least one of the following: Application-Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field-Programmable Gate Array (FPGA), Central Processing Unit (CPU), and controller. It is understood that for different devices, the electronic device used to implement the above-mentioned processor function can also be other types, and the embodiments in this application do not specifically limit it.
[0152] In practical applications, memory 72 can be volatile memory, such as RAM; or non-volatile memory, such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to processor 71.
[0153] This application also provides a computer storage medium, specifically a computer-readable storage medium. Computer instructions are stored thereon, and when the computer storage medium is located in an electronic device, these computer instructions, when executed by a processor, implement any step of the container scheduling method described in this application.
[0154] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0155] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0156] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or at least two units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0157] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0158] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0159] It should be noted that the technical solutions described in the embodiments of this application can be combined arbitrarily without conflict.
[0160] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A container dispatching method characterized by comprising: The method includes: Determine that the container to be scheduled meets the preset conditions; Retrieve the scheduling operation results of the same type of container as the container to be scheduled from the cache; the scheduling operation results in the cache include the scheduling operation sub-results of the same type of container that has been scheduled in multiple scheduling operation stages; wherein, the criterion for classifying the containers as the same type is that the containers have the same deployment template; Starting from i, which is 1, the i-th scheduling operation sub-result corresponding to the i-th scheduling operation stage of the same type of container is sequentially obtained from the cache; Based on the i-th scheduling operation sub-result, the first operation processing is performed to obtain the target scheduling operation sub-result of the container to be scheduled in the i-th scheduling operation stage; where i is an integer greater than or equal to 1 and less than or equal to N, and N is the total number of scheduling operation stages; the first operation processing refers to the necessary operation processing in the full operation processing performed on the container to be scheduled in each scheduling operation stage. Until i takes the value N, the target scheduling operation sub-result of the Nth scheduling operation stage of the container to be scheduled is obtained; Based on the target scheduling operation sub-result of the Nth scheduling operation stage, the target scheduling result of the container to be scheduled is obtained.
2. The method of claim 1, wherein, The preset conditions include: The cache contains scheduling operation results for containers of the same type as the container to be scheduled.
3. The method of claim 2, wherein, The preset conditions also include: Within the preset time period, no nodes in the cluster corresponding to the container to be scheduled were added, deleted, or modified. And / or, The cluster resources corresponding to the container to be scheduled did not change within the preset time period.
4. The method of claim 1, wherein, The method further includes: If the i-th scheduling operation sub-result is not present in the cache, then the second operation processing in the i-th scheduling operation stage is performed on the container to be scheduled to obtain the target scheduling operation sub-result corresponding to the container to be scheduled in the i-th scheduling operation stage; the second operation processing refers to the full operation processing performed on the container to be scheduled in each scheduling operation stage.
5. The method of claim 4, wherein, The method further includes: The target scheduling operation sub-result corresponding to each scheduling operation stage of the container to be scheduled is added to the cache.
6. The method of claim 5, wherein, After obtaining the target scheduling result of the container to be scheduled based on the target scheduling operation sub-result of the Nth scheduling operation stage, the process further includes: Update the validity period of the scheduling operation results corresponding to the same type of container in the cache; the validity period is used to characterize the time range within which the scheduling operation results corresponding to the same type of container can be obtained.
7. A container dispatching apparatus characterized by comprising: include: Decision module, acquisition module, and processing module; The determination module is used to determine whether the container to be scheduled meets the preset conditions; The acquisition module is used to acquire the same type of scheduling operation results corresponding to the same type of container as the container to be scheduled in the cache; the same type of scheduling operation results in the cache include the scheduling operation sub-results corresponding to the same type of container that has been scheduled in multiple scheduling operation stages; wherein, the criterion for classifying the same type of container is that the containers have the same deployment template; The processing module is configured to, starting from i = 1, sequentially retrieve the i-th scheduling operation sub-result corresponding to the i-th scheduling operation stage of the same type of container from the cache; perform a first operation processing based on the i-th scheduling operation sub-result to obtain the target scheduling operation sub-result of the container to be scheduled in the i-th scheduling operation stage; where i is an integer greater than or equal to 1 and less than or equal to N, and N is the total number of scheduling operation stages; the first operation processing refers to the necessary operation processing in the full operation processing performed on the container to be scheduled in each scheduling operation stage; until i = N, the target scheduling operation sub-result of the container to be scheduled in the N-th scheduling operation stage is obtained; and based on the target scheduling operation sub-result of the N-th scheduling operation stage, the target scheduling result of the container to be scheduled is obtained.
8. An electronic device, characterized in that, The electronic device includes a processor and a memory for storing computer programs that can run on the processor; When the processor is used to run the computer program, it performs the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Scheduling method, system, computer equipment and medium
CN108228354A
Container scheduling method and device and computer readable storage medium
CN110888714A