Resource scheduling method, and device, storage medium and program product
By calibrating the runtime of the target process in the cloud service system, the problem of computing power differences between different generations of servers was solved, achieving computing power normalization and consistency of user experience.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
- Filing Date
- 2025-10-15
- Publication Date
- 2026-05-15
AI Technical Summary
Different generations of servers in cloud service systems have different computing power, which leads to inconsistent runtime for the same workload on different models, affecting user experience and potentially causing inconsistencies in billing.
By obtaining the historical running time of the target process in the historical scheduling cycle of the first service device, the target compensation time is determined, and the target process is paused between the target scheduling cycle and its next scheduling cycle to extend its running time, so as to calibrate the running time and reduce or eliminate the computing power difference.
It achieves computing power normalization between different computing servers, ensuring a consistent user experience and reducing billing discrepancies.
Smart Images

Figure CN2025127921_15052026_PF_FP_ABST
Abstract
Description
Resource scheduling methods, equipment, storage media and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202411577549.7, filed with the China Patent Office on November 5, 2024, entitled “Resource Scheduling Method, Apparatus, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of computer technology, and in particular to a resource scheduling method, device, storage medium, and program product. Background Technology
[0003] Cloud service systems contain various servers with different computing power. A customer may purchase several instances of the same specifications, which may run on servers with varying computing power. Because of performance differences between different generations of servers, even instances of the same specifications can exhibit performance variations. This leads to performance differences even when running the same workload on identical instances; the same workload might take 30 minutes on an 8th-generation server but 40 minutes on 6th and 7th-generation servers. This difference not only impacts user experience but can also cause inconsistencies in billing, leading to customer questions, complaints, and even grievances. Therefore, how to technically mask the differences between different generations of servers and maintain relative stability in computing power across generations has become a technical issue that requires continuous attention from those skilled in the art. Summary of the Invention
[0004] This disclosure provides a resource scheduling method, device, storage medium, and program product to reduce the computing power differences between service devices with different computing power, and even to normalize the computing power of service devices with different computing power.
[0005] This disclosure provides a resource scheduling method in which a first service device and a second service device run application instances of the same specifications; the computing power of the first service device is superior to that of the second service device; the method includes:
[0006] For the currently completed target scheduling period, obtain the historical running time of the target process of the first service device in the historical scheduling period; the target process is the process that executes the target task of the application instance; the historical scheduling period includes the target scheduling period;
[0007] Based on the historical running time, the target compensation time for the target process in the target scheduling period is determined; the target compensation time is used to align the running time of the first service device executing the target task with that of the second service device.
[0008] The target process will be paused for the target compensation time.
[0009] Initiate the next scheduling cycle of the target scheduling cycle to perform resource scheduling for the target process.
[0010] This disclosure also provides an electronic device, including: a memory and a processor; wherein the memory is used to store a computer program;
[0011] The processor is coupled to the memory and is used to execute the computer program for performing the steps in the aforementioned resource scheduling method.
[0012] This disclosure also provides a computer-readable storage medium storing computer instructions that, when executed by one or more processors, cause the one or more processors to perform the steps in the aforementioned resource scheduling method.
[0013] This disclosure also provides a computer program product, including a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps in the aforementioned resource scheduling method.
[0014] In this embodiment, the target compensation time for the target process in the target scheduling period is determined by the historical running time of the target process in the historical scheduling period. By pausing the target process for the target compensation time between the target scheduling period and its next scheduling period, the execution of the target task is suspended, thus calibrating the running time of the target process in the target scheduling period. This extends the running time of the target task on the first service device, reducing the difference in running time caused by the difference in computing power between the first and second service devices, thereby reducing the computing power difference between the first and second service devices. It can even eliminate the difference in running time caused by the difference in computing power between the first and second service devices, achieving the effect of computing power normalization. Attached Figure Description
[0015] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:
[0016] Figure 1 is a schematic diagram of the principle of the traditional computing power normalization scheme;
[0017] Figure 2 is a schematic diagram of the problems with the computing power normalization scheme provided in Figure 1;
[0018] Figure 3 is a schematic diagram of another traditional computing power normalization scheme;
[0019] Figure 4 is a schematic diagram of the structure of the cloud service system provided in the embodiment of this disclosure;
[0020] Figure 5 is a schematic diagram of the resource scheduling process of the CFS strategy provided in the embodiments of this disclosure;
[0021] Figure 6 is a schematic diagram illustrating the differences in computing power among service devices with different computing power provided in the embodiments of this disclosure;
[0022] Figure 7 is a flowchart illustrating the resource scheduling method provided in an embodiment of this disclosure;
[0023] Figure 8 is a schematic diagram illustrating the principle of the resource scheduling method provided in the embodiments of this disclosure;
[0024] Figure 9 is a schematic diagram illustrating the effect of the resource scheduling method provided in the embodiments of this disclosure on non-processor-intensive tasks;
[0025] Figure 10 is a schematic diagram of the structure of the electronic device provided in the embodiment of this disclosure. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0028] The concepts and terms involved in the embodiments of this disclosure will be explained below.
[0029] Completely Fair Scheduler (CFS) policy: CFS is a scheduling algorithm in Linux systems used to manage the allocation of processor resources. Each scheduling entity in a CFS policy maintains a virtual runtime (vruntime), which is calculated using weights to ensure that each process receives relatively balanced resource usage.
[0030] Runtime: The processor time consumed by a service device or process group to complete a load or task.
[0031] Scheduling Entity: The object of operation for the CFS strategy. A scheduling entity can correspond to a single task or a group of tasks.
[0032] Process group: also known as task group, a process group is a collection of multiple tasks. The tasks of a process group may be distributed across several processor cores.
[0033] CFS Bandwidth Control: CFS bandwidth control is a feature of the Completely Fair Scheduler (CFS) in the Linux kernel, designed to limit the bandwidth used by a process group for processor resources such as the Central Processing Unit (CPU). This mechanism effectively manages processor usage by configuring scheduling periods and time quotas to support various load balancing and resource management needs.
[0034] Scheduling Period: A time period of given length during which processor resources are allocated to each process group. This scheduling period cycles continuously.
[0035] The time quota is the maximum amount of processor time a process group can use within a scheduling cycle. Once a process group exceeds this quota in the current cycle, it will be restricted from scheduling until the start of the next cycle.
[0036] Throttle: When a process group uses more processor time than the set time limit within a specific cycle, the system will "throttle" the process group, limiting its further processor use until the next cycle begins. This mechanism is achieved by suspending the scheduling of the process group.
[0037] Computing power normalization: Through software means, the computing power performance of servers of different generations, models, and load levels is kept stable and similar, so that the computing power of different models can be normalized.
[0038] CPU-intensive tasks and non-CPU-intensive tasks are categorized based on the degree to which applications rely on CPU resources during operation. These two types of applications differ significantly in resource requirements, performance bottlenecks, and optimization directions.
[0039] Among them, CPU-intensive tasks refer to applications or services that require a large amount of CPU computing power during operation. The characteristics of these applications are that their performance is mainly limited by the CPU's processing power, and they usually involve a large number of computing tasks. They generally have the following characteristics: (1) Computation-intensive: The application logic contains a large number of computing operations, such as numerical computing, scientific computing, image processing, etc.; (2) High algorithm complexity: It may involve complex algorithms, such as sorting, searching, recursion, etc.; (3) Parallel processing: It can often accelerate the calculation through parallel processing, such as multi-threaded programming or distributed computing; (4) High real-time requirements: Some application scenarios require real-time data processing, such as online transaction processing, real-time data analysis, etc.
[0040] Non-CPU-intensive tasks refer to business operations that have relatively low CPU dependence during operation, with performance bottlenecks mainly occurring in other resources. These applications may rely more on input / output (I / O), memory, network, and other factors. They generally have the following characteristics: (1) I / O intensive: The application logic contains a large number of read and write operations, such as database queries and file read / write; (2) Memory intensive: The application logic requires a large number of memory operations, such as large-scale data caching; (3) Network intensive: The application logic requires frequent network communication, such as Web services and service calls in microservice architectures; (4) Long waiting time: Usually includes a large amount of waiting time, such as waiting for database responses and waiting for external services to return results.
[0041] Before introducing the solutions provided by the embodiments of this disclosure, a brief introduction to the traditional computing power normalization scheme will be given.
[0042] Traditional Solution 1: Abstracting different CPU models to achieve normalized computing power (Normalized CPU units). Although the objectives are similar, the specific design ideas and implementation schemes differ from this solution.
[0043] The solution's core idea is to unify heterogeneous computing resources, such as CPUs of different types and generations, into an abstract Computing Unit (CU) for resource management and scheduling. The CU is an abstract unit of computing power located above the physical CPU layer, and the allocation and scheduling of computing power are based on this abstract CU. When a user needs computing power, they request a certain number of CUs from the resource management system. For example, if a customer requests 8 CUs, the resource management system will allocate physical CPU resources to meet the computing power needs of these 8 CUs, without needing to know the specific model or number of CPUs allocated at the lower level. Each CU has the same computing power, masking the performance differences of the underlying CPUs, thus achieving unified computing power.
[0044] However, this traditional approach 1 cannot normalize performance for non-CPU-intensive tasks. The main reason is that for non-CPU-intensive tasks, the allocated computing power of the CUs (Computer Units) meets the needs of these applications. The main performance bottleneck for non-CPU-intensive tasks is usually not the CPU, but other resources such as I / O, memory, and network resources. This means that even if CPU resources are scheduled and allocated through CU abstraction units, it is impossible to resolve the performance differences caused by these actual non-CPU-intensive resource bottlenecks.
[0045] Traditional Solution 2: This involves allocating more resources to low-performance virtual machines of fixed specifications by providing additional processor cores, enabling them to achieve the same computing power as high-performance machines. For example, in a cloud environment, a customer purchases a virtual machine instance with 4 CPU cores. To align the computing power of this 4-CPU instance on a 7th-generation machine with that on an 8th-generation machine, 6 processor cores can be actually allocated to the customer's virtual machine instance on the 7th-generation machine. From the customer's perspective, it still appears as a 4-CPU instance. This additional CPU resource improves and aligns the performance of the 4-CPU instance on the 7th-generation machine with that on the 8th-generation machine.
[0046] Therefore, by using the computing power of the highest-performing machine as a benchmark, all other relatively low-performing machines can allocate additional CPU cores to allocate different amounts of extra resources based on the difference between their own computing power and the benchmark computing power, and eventually align with the highest benchmark computing power, thus achieving computing power normalization for servers of different generations, models, and levels.
[0047] While this approach can improve the overall service performance of virtual machine instances, the normalization effect relies on instances fully utilizing their corresponding CPU resources. Therefore, it only works for instances performing CPU-intensive tasks. For instances performing non-CPU-intensive tasks, the normalization effect fails, and customers will still perceive performance differences. The main reason is that for non-CPU-intensive tasks, the allocated CPU resources are sufficient for the application's needs. The primary performance bottleneck for non-CPU-intensive tasks is usually not the CPU, but other resources such as I / O, memory, and network resources. This means that even allocating more CPU resources to instances on low-performance machines cannot overcome the performance differences caused by actual resource bottlenecks.
[0048] Traditional Solution 3: In Traditional Solution 3, it is assumed that the same application instances, such as virtual machine instances, are deployed on servers of machine type A and machine type B. One approach to align the performance of the better-performing machine type B with that of machine type A is to reduce the runtime of machine type B within the same period, which means reducing the time quota. Runtime refers to the processor time consumed by the service device to complete the load or task, which is equal to the sum of the processor time consumed by the multiple processor cores corresponding to the process executing the task.
[0049] As shown in Figure 1, the time quota for machine B can be reduced to ensure that the computing power of machine B is consistent with that of machine A. However, this requires the load to be a CPU-intensive load that can exhaust its allocated time quota during its operation, triggering the throttle mechanism on machine B. When the load's running time on machine B reaches the time quota, the processor usage of the load on machine B is restricted until the start of the next scheduling cycle, at which point scheduling of the load on machine B resumes. This ensures that machine B and machine A complete the same fraction of the workload within the same cycle.
[0050] For non-CPU-intensive workloads, the phenomenon shown in Figure 2 occurs. As shown in Figure 2, for machine type A and machine type B, the currently running workload can only consume a portion of the quota within the scheduling period. Therefore, within this scheduling period, the runtime of the current workload is less than the time limit (Quota). Consequently, the throttle mechanism will not be triggered on machine type A and machine type B within the current scheduling period, allowing machine type A and machine type B to continue executing other workloads, thus causing an imbalance in computing power between machine type A and machine type B. That is, for non-CPU-intensive workloads, the throttle mechanism will not be triggered on machine type B, which is equivalent to the resource scheduling of the workload on machine type B not being restricted. Within the same period, the number of workloads completed by machine type B will still be more than the number of workloads completed by machine type A, and the computing power normalization effect fails.
[0051] Traditional Solution 4: Addressing the issue in Traditional Solution 3 where non-CPU-intensive tasks don't trigger the throttle mechanism, leading to a computing power imbalance between machine A and machine B, another approach is to reduce the scheduling period. For example, as shown in Figure 3, reducing the scheduling period for processes on machine A and machine B to 50ms will cause the current workload to exceed the time limit (Quota) of 166ms on machine B. This will trigger the throttle mechanism on machine B, extending the task's runtime on machine B and thus aligning the computing power of machine B with that of machine A.
[0052] However, for a new task with a lower workload, the scheduling period needs to be further reduced to trigger the throttle mechanism. Setting the scheduling period shorter and shorter can also cause interference to the system. A short period will cause the scheduler to perform frequent context switching, increase the kernel scheduling load, reduce system performance, and violate the original intention of designing the scheduling period.
[0053] This disclosure provides a novel resource scheduling method to reduce the computing power difference between service devices, and even achieve computing power normalization among service devices. Specifically, in this disclosure, the target compensation time for the target process in the target scheduling period is determined by the historical running time of the target process in the historical scheduling period. The target compensation time is then paused between the target scheduling period and the next scheduling period, causing the target process to suspend the execution of the target task, thereby calibrating the running time of the target process in the target scheduling period. This extends the running time of the target task on the first service device, reducing the difference in running time caused by the computing power difference between the first and second service devices, thus reducing the computing power difference between the first and second service devices. It can even eliminate the difference in running time caused by the computing power difference between the first and second service devices, achieving the effect of computing power normalization.
[0054] It is worth noting that the descriptions of the aforementioned traditional schemes 1-4 merely briefly introduce the implementation principles and existing problems of traditional computing power normalization schemes, and do not represent that the embodiments of this disclosure aim to solve the problems existing in traditional schemes 1-4. The embodiments of this disclosure only provide a computing power normalization scheme different from the traditional schemes, and do not address the problems existing in traditional schemes 1-4.
[0055] The technical solutions provided by the embodiments of this disclosure are described in detail below with reference to the accompanying drawings.
[0056] It should be noted that the same reference numerals denote the same object in the following figures and embodiments. Therefore, once an object is defined in one figure or embodiment, it does not need to be discussed further in subsequent figures and embodiments.
[0057] Figure 4 is a schematic diagram of the structure of the cloud service system provided in this embodiment. As shown in Figure 4, the cloud service system includes multiple service devices S10 running the same application instances of the same specifications. A service device S10 can be a single server device, a cloud-based server array, or a virtual machine (VM) running within a cloud-based server array. Alternatively, a service device S10 can also refer to other computing devices with corresponding service capabilities, such as computers or other terminal devices (running service programs).
[0058] Application instances can be virtual machine instances, container instances, or database instances, but are not limited to these. The specifications of an application instance can be characterized by the amount of resources it consumes. In some embodiments, the specifications of an application instance can be represented by the number of virtual processor cores and memory size it occupies.
[0059] In this embodiment, some or all of the service devices S10 have different computing capabilities (i.e., computing power). For ease of description and distinction, in this embodiment, the service device with non-lowest computing power among the service devices S10 is defined as the first service device 10, and the service device with the lowest computing power among the service devices S10 is defined as the second service device 20. Therefore, the computing power of the first service device 10 is superior to that of the second service device 20. The first service device 10 can be any service device among the service devices S10 whose computing power is superior to that of the second service device 20. Specifically, the superior computing power of the first service device 10 means that when the first service device 10 and the second service device 20 complete the same load, the running time of the first service device 10 to complete the load is less than the running time of the second service device 20 to complete the same load.
[0060] The computing power of the first service device 10 and the second service device 20 differs, which could be due to differences in their machine models, or / or differences in their load levels. Specifically, the computing power of the first service device 10 is superior to that of the second service device 20. More specifically, the computing power of the first service device 10 may be superior to that of the second service device 20.
[0061] Because the computing power of the first service device 10 and the second service device 20 is different, the time taken for the same task of the same application instance of the same specification on the first service device 10 and the second service device 20 is different. This makes users of the application instance perceive that the performance of the same application instance of the same specification is different, which will undoubtedly cause dissatisfaction and doubts to the service provider of the application instance.
[0062] In order to reduce the computing power difference between the first service device and the second service device, this disclosure improves the traditional bandwidth control mechanism. The existing bandwidth control mechanism will be described below first.
[0063] As shown in Figure 5, in the traditional CFS bandwidth control mechanism, the default scheduling period is 100ms. For ease of description, we will use a time limit (Quota) set to 400ms as an example. Therefore, each scheduling period can be divided into four 100ms runtimes, provided for use by four virtual CPU (vCPU) cores. A vCPU core is a logical core; one physical core can be virtualized into one or more logical cores. "Multiple" refers to two or more (including two).
[0064] As shown in Figure 5, a new scheduling cycle begins after every 100ms. If the utilization of the four vCPUs remains at 100% in each scheduling cycle, the time quota allocated for that scheduling cycle will be exhausted. If the process group corresponding to the aforementioned four vCPUs exceeds the time quota in the current scheduling cycle, the process group will be restricted from scheduling, meaning that physical CPU resources will not be allocated to the process group until the start of the next scheduling cycle. The first service device 10 is model B, and the second service device 10 is model A. The accompanying figure illustrates the difference in computing power between the first and second service devices only as an example due to their different models, and does not constitute a limitation.
[0065] Assuming that the process groups in both the first and second service devices do not exceed their time quotas in each scheduling cycle, the first service device, with its superior computing power, will complete more load segments within the same period than the second service device (corresponding to device B in Figures 5 and 6), resulting in a computing power mismatch. For example, as shown in Figure 6, if a 400ms quota is allocated to a process group within a 100ms scheduling period, the service device A (the second service device) will complete 2 load segments, while the service device B (the first service device) will complete 2.3 load segments. Therefore, the time it takes for the service device B (the first service device) to complete one load segment is shorter than the time it takes for the service device A (the second service device) to complete one load segment. Consequently, the computing power of the service device B (the first service device) is superior to that of the service device A (the second service device).
[0066] In this embodiment of the disclosure, to reduce the computing power difference between the first service device and the second service device, the computing power of the first service device is aligned to that of the second service device. To achieve this, this embodiment of the disclosure introduces a runtime calibration mechanism to extend the runtime of the first service device executing application instance tasks. This resource scheduling method is applied to the first service device and can be executed by the first service device or by a separate resource scheduling device.
[0067] Figure 7 is a flowchart illustrating the resource scheduling method provided in this embodiment. This resource scheduling method is mainly used for resource scheduling among multiple service devices deploying the same application instance of the same specifications in a cloud service system, selecting the first service device with better computing power. The first service device is any service device in the cloud service system that, apart from the second service device with the lowest computing power, has a computing power superior to the first service device deploying the same application instance of the same specifications. As shown in Figure 7, the resource scheduling method mainly includes the following steps:
[0068] 701. For the currently completed target scheduling period, obtain the historical running time of the target process of the first service device in the historical scheduling period; the target process is the process that executes the target task of the application instance; the historical scheduling period includes the currently completed target scheduling period.
[0069] 702. Based on historical runtime, determine the target compensation time for the target process within the target scheduling cycle. The target compensation time is used to align the runtime of the target task executed by the first service device with that of the second service device.
[0070] 703. Suspend the target process to compensate for the target time.
[0071] 704. Start the next scheduling cycle of the target scheduling cycle to perform resource scheduling for the target process.
[0072] In this embodiment, a runtime calibration mechanism is introduced to extend the runtime of the application instance task executed by the first service device, thereby reducing the computing power difference between the first and second service devices and aligning the computing power of the first service device with that of the second service device. The main principle is to pause resource allocation for a period of time for the process executing the target task (defined as the target process) on the first service device during the execution of the application instance task (defined as the target task), thus extending the runtime of the first service device executing the target task.
[0073] Since it's impossible to determine which scheduling cycle is the last one for the task, it's not possible to uniformly extend the runtime in the last scheduling cycle. While it's impossible to predict how long the current load will consume in a new scheduling cycle, we do know how long the load consumed in completed historical scheduling cycles. Therefore, runtime compensation can be applied to completed historical scheduling cycles during the execution of the target task by the process on the first service device (defined as the target process), thereby extending the runtime of the first service device executing the target task and aligning it with the runtime of the second service device.
[0074] The processor time consumed by the target process of the first service device in executing the target task during a certain scheduling cycle is the running time of the target task executed by the first service device during that scheduling cycle. Furthermore, the processor time consumed by the target process of the first service device in executing the target task during a certain scheduling cycle is equal to the sum of the processor times consumed by the multiple virtual processor cores corresponding to the target process during that scheduling cycle.
[0075] In this embodiment of the disclosure, in order to determine the time length for compensating for historical scheduling cycles, when the target scheduling cycle for the target process of the first service device executing the target task is completed, the target scheduling cycle is taken as the historical scheduling cycle closest to the current time. Specifically, which scheduling cycle within the scheduling cycle for the target process of the first service device executing the target task is the target scheduling cycle is determined by the set runtime calibration strategy. The following explains which scheduling cycle is the target scheduling cycle based on several runtime calibration strategies.
[0076] Runtime calibration strategy 1: In some embodiments, the runtime calibration strategy is to calibrate the runtime of the currently completed scheduling cycle after each scheduling cycle is completed. Then the target scheduling cycle is any scheduling cycle in which the target process of the first service device executes the target task.
[0077] Runtime calibration strategy 2: In some embodiments, the runtime calibration strategy is to use the runtime of N historical scheduling cycles to calibrate the runtime of the currently completed scheduling cycle (also one historical scheduling cycle). The target scheduling cycle is any scheduling cycle other than the first (N-1) scheduling cycles in which the target process of the first service device executes the target task. N ≥ 2 and is an integer; its specific value can be flexibly set according to actual conditions.
[0078] Runtime calibration strategy 3: The runtime calibration strategy calibrates the runtime of the target process executing the target task every N scheduling cycles. The target scheduling cycle can be the N*i-th scheduling cycle in which the target process of the first service device executes the target task. i = 1, 2, 3… In this runtime calibration strategy, the runtime of the N historical scheduling cycles closest to the completion time of the N*i-th scheduling cycle can be used to calibrate the runtime of the N*i-th scheduling cycle. The N historical scheduling cycles closest to the completion time of the N*i-th scheduling cycle include the N*i-th scheduling cycle itself. Since the N*i-th scheduling cycle has been completed and its completion time is 0, it can be considered the closest historical scheduling cycle.
[0079] Based on the above runtime calibration strategy, it is known that calibrating the runtime of the currently completed target scheduling cycle requires obtaining the historical runtime of the target process of the first service device in the historical scheduling cycle. Therefore, in step 701, for the currently completed target scheduling cycle, the historical runtime of the target task executed by the first service device in the historical scheduling cycle can be obtained.
[0080] As can be seen from the aforementioned runtime calibration strategies 1-3, in runtime calibration strategy 1, the target scheduling period can be any scheduling period during which the target process of the first service device executes the target task. Correspondingly, the historical scheduling period is the target scheduling period itself.
[0081] In runtime calibration strategy 2, the target scheduling period is any scheduling period other than the first (N-1) scheduling periods in the scheduling period for the target process of the first service device to execute the target task. Correspondingly, the historical scheduling period is the N historical scheduling periods most recent to the current time, including the target scheduling period.
[0082] In runtime calibration strategy 3, the target scheduling period is the N*i-th scheduling period during which the target process of the first service device executes the target task. Correspondingly, the historical scheduling periods are the N most recent historical scheduling periods, including the target scheduling period (i.e., the N*i-th scheduling period).
[0083] The target scheduling period is also a historical scheduling period, mainly because when the historical running time of the target process in the historical scheduling period is obtained, the target scheduling period has already been completed, and the target scheduling period is already a historical scheduling period compared to the current time.
[0084] After obtaining the historical runtime of the target process in the historical scheduling period for the first service device, the runtime of the target scheduling period can be calibrated based on the historical runtime of the target process in the historical scheduling period. Specifically, in step 702, the target compensation time for the target process in the target scheduling period can be determined based on the historical runtime of the target process in the historical scheduling period. This target compensation time is used to calibrate the runtime of the target scheduling period so that the runtime of the first service device executing the target task is aligned with that of the second service device.
[0085] In this disclosure, the specific implementation of step 702 is not limited. In some embodiments, the running time of the target task executed by the second service device in the corresponding historical scheduling period can be obtained. Further, the time difference between the historical running time of the target process of the first service device in the historical scheduling period and the running time of the target task executed by the second service device in the corresponding historical scheduling period can be calculated as the target compensation time of the target process in the target scheduling period. Since the target compensation time is based on the time difference between the historical running time of the target process of the first service device in the historical scheduling period and the running time of the target task executed by the second service device in the corresponding historical scheduling period, calibrating the running time of the target scheduling period using this target compensation time can bring the running time of the target process of the first service device closer to or even align with the running time of the second service device, reducing the computing power difference between the two, and even achieving computing power normalization between the two.
[0086] In other embodiments, the runtime of the target process varies under different processor load levels. The processor load level can be characterized by processor utilization, which represents the proportion of processor resources used by the target process relative to the total processor resources allocated to it. Therefore, combining the processor utilization of the target process in historical scheduling cycles allows for a more accurate determination of the target compensation time for the target process in the target scheduling cycle. Based on this, step 702 can be implemented as follows: determining the historical processor utilization of the target process in the historical scheduling cycle based on its historical runtime and time limit. Specifically, the percentage of the historical runtime of the target process in the historical scheduling cycle relative to its time limit can be used as the historical processor utilization of the target process in the historical scheduling cycle. Furthermore, the target compensation time for the target process in the target scheduling cycle can be determined based on the historical processor utilization of the target process in the historical scheduling cycle.
[0087] In some embodiments, the correspondence between processor utilization and time compensation factors can be pre-configured. The time compensation factor is a parameter used to determine the compensation time, and can be a time length or a proportional value, such as a percentage value. In this embodiment, the time compensation factor in the correspondence is pre-determined based on the difference between the runtime of the first service device and the runtime of the second service device when the first service device performs the same task under various processor utilization levels. "Various" refers to two or more (including two), generally more than two.
[0088] Specifically, a first service device can be pre-programmed to perform the same task as a second service device under various processor utilization rates, and the runtime of both the first and second service devices can be monitored. Then, the time difference between the runtimes of the first and second service devices under various processor utilization rates can be calculated. Further, a time compensation factor corresponding to the first service device under various processor utilization rates can be determined based on the time difference between the runtimes of the first and second service devices performing the same task under various processor utilization rates. Specifically, for any processor utilization rate X, the time difference D between the runtimes of the first and second service devices performing the same task under processor utilization rate X can be calculated as the time compensation factor for the first service device under processor utilization rate X. Alternatively, the percentage of the runtime difference D between the first and second service devices performing the same task under processor utilization rate X to the runtime of the first service device performing the task under processor utilization rate X can be calculated as the time compensation factor for the first service device under processor utilization rate X.
[0089] Specifically, the time difference D between the execution time of the first service device and the second service device performing the same task at processor utilization X is used as a percentage of the execution time of the first service device at processor utilization X when performing the same task. This serves as the time compensation factor for the first service device at processor utilization X, resulting in a relatively stable time compensation factor. Because the percentage is a relative value, it is not affected by the absolute time length. Even if the absolute execution time of the task changes, the time compensation factor remains effective as long as the proportional relationship remains unchanged.
[0090] Furthermore, the correspondence between various processor utilization rates and time compensation factors can be determined based on the time compensation factors corresponding to the first service device under various processor utilization rates.
[0091] In practical use, the time compensation factors corresponding to processor utilization rates in certain ranges are the same or similar. If a time compensation factor is stored for each processor utilization rate, it will consume a lot of storage resources. To reduce the storage resources occupied by the aforementioned correspondence, multiple processor utilization ranges and their corresponding time compensation factors can be determined based on the time compensation factors corresponding to the first service device under multiple processor utilization rates. This serves as the correspondence between the aforementioned processor utilization rates and time compensation factors.
[0092] Specifically, based on the time compensation factors corresponding to the first service device under various processor utilization rates, the multiple processor utilization rates can be divided into several processor utilization rate ranges. Specifically, processor utilization rates where the error between corresponding time compensation factors is within a preset error range can be grouped into the same processor utilization rate range to obtain multiple processor utilization rate ranges. Further, the maximum, minimum, median, or average value of the time compensation factors corresponding to each processor utilization rate within each processor utilization rate range is used as the time compensation factor corresponding to that processor utilization rate range.
[0093] In this embodiment, the storage format of the correspondence between processor utilization and time compensation factor in the first service device is not limited. Since the correspondence between processor utilization and time compensation factor is used to assist in calibrating the runtime of the target process and can be applied to the resource scheduling of the target process, the correspondence between processor utilization and time compensation factor can be stored in the process group restriction directory in the first service device. The process group restriction directory is used to store some restriction information of process groups in the first service device. Accordingly, a parameter field corresponding to the time compensation factor of the processor's runtime, such as a "cpu.runtime_tuning_factors" field, can be added to the process group restriction directory, and the correspondence between processor utilization and time compensation factor can be written as the value of this field.
[0094] The process group restriction directory can be " / sys / fs / cgroup / subcgroup". " / sys / fs / " is a special directory in the Linux file system used to store kernel information and configuration items related to the file system. " / sys / fs / cgroup / " is the directory used to configure and manage resource control groups (Cgroups).
[0095] Cgroups are a feature provided by the Linux kernel for limiting and isolating the resource usage of process groups. Cgroups provide a mechanism to organize a group of processes together and set resource limits for them, such as CPU time, memory usage, and disk I / O.
[0096] " / sys / fs / cgroup / subcgroup" is a subdirectory containing multiple subsystems used to organize and manage specific process groups.
[0097] In some embodiments, the correspondence between processor utilization and time compensation factors can be stored in the process group restriction directory of the first service device in the form of tuples. A tuple includes multiple processor utilization ranges and their corresponding time compensation factors. A tuple refers to a binary tuple or more. Each element in the tuple corresponds to a processor utilization range. In some embodiments, the tuple is a quintuple, and the corresponding processor utilization ranges can be (0%, 20%), (20%, 40%), (40%, 70%), (70%, 80%), and (80%, 100%), etc. Each processor utilization range corresponds to a time compensation factor. Storing the correspondence between processor utilization and time compensation factors in the process group restriction directory of the first service device in the form of tuples facilitates retrieval by the resource scheduling process of the process group.
[0098] Based on the preset correspondence between processor utilization and time compensation factors, when determining the target compensation time for a target process in a target scheduling period according to its historical processor utilization in the historical scheduling period, the target time compensation factor corresponding to the historical processor utilization in the historical scheduling period can be determined based on the historical processor utilization of the target process in the historical scheduling period and the preset correspondence between processor utilization and time compensation factors. Furthermore, the target compensation time can be determined based on the target time compensation factor. Since the time compensation factor in the correspondence between processor utilization and time compensation factors is determined based on the time difference between the running time of the first service device and the second service device performing the same task under various processor utilization levels, the target compensation time determined based on the target time compensation factor corresponding to the historical processor utilization in this correspondence can align the running time of the first service device in the historical scheduling period with that of the second service device when calibrating the running time of the target scheduling period. This helps reduce the computing power difference between the two and may even achieve computing power normalization.
[0099] In some embodiments, the time compensation factor in the correspondence between processor utilization and time compensation factor is the time difference between the running time of the first service device and the second service device performing the same task under processor utilization X. In this case, the target time compensation factor can be directly used as the target compensation time.
[0100] In other embodiments, the time compensation factor in the correspondence between processor utilization and time compensation factor is the percentage of the time difference D between the running time of the first service device and the second service device executing the same task under processor utilization X, which is the running time of the first service device executing the task under processor utilization X. The target compensation time can be determined based on the historical running time of the target process in the historical scheduling cycle and the target time compensation factor.
[0101] In some embodiments, if the runtime calibration strategy is the aforementioned runtime calibration strategy 1, then the product of the historical runtime corresponding to the target scheduling period and the target time compensation factor can be used as the target compensation time. The calculation formula can be expressed as:
[0102] In this formula, i represents the i-th tuple in the tuple; p i and q i These represent the upper and lower limits of the processor utilization range corresponding to the i-th tuple, respectively. `runtime` represents the historical execution time of a historical scheduling cycle (such as the target scheduling cycle). This represents the time compensation factor expressed as a percentage, which is the time compensation factor corresponding to the i-th tuple. The target compensation time for the target scheduling cycle is when the processor utilization of the target process falls within the processor utilization range corresponding to the i-th tuple.
[0103] For example, assuming the tuple is a quintuple, the corresponding processor utilization ranges can be (0%, 20%), (20%, 40%), (40%, 70%), (70%, 80%), and (80%, 100%). Then, the formula for calculating the target compensation time for the target scheduling cycle is:
[0104] Assuming the target process's scheduling period is 100ms, the time limit is 400ms, and the target process's runtime within the target scheduling period is 200ms, then the processor utilization is 50%. Therefore, the value corresponding to runtime_tuning_factors[2] can be used as the target time compensation factor. Accordingly, the target compensation time corresponding to the target scheduling period is:
[0105] If the target process runs for 100ms in the target scheduling period, the processor utilization is 25%. Therefore, the target time compensation factor [1] can be used. Accordingly, the target compensation time corresponding to the target scheduling period is:
[0106] In other embodiments, the runtime calibration strategy is either runtime calibration strategy 2 or runtime calibration strategy 3, and the historical scheduling periods are the N historical scheduling periods closest to the current time. Accordingly, the target time compensation factor for each of these N historical scheduling periods can be determined based on the processor utilization corresponding to each of these N historical scheduling periods and the aforementioned correspondence between processor utilization and time compensation factor. Further, the compensation time for each of these N historical scheduling periods can be determined based on the historical runtime and the target time compensation factor for each of these N historical scheduling periods. Specifically, for any historical scheduling period X among the N historical scheduling periods, the product of the historical runtime and the target time compensation factor for historical scheduling period X can be used as the compensation time for historical scheduling period X.
[0107] Furthermore, the target compensation time can be determined based on the compensation times corresponding to each of these N historical scheduling cycles. Optionally, the sum of the compensation times corresponding to each of the N historical scheduling cycles can be calculated as the target compensation time. Alternatively, the target compensation time can be obtained by weighted summing the compensation times corresponding to each of the N historical scheduling cycles according to their respective weights; where the weight of the historical scheduling cycle more recent than the current time is greater.
[0108] Since the load conditions of historical scheduling periods closer to the current time are generally closer to the current load of the target process, assigning greater weight to historical scheduling periods closer to the current time increases their contribution to determining the target compensation time. This makes the determined target compensation time more closely reflect the current actual needs and more accurate.
[0109] After determining the target compensation time for calibrating the runtime of the target scheduling cycle, in step 703, the target process can be paused for the target compensation time, causing the target process to suspend processing the target task. The pause time for the target process to suspend processing the target task is the target compensation time. Because the target process is paused, it cannot process the target task during the pause period, effectively extending the runtime of the target process during the target scheduling cycle by the target compensation time.
[0110] In this disclosure, the specific implementation of pausing the target process for compensation time is not limited. In some embodiments, the aforementioned CFS strategy can be used for resource scheduling of the target process. Specifically, the processor time corresponding to each of the multiple virtual processor cores corresponding to the target process can be determined according to the time quota corresponding to the target process; then, according to the processor time corresponding to each of the multiple virtual processor cores, physical processors with corresponding time are allocated to the multiple virtual processor cores, so that the target process uses the physical processor to execute the target task during the allocated processor time. After the target process has consumed the allocated processor time, the physical processor is allocated to other processes.
[0111] Based on the resource scheduling method described above, resource scheduling for the target process can be paused until the pause time reaches the target compensation time, thus pausing the target process for the target compensation time. Specifically, pausing resource scheduling for the target process means pausing the allocation of processor time and physical processors to the target process. If the target process is not allocated physical processor resources within the target compensation time, it cannot execute its target task during that time, effectively extending the target process's runtime within the target scheduling period to the target compensation time.
[0112] In other embodiments, the first service device may be put into a sleep state for the target compensation time, thereby suspending the target process in the first service device for the target compensation time. During the suspension period, the target process cannot process the target task, which is equivalent to extending the runtime of the target process during the target scheduling cycle by the target compensation time.
[0113] After the pause time reaches the target compensation time, in step 704, the next scheduling cycle of the target scheduling cycle can be started to schedule resources for the target process. Specifically, the next scheduling cycle of the target scheduling cycle can be started to allocate processor time to the target process, and a physical processor can be allocated to the target process within the allocated processor time. In this way, the target process can use the physical processor to execute the target task within the allocated processor time. Thus, in the aforementioned runtime calibration strategy 1, it is equivalent to the scheduling cycle of the first service device becoming the original scheduling cycle plus the target compensation time.
[0114] As shown in Figure 8, assuming machine type A represents the second service device and machine type B represents the first service device, and assuming the scheduling period for both machine types A and B is 100ms, the number of vCPUs allocated to the process is 4, and the time quota corresponding to the target process is 400ms. The second service device, represented by machine type A, continues to schedule resources for the process handling the target task according to the original scheduling period of 100ms. After the original scheduling period of 100ms is completed, the first service device, represented by machine type B, pauses the target compensation time before entering the next 100ms scheduling period. This is equivalent to extending the target compensation time of the first service device on top of its original running time to align with the running time of the second service device, represented by machine type A, in executing the target task. Figure 8 only illustrates the target scheduling period as described in the aforementioned running time calibration strategy 1, but this is not intended to be limiting.
[0115] In this embodiment, the target compensation time for the target process in the target scheduling period is determined by the historical running time of the target process in the historical scheduling period. The target compensation time is then calibrated by pausing resource scheduling of the target process between the target scheduling period and its next scheduling period. This extends the running time of the target task on the first service device, reducing the difference in running time caused by the difference in computing power between the first and second service devices, thus reducing the computing power difference between the two devices. It can even eliminate the difference in running time caused by the difference in computing power between the first and second service devices, achieving the effect of computing power normalization.
[0116] On the other hand, the embodiments of this disclosure calibrate the running time of the target process in the target scheduling period by pausing the resource scheduling of the target process for a target compensation time between the target scheduling period and its next scheduling period, regardless of whether the target task is processor-intensive (such as CPU) resource-intensive. Even for tasks that do not consume processor resources (such as CPU), it can reduce the running time difference between devices due to differences in computing power, thereby reducing the difference in computing power between devices, and even achieving a computing power normalization effect.
[0117] For example, as shown in Figure 9, taking a scheduling period of 100ms, 4 vCPUs allocated to the target process, and a time quota of 400ms for the target process as an example, a non-processor (such as CPU) resource-consuming target task does not consume its time quota within a scheduling period. Assuming that the target task on a machine with better computing power (model B) runs for 50% of its time quota (200ms) within the scheduling period, after the target scheduling period is completed, the runtime calibration method provided in this embodiment can still be used to determine the target compensation time for the target scheduling period (50ms in Figure 9). Instead of directly entering the next scheduling period, the target compensation time is paused before entering the next scheduling period to schedule resources for the target process. This can still reduce the runtime difference caused by computing power differences between devices, achieving the effect of reducing computing power differences between devices, and even achieving computing power normalization.
[0118] This embodiment does not change the scheduling period and time quota of the target process; therefore, the execution restriction strategy remains effective within each scheduling period. Specifically, for any scheduling period Y in which the target process executes the target task, if the execution time of the target process exceeds its time quota within scheduling period Y, resource scheduling for the target process can be stopped until the next scheduling period Y arrives, at which point resource scheduling for the target process is restarted. This ensures the fairness of resource allocation, prevents a process or process group from excessively consuming processor resources, ensures that other processes in the system also receive sufficient processor time, and ensures that each process group is fairly allocated processor resources according to a predetermined share (i.e., time quota), avoiding a single process monopolizing too many resources and affecting the normal operation of other processes.
[0119] The advantages of the resource scheduling method that enables computing power alignment or computing power normalization provided in the embodiments of this disclosure compared with the aforementioned traditional solutions 1-4 are explained below.
[0120] In traditional solution 1, the high degree of resource abstraction can lead to resource fragmentation due to different types of tasks, resulting in resource waste. For example, some tasks heavily reliant on high computing power may not be able to fully utilize other computing resources. The main reason is that different tasks have different computing resource requirements; some tasks may require a large amount of computing power, while others may only require a small amount. When using a uniform CU as the scheduling unit, if the size of the CU is not suitable for the needs of some tasks, it will lead to resource waste. If a task only requires a small portion of computing power, and the CU allocated to it exceeds its actual needs, the remaining computing power cannot be effectively utilized, resulting in resource fragmentation and waste.
[0121] The solution provided in this disclosure allocates processor time based on the scheduling period and time quota of the target process. It can perform resource scheduling through the CFS strategy, so that each process can obtain relatively balanced resource usage and reduce resource waste.
[0122] Traditional approach 1, by normalizing different types of computing resources, may increase system complexity, especially when resource supply and demand are mismatched, making resource management and monitoring more difficult. The solution provided in this disclosure uses existing CFS (Computer-Solved-Flight) strategies for resource scheduling, reducing resource management complexity.
[0123] Traditional solution 1 lacks fine-grained control. In some embodiments of this disclosure, precise control at the granularity level of scheduling period and time limit is achieved, which can refine the granularity of resource scheduling.
[0124] The computing power normalization effect of traditional schemes 1, 2 and 3 is ineffective for non-CPU-intensive tasks, while the scheme provided by the present disclosure still has a good computing power normalization effect for non-CPU-intensive tasks. For detailed analysis, please refer to the relevant content of the foregoing embodiments.
[0125] Furthermore, conventional solution 2 allocates additional processor cores to application instances deployed on service devices with lower computing power, allowing some cores on the service device to be used for computing power compensation, thus reducing the total number of deployable instances and consequently lowering the application instance deployment density. The solution provided in this disclosure allocates processor resources based on the resource requests of application instances, eliminating the need to allocate additional processor cores to low-computing-power devices for computing power compensation, and therefore having no impact on the application instance deployment density.
[0126] In the traditional scheme 4, shortening the scheduling cycle leads to frequent context switching by the scheduler, increasing the kernel scheduling load. The scheme provided in this disclosure is equivalent to extending the scheduling cycle, increasing the time interval between context switching by the scheduler, which reduces the kernel scheduling load compared to the traditional scheme 4.
[0127] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 701 and 702 can be device A; or the execution subject of step 701 can be device A, and the execution subject of step 702 can be device B; and so on.
[0128] Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 701, 702, etc., are merely used to distinguish different operations and do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel.
[0129] Accordingly, embodiments of this disclosure also provide a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause one or more processors to perform the steps in the resource scheduling method described above.
[0130] This disclosure also provides a computer program product, including a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps in the resource scheduling method described above. In this disclosure, the specific implementation of the computer program product is not limited. In some embodiments, the computer program product may be implemented as an application (APP), a mini-program, a PC client, a program module, a plug-in, an installation package, a software development kit (SDK), an optical disc image file (such as an ISO file), a plug-in, or software in the form of Software as a Service (SaaS), etc., but is not limited thereto.
[0131] Figure 10 is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. As shown in Figure 10, the electronic device includes a memory 100a and a processor 100b. The memory 100a is used to store computer programs.
[0132] Processor 100b is coupled to memory 100a and is used to execute computer programs to perform the steps in the resource scheduling methods provided in the foregoing embodiments. Specific implementation details of each step can be found in the relevant descriptions of the foregoing embodiments, and will not be repeated here.
[0133] In some alternative embodiments, as shown in FIG10, the electronic device may further include optional components such as a communication component 100c, a power supply component 100d, a display component 100e, and an audio component 100f. FIG10 only schematically shows some components and does not mean that the electronic device must include all the components shown in FIG10, nor does it mean that the electronic device can only include the components shown in FIG10.
[0134] Furthermore, the components within the dashed boxes in Figure 10 are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a desktop computer, laptop computer, mobile phone, or IoT device; it can also be a traditional server, cloud server, or server cluster, or other server equipment.
[0135] In embodiments of this disclosure, the memory is used to store computer programs and can be configured to store various other data to support operation on its host device. The processor can execute the computer programs stored in the memory to implement corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Electrically Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0136] In this embodiment of the disclosure, the processor can be any hardware processing device capable of executing the above-described method logic. Optionally, the processor can be a central processing unit (CPU), a graphics processing unit (GPU), or a microcontroller unit (MCU); it can also be a programmable device such as a field-programmable gate array (FPGA), a programmable array logic (PAL), a general array logic (GAL), or a complex programmable logic device (CPLD); or it can be an advanced RISC machine (ARM) or a system on chip (SoC), etc., but is not limited thereto.
[0137] In embodiments of this disclosure, the communication component is configured to facilitate wired or wireless communication between its host device and other devices. The device housing the communication component can access wireless networks based on communication standards, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In another exemplary embodiment, the communication component may also be implemented based on Near Field Communication (NFC), Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), or other technologies.
[0138] In embodiments of this disclosure, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touchscreen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0139] In embodiments of this disclosure, a power supply component is configured to provide power to various components of the device in which it resides. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component resides.
[0140] In embodiments of this disclosure, the audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals. For example, in devices with voice interaction capabilities, voice interaction with a user can be achieved through the audio component.
[0141] It should be noted that the terms "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent a chronological order, nor do they limit "first" and "second" to different types.
[0142] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.
[0143] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0144] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0145] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0146] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.
[0147] Memory may include non-persistent storage in computer-readable media, such as random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0148] Computer storage media are readable storage media, also known as removable media. Removable and non-removable media can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient media, such as modulated data signals and carrier waves.
[0149] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the aforementioned element.
[0150] The above description is merely an embodiment of this disclosure and is not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.
Claims
1. A resource scheduling method, wherein, The first service equipment and the second service equipment have application examples with the same specifications; The computing power of the first service device is superior to that of the second service device; the method includes: For the currently completed target scheduling period, obtain the historical running time of the target process of the first service device in the historical scheduling period; the target process is the process that executes the target task of the application instance; the historical scheduling period includes the target scheduling period; Based on the historical running time, the target compensation time for the target process in the target scheduling period is determined; the target compensation time is used to align the running time of the first service device executing the target task with that of the second service device. The target process is paused for the target compensation time; Initiate the next scheduling cycle of the target scheduling cycle to perform resource scheduling for the target process.
2. The method according to claim 1, wherein, Determining the target compensation time for the target process in the target scheduling period based on the historical running time includes: Based on the historical running time and the time limit of the target process, determine the historical processor utilization rate of the target process in the historical scheduling cycle; The target compensation time is determined based on the historical processor utilization.
3. The method according to claim 2, wherein, Determining the target compensation time based on the historical processor utilization includes: Based on the historical processor utilization and the preset correspondence between processor utilization and time compensation factor, determine the target time compensation factor corresponding to the historical processor utilization in the correspondence. The target compensation time is determined based on the target time compensation factor; The time compensation factor in the correspondence is determined based on the time difference between the running time of the first service device and the running time of the second service device when the first service device performs the same task under various processor utilization rates.
4. The method according to claim 3, wherein, Determining the target compensation time based on the target time compensation factor includes: The target compensation time is determined based on the historical running time and the target time compensation factor.
5. The method according to claim 4, wherein, The historical scheduling period is the target scheduling period; the target scheduling period is any scheduling period in which the target process executes the target task. The step of determining the target compensation time based on the historical running time and the target time compensation factor includes: The target compensation time is the product of the historical running time corresponding to the target scheduling period and the target time compensation factor.
6. The method according to claim 4, wherein, The historical scheduling period refers to the N historical scheduling periods most recent to the current time, where N ≥ 2 and is an integer; The target scheduling period is the scheduling period excluding the first (N-1) scheduling periods in the scheduling period of the target process executing the target task, or the target scheduling period is the N*ith scheduling period in the scheduling period of the target process executing the target task, where i = 1, 2, 3, .... The step of determining the target time compensation factor corresponding to the historical processor utilization in the corresponding relationship based on the historical processor utilization and the preset correspondence between processor utilization and time compensation factor includes: Based on the historical processor utilization rates corresponding to the N historical scheduling cycles and the corresponding relationship, the target time compensation factor corresponding to each of the N historical scheduling cycles in the corresponding relationship is determined. The step of determining the target compensation time based on the historical running time and the target time compensation factor includes: Based on the historical running time corresponding to each of the N historical scheduling cycles and the target time compensation factor corresponding to each of the N historical scheduling cycles, the compensation time corresponding to each of the N historical scheduling cycles is determined. The target compensation time is determined based on the compensation time corresponding to each of the N historical scheduling cycles.
7. The method according to claim 6, wherein, The step of determining the target compensation time based on the compensation time corresponding to each of the N historical scheduling periods includes: Based on the weights corresponding to the N historical scheduling cycles, the compensation times corresponding to the N historical scheduling cycles are weighted and summed to obtain the target compensation time; wherein the weight of the historical scheduling cycle that is closer to the current time is greater.
8. The method according to any one of claims 3-7, wherein, Also includes: Based on the time difference between the execution time of the first service device and the second service device performing the same task under various processor utilization rates, the time compensation factor corresponding to the first service device under various processor utilization rates is determined. Based on the time compensation factors corresponding to the first service device under various processor utilization rates, determine the various processor utilization rate ranges and the time compensation factors corresponding to each of the various processor utilization rate ranges, as the correspondence relationship; The corresponding relationships are stored in the process group restriction directory of the first service device in the form of tuples.
9. The method according to claim 8, characterized in that, The process group restriction directory is the Cgroup directory; the processor utilization range defined in the tuple includes low utilization range, medium utilization range and high utilization range.
10. The method according to any one of claims 1-9, wherein, The step of pausing the target process for the target compensation time includes: Resource scheduling for the target process is suspended until the suspension time reaches the target compensation time, so that the target process is suspended for the target compensation time.
11. The method according to any one of claims 1-10, wherein, Also includes: For any scheduling cycle in which the target process executes the target task, if the running time of the target process in any scheduling cycle reaches the time limit of the target process, then resource scheduling for the target process is stopped until the next scheduling cycle of any scheduling cycle arrives, at which point resource scheduling for the target process is restarted.
12. The method according to any one of claims 1-11, wherein, The first service device and the second service device are of different models, and the computing power of the first service device is superior to that of the second service device.
13. The method according to any one of claims 1-12, characterized in that, For non-CPU-intensive target tasks, by pausing the target compensation time, the running time of the first service device to complete the target task is aligned with that of the second service device.
14. The method according to any one of claims 1-13, characterized in that, The determination of the target compensation time does not depend on whether the target process has consumed its time limit within the target scheduling period.
15. The method according to any one of claims 1-14, characterized in that, The method does not change the setting values of the scheduling cycle and time limit of the target process.
16. The method according to any one of claims 1-15, characterized in that, The target process is paused for compensation time, which occurs within the time interval after the end of the target scheduling cycle and before the start of its next scheduling cycle.
17. The method according to any one of claims 1-17, characterized in that, The method aligns computing power by extending the execution time of the target task by the first service device. Compared with the traditional approach of triggering a limiting mechanism by shortening the scheduling cycle, it reduces the kernel load caused by frequent context switching of the scheduler.
18. An electronic device, wherein, include: A memory and a processor; wherein the memory is used to store computer programs; The processor is coupled to the memory for executing the computer program to perform the steps of the method according to any one of claims 1-17.
19. A computer-readable storage medium storing computer instructions, wherein, When the computer instructions are executed by one or more processors, the one or more processors are caused to perform the steps of the method according to any one of claims 1-17.
20. A computer program product, wherein, Includes a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps of the method according to any one of claims 1-17.