Resource scheduling method and device, storage medium and program product
By using the historical running time of the target process in the cloud service system to determine the compensation time and calibrate the running time of the target process, the problem of differences in computing power between servers of different generations is solved, computing power is normalized, and user experience is improved Consistent with bills.
Patent Information
- Application Number
- CN202411577549.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-11-05
AI Technical Summary
There are performance differences in servers of different generations of models in cloud service systems, resulting in inconsistent performance when the instances of the same specifications run on different models, affecting the user experience and may cause inconsistent bills.
By determining the target compensation time based on the historical running time of the target process's historical scheduling cycle, and pausing the target compensation time between the target scheduling cycle and its next scheduling cycle, the running time of the target process is calibrated to achieve different computing powers. The computing power between service equipment is normalized.
Extend the running time of the target task in a stronger computing power equipment, reduce the running time difference caused by computing power differences, achieve the effect of reducing computing power differences, and even realize the normalization of computing power.
Smart Images

Figure CN119088574A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource scheduling method, device, storage medium and program product. Background Art
[0002] There are various servers with different computing powers in the cloud service system. Customers who purchase several instances of the same specifications may run them on servers with different computing powers. Because there are performance differences between different generations of models, even if the instance specifications are the same, there are differences in service performance between different models. This results in performance differences even when running the same workload on instances of the same specifications, resulting in the same workload taking only 30 minutes to run on the 8th generation model, but 40 minutes to run on the 6th and 7th generation models. This difference will not only affect the user experience, but may also lead to inconsistent bills, causing customers to question, complain or even complain. Therefore, how to shield the differences between different generations of models through technical means and maintain the relative stability of server computing power of different generations of models has become a technical issue that technicians in this field need to continue to pay attention to. Summary of the invention
[0003] Multiple aspects of the present application provide a resource scheduling method, device, storage medium and program product to reduce the computing power differences of service devices with different computing powers, and even achieve computing power normalization of service devices with different computing powers.
[0004] The embodiment of the present application provides a resource scheduling method, wherein a first service device and a second service device run application instances of the same specification; the computing power of the first service device is better than that of the second service device; the method comprises: For the currently completed target scheduling cycle, obtaining the historical running time of the target process of the first service device in the historical scheduling cycle; the target process is the process that executes the target task of the application instance; the historical scheduling cycle includes the target scheduling cycle; Determine, according to the historical running time, a target compensation time of the target process in the target scheduling period; 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; Pausing the target process for the target compensation time; The next scheduling cycle of the target scheduling cycle is started to perform resource scheduling for the target process.
[0005] The embodiment of the present application further provides an electronic device, comprising: a memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps in the aforementioned resource scheduling method.
[0006] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the aforementioned resource scheduling method.
[0007] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps in the aforementioned resource scheduling method.
[0008] In an embodiment of the present application, the target compensation time of the target process in the target scheduling cycle is determined by the historical running time of the target process in the historical scheduling cycle, and the target process is suspended for the target compensation time between the target scheduling cycle and its next scheduling cycle, so that the target process suspends the execution of the target task, thereby realizing the calibration of the running time of the target process in the target scheduling cycle. In this way, the running time of the target task in the first service device can be extended, and the difference in the running time of the target task caused by the difference in computing power between the first service device and the second service device can be reduced, thereby achieving the effect of reducing the difference in computing power between the first service device and the second service device. It is even possible to eliminate the difference in the running time of the target task caused by the difference in computing power between the first service device and the second service device, thereby achieving the effect of computing power normalization. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 This is a schematic diagram of the principle of the traditional computing power normalization solution; Figure 2 for Figure 1 Schematic diagram of the problems with the provided computing power normalization solution; Figure 3 This is a schematic diagram of the principle of another traditional computing power normalization solution; Figure 4 A schematic diagram of the structure of the cloud service system provided in the embodiment of the present application; Figure 5 A schematic diagram of the resource scheduling process of the CFS policy provided in the embodiment of the present application; Figure 6 A schematic diagram of the difference in computing power of service devices with different computing power provided in an embodiment of the present application; Figure 7 A schematic diagram of a resource scheduling method according to an embodiment of the present invention; Figure 8 A schematic diagram of the principle of the resource scheduling method provided in the embodiment of the present application; Fig. 9 A schematic diagram of the effect of the resource scheduling method provided in an embodiment of the present application on non-processor consuming tasks; Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0010] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0011] 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, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0012] The concepts or terms involved in the embodiments of the present application are first explained below.
[0013] Completely Fair Scheduler (CFS) policy: CFS policy is a scheduling algorithm in Linux system, which is used to manage the allocation of processor resources. A virtual runtime (vruntime) is maintained for each scheduling entity in CFS policy, and vruntime is calculated by weight so that each process can obtain relatively balanced resource usage.
[0014] Run time: The processor time consumed by a service device or process group to complete a load or task.
[0015] Sched Entity: The operation object of CFS policy. Sched Entity can correspond to a task or a group of tasks.
[0016] 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 on several processor cores.
[0017] CFS Bandwidth Control: CFS bandwidth control is a function of the Completely Fair Scheduler (CFS) in the Linux kernel, which aims 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 the scheduling period (Period) and time quota (Quota) to support various load balancing and resource management requirements.
[0018] Scheduling period (Period): A time period of a given length. Each process group allocates processor resources during this time period. This scheduling period will continue to cycle.
[0019] Time quota (Quota), the maximum amount of processor time a process group can use in a scheduling cycle. Once the processor usage time of a process group in the current cycle exceeds this quota (Quota), it will be restricted from scheduling until the next cycle begins.
[0020] Throttle: When the processor time used by a process group in a specific cycle exceeds the set time limit (Quota), the system will "throttle" the process group and restrict its further use of the processor until the next cycle begins. This mechanism is implemented by suspending the scheduling of the process group.
[0021] Normalization of computing power: Through software means, the computing power performance of servers of different generations, different models, and different load levels can be kept stable and similar, so that the computing power of different models can be normalized.
[0022] CPU-consuming tasks and non-CPU-consuming tasks: CPU-consuming tasks and non-CPU-consuming tasks are classified according to the degree to which applications rely on CPU resources during operation. These two types of applications have significant differences in resource requirements, performance bottlenecks, and optimization directions.
[0023] Among them, CPU-consuming tasks refer to applications or services that require a lot of CPU computing power during operation. The characteristic of this type of application is that its performance is mainly limited by the processing power of the CPU, and usually involves a large number of computing tasks. Generally, it has the following characteristics: (1) Computational intensive: the application logic contains a large number of computing operations, such as numerical calculations, scientific computing, image processing, etc.; (2) High algorithm complexity: may involve complex algorithms, such as sorting, searching, recursion, etc.; (3) Parallel processing: computing can often be accelerated 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.
[0024] Non-CPU intensive tasks refer to tasks that have relatively little reliance on the CPU during operation, and performance bottlenecks mainly occur in other resources. Such applications may rely more on factors such as input / output (I / O), memory, and network. 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, file reading and writing, etc.; (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 involves a lot of waiting time, such as waiting for database responses, waiting for external services to return results, etc.
[0025] Before introducing the solution provided by the embodiment of the present application, a brief introduction to the traditional computing power normalization solution is first given.
[0026] Traditional solution 1: Abstract different types of CPUs to achieve normalized computing power (Normalized CPU units). Although the purpose of the solution is similar, the specific design ideas and implementation solutions are different from this solution.
[0027] The idea of this solution is to unify heterogeneous computing resources such as CPUs of different types and generations into an abstract computing unit (CU) in terms of resource management and scheduling. CU is a layer of computing power abstract unit located above the physical CPU level. The allocation and scheduling of computing power are based on this abstract computing unit. When a user needs computing power, he applies for a number of CUs from the resource management system in units of CUs. For example, if a customer applies for 8 CU computing power, the resource management system will schedule physical CPU resources to meet the computing power requirements of these 8 CUs, without having to worry about what type of CPU or how many CPUs are scheduled at the lower level. The computing power of each CU is the same, which shields the performance differences of the underlying CPUs, thereby achieving unified computing power.
[0028] However, this traditional solution 1 cannot normalize non-CPU-consuming tasks. The main reason is that for non-CPU-consuming tasks, the computing power of the allocated CU meets the needs of such applications. The main performance bottleneck of non-CPU-consuming tasks is usually not the CPU, but other resources, such as I / O, memory, and network resources. This means that even if the CPU resources are scheduled and allocated through the CU abstract unit, the performance differences caused by these non-CPU-consuming actual resource bottlenecks cannot be resolved.
[0029] Traditional solution 2: Super-resolution resources are provided to low-performance models with fixed specifications through the mechanism of sending processor cores, so that low-performance models with the same specifications have the same computing power as high-performance models. For example, in a cloud environment, a customer purchases a virtual machine instance, and the customer purchases an instance with 4 CPU cores. In order to align the computing power of the virtual machine instance with 4 CPU cores on the 7th generation model with the computing power of the virtual machine instance with 4 cores on the 8th generation model, 6 processor cores can be actually allocated to the customer's virtual machine instance on the 7th generation model. From the customer's perspective, it is still a virtual machine instance with 4 CPU cores. The performance of the virtual machine instance with 4 CPU cores on the 7th generation model and the performance of the virtual machine instance with 4 cores on the 8th generation model are improved and aligned by means of additional CPU resources.
[0030] Therefore, taking the computing power of the highest-performance model as the benchmark, other relatively low-performance machines can all be allocated different amounts of additional resources by sending additional CPU cores according to the gap between their own computing power and the benchmark computing power, and ultimately be aligned with the highest benchmark computing power, thereby achieving the normalization of computing power for servers of different generations, models, and levels.
[0031] Although this method can improve the overall service performance of virtual machine instances, the premise for the core to play a normalization effect is that the instance can consume the corresponding CPU resources. Therefore, it can only be effective for instances corresponding to CPU-consuming tasks. For instances corresponding to non-CPU-consuming tasks, the computing power normalization effect fails, and customers will also feel the performance difference. The main reason is that for non-CPU-consuming tasks, the computing power of the allocated CU meets the needs of such applications. The main performance bottleneck of non-CPU-consuming tasks is usually not the CPU, but other resources, such as I / O, memory, and network resources. This means that even if more CPU resources are allocated to instances on low-performance models, these extra CPU resources cannot overcome the performance differences caused by the actual resource bottleneck.
[0032] Traditional Solution 3: In Traditional Solution 3, it is assumed that the same application instances, such as virtual machine instances, are deployed on the servers of Model A and Model B. Model B has better performance. One way to align the performance to Model A is to reduce the running time of Model B in the same cycle, that is, to reduce the time quota. The running time 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 multiple processor cores corresponding to the process executing the task.
[0033] like Figure 1 As shown, the time quota (Quota) of model B can be reduced to keep the computing power of model B consistent with that of model A. However, the load needs to be a CPU-consuming load, and the allocated time quota (Quota) can be consumed during the load operation, triggering the throttle mechanism of model B. When the load's running time in model B reaches the time quota (Quota), the load is restricted from using the processor in model B until the next scheduling cycle begins, and the scheduling of the load in model B is resumed, so that model B and model A complete the same fraction of the workload in the same cycle.
[0034] For non-CPU consuming loads, Figure 2 The phenomenon shown. Figure 2 As shown, for model A and model B, the currently running load can only consume part of the quota within the scheduling cycle. Therefore, within the scheduling cycle, the running time (Runtime) of the current load is less than the time limit (Quota). Therefore, the throttle mechanism will not be triggered in model A and model B within the current scheduling cycle, causing model A and model B to continue to execute other loads, which also causes an imbalance in the computing power of model A and model B. That is, for non-CPU consuming loads. The throttle mechanism will not be triggered on model B, which is equivalent to the resource scheduling of the load on model B will not be restricted. In the same cycle, the number of loads completed by model B will still be more than the number of loads completed by model A, and the computing power normalization effect will fail.
[0035] Traditional Solution 4: In traditional solution 3, the non-CPU-consuming tasks will not trigger the throttle mechanism, which will cause the computing power of model A and model B to be unbalanced. Another idea is to reduce the scheduling period. For example, Figure 3As shown in the figure, the scheduling period (Period) of the processes of model A and model B is reduced to 50ms. The running time of the current load on model B exceeds the time limit (Quota), which is 166ms. Then the throttling mechanism can be triggered on model B to extend the running time of the task on model B, thereby aligning the computing power of model B with that of model A.
[0036] However, for a new task with a lower load, the scheduling period (Period) needs to be further reduced to trigger the throttle mechanism. The shorter the scheduling period (Period), the more interference the system will suffer. A short period will cause the scheduler to frequently switch contexts, increase the kernel scheduling load, and reduce system performance, which goes against the original intention of designing the scheduling period (Period).
[0037] The embodiment of the present application provides a new resource scheduling method to reduce the computing power difference between service devices, and even realize the computing power normalization between service devices. Specifically, in the embodiment of the present application, the target compensation time of the target process in the target scheduling cycle is determined by the historical running time of the target process in the historical scheduling cycle, and the target process is suspended for the target compensation time between the target scheduling cycle and its next scheduling cycle, so that the target process suspends the execution of the target task, and realizes the calibration of the running time of the target process in the target scheduling cycle. In this way, the running time of the target task in the first service device can be extended, and the difference in the running time of the target task caused by the computing power difference between the first service device and the second service device can be reduced, so as to achieve the effect of reducing the computing power difference between the first service device and the second service device. Even the difference in the running time of the target task caused by the computing power difference between the first service device and the second service device can be eliminated, so as to achieve the effect of computing power normalization.
[0038] It is worth noting that the description of the above-mentioned traditional solutions 1-4 only briefly introduces the implementation principle and existing problems of the traditional computing power normalization solution, and does not mean that the embodiments of the present application are intended to solve the problems existing in the traditional solutions 1-4. The embodiments of the present application only provide a computing power normalization solution different from the traditional solution, and do not overcome the problems existing in the traditional solutions 1-4.
[0039] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0040] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.
[0041] Figure 4 This is a schematic diagram of the structure of the cloud service system provided in the embodiment of the present application. Figure 4 As shown, the cloud service system includes multiple service devices S10 running the same application instance with the same specifications. The service device S10 can be a single server device, a cloud server array, or a virtual machine (VM) running in a cloud server array. In addition, the service device S10 can also refer to other computing devices with corresponding service capabilities, such as computers and other terminal devices (running service programs), etc.
[0042] The application instance may be a virtual machine instance, a container instance, or a database instance, but is not limited thereto. The specification of the application instance may be characterized by the amount of resources occupied by the application instance. In some embodiments, the specification of the application instance may be represented by the number of virtual processor cores and memory size occupied by the application instance.
[0043] In this embodiment, the computing capabilities (i.e., computing power) of some or all of the multiple service devices S10 are different. For the convenience of description and distinction, in this embodiment of the application, the service device with the lowest computing power among the multiple service devices S10 is defined as the first service device 10, and the service device with the lowest computing power among the multiple service devices S10 is defined as the second service device 20. Therefore, the computing power of the first service device 10 is better than that of the second service device 20. The first service device 10 can be any service device among the multiple service devices S10 whose computing power is better than that of the second service device 20. Among them, the computing power of the first service device 10 is better than that of the second service device 20 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.
[0044] The computing power of the first service device 10 and the second service device 20 is different, which may be caused by the different models of the first service device 10 and the second service device 20, and / or the different load levels of the first service device 10 and the second service device 20, etc. Among them, the computing power of the first service device 10 is better than that of the second service device 20. Specifically, the computing power of the model of the first service device 10 may be better than that of the model of the second service device 20.
[0045] Since the computing power of the first service device 10 and the second service device 20 is different, the time for the same task of the same application instance of the same specification of the first service device 10 and the second service device 20 is different, so that the users of the application instances perceive that the performance of the same application instances of the same specification are different, which will undoubtedly cause dissatisfaction and doubts to the service providers of the application instances.
[0046] In order to reduce the computing power difference between the first service device and the second service device, the embodiment of the present application improves the traditional bandwidth control mechanism. The existing bandwidth control mechanism is first described below.
[0047] like Figure 5 As shown in the figure, in the traditional CFS bandwidth control mechanism, the default scheduling period (Period) is 100ms (milliseconds). For the convenience of description, the time quota (Quota) is set to 400ms. Then, each scheduling period can be divided into 4 100ms running time parts, which are provided to 4 virtual CPU (VirtualCPU, vCPU) cores. Among them, the vCPU core is a logical core, and a physical core can be virtualized into one or more logical cores. Multiple refers to more than 2 (including 2).
[0048] like Figure 5 As shown, after every 100ms scheduling cycle, a new scheduling cycle will start again. If the utilization rate of the four vCPUs remains at 100% in each scheduling cycle, the time quota (Quota) allocated for the scheduling cycle will be consumed. If the time consumed by the process group corresponding to the above four vCPUs to execute tasks in the current scheduling cycle exceeds the time quota (Quota), the process group will be restricted from scheduling, that is, physical CPU resources will be stopped from being allocated to the process group until the next scheduling cycle begins. Among them, the model of the first service device 10 is model B, and the model of the second service device 10 is model A. The figure only takes the difference in computing power between the first service device and the second service device as an example due to the different models of the two, but it does not constitute a limitation.
[0049] Assuming that the running time of the process groups in the first service device and the second service device in each scheduling cycle does not exceed the time limit (Quota), since the computing power of the first service device is better than that of the second service device, it will lead to the first service device (i.e. Figure 5 and Figure 6 The number of loads completed by the service device corresponding to model B) is greater than that of the second service device (i.e. Figure 5 and Figure 6 The number of load shares completed by the service device corresponding to model A in the middle, resulting in a problem of misaligned computing power. For example, Figure 6As shown in the figure, within a 100ms scheduling period (Period), a 400ms quota is assigned to the process group, then the service device of model A (i.e., the second service device) completes 2 loads, while the service device of model B (i.e., the first service device) completes 2.3 loads. Therefore, the running time of the service device of model B (i.e., the first service device) to complete one load is less than the running time of the service device of model A (i.e., the second service device) to complete one load, so the computing power of the service device of model B (i.e., the first service device) is better than that of the service device of model A (i.e., the second service device).
[0050] In an embodiment of the present application, in order 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 with the computing power of the second service device. To achieve this goal, an embodiment of the present application introduces a runtime calibration mechanism to extend the runtime of the task of the first service device executing the application instance. The resource scheduling method is applied to the first service device and can be executed by the first service device or by an independent resource scheduling device.
[0051] Figure 7 A flowchart of a resource scheduling method provided in an embodiment of the present application. The resource scheduling method is mainly used to schedule resources for a first service device with better computing power among multiple service devices with the same application instance of the same specification deployed in a cloud service system. The first service device is any service device with better computing power than the second service device with the lowest computing power among multiple service devices with the same application instance of the same specification deployed in a cloud service system. Figure 7 As shown, the resource scheduling method mainly includes the following steps: 701. For a currently completed target scheduling cycle, obtain the historical running time of a target process of a first service device in a historical scheduling cycle; the target process is a process that executes a target task of an application instance; and the historical scheduling cycle includes the currently completed target scheduling cycle.
[0052] 702. Determine a target compensation time of the target process in a target scheduling period according to the historical running time. The target compensation time is used to align the running time of the first service device executing the target task with the second service device.
[0053] 703. Suspend the target process for the target compensation time.
[0054] 704. Start the next scheduling cycle of the target scheduling cycle to perform resource scheduling for the target process.
[0055] In the embodiment of the present application, a runtime calibration mechanism is introduced to extend the runtime of the first service device executing the task of the application instance, thereby reducing the computing power difference between the first service device and the second service device, so that the computing power of the first service device is aligned with the second service device. The main principle is that in the process of the first service device executing the task of the application instance (defined as the target task), the allocation of resources to the process (defined as the target process) executing the target task in the first service device is suspended for a period of time, thereby extending the runtime of the first service device executing the target task.
[0056] Since it is impossible to determine which scheduling cycle is the last scheduling cycle corresponding to the task, it is impossible to uniformly extend the running time in the last scheduling cycle. Since it is impossible to predict how long the current load will consume in a new scheduling cycle, it is possible to know how long the load consumed in the completed historical scheduling cycle. Therefore, the running time compensation can be performed in the completed historical scheduling cycle during the process of the first service device (defined as the target process) executing the target task to extend the running time of the first service device executing the target task, so that the running time of the first service device executing the target task is aligned with the second service device.
[0057] The processor time consumed by the target process of the first service device to execute the target task in a certain scheduling cycle is the running time of the target task executed by the first service device in the scheduling cycle. The processor time consumed by the target process of the first service device to execute the target task in 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 in the scheduling cycle.
[0058] In the embodiment of the present application, in order to determine the time length for compensating the historical scheduling cycle, when the target scheduling cycle of the target process of the first service device to execute the target task is completed, the target scheduling cycle is used as the historical scheduling cycle closest to the current time. Among them, the target scheduling cycle is specifically which scheduling cycle in the scheduling cycle of the target process of the first service device to execute the target task, which is specifically determined by the set runtime calibration strategy. The following describes which scheduling cycle the target scheduling cycle is based on several runtime calibration strategies.
[0059] Runtime calibration strategy 1: In some embodiments, the runtime calibration strategy is to calibrate the run time of the currently completed scheduling cycle every time a scheduling cycle is completed, and the target scheduling cycle is any scheduling cycle in which the target process of the first service device executes the target task.
[0060] Runtime calibration strategy 2: In some other 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 1 historical scheduling cycle), and the target scheduling cycle is any other scheduling cycle except the first (N-1) scheduling cycles in the scheduling cycle of the target process of the first service device to execute the target task. N ≥ 2 and is an integer, and the specific value can be flexibly set according to the actual situation.
[0061] Runtime calibration strategy 3: The runtime calibration strategy is to calibrate the runtime of the target process executing the target task once every N scheduling cycles. The target scheduling cycle can be the N*ith 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*ith scheduling cycle can be calibrated using the runtime of the N historical scheduling cycles closest to the completion time of the N*ith scheduling cycle. Among them, the N historical scheduling cycles closest to the completion time of the N*ith scheduling cycle include the N*ith scheduling cycle. Because the N*ith scheduling cycle has been completed and its completion time is 0, it can be considered as the historical scheduling cycle closest to itself.
[0062] Based on the above run time calibration strategy, it can be known that the run time of the currently completed target scheduling cycle is calibrated, and the historical run time of the target process of the first service device in the historical scheduling cycle needs to be obtained. Based on this, in step 701, for the currently completed target scheduling cycle, the historical run time of the target task executed by the first service device in the historical scheduling cycle can be obtained.
[0063] According to the aforementioned runtime calibration strategies 1-3, in runtime calibration strategy 1, the target scheduling period can be implemented as any scheduling period for the target process of the first service device to execute the target task. Accordingly, the historical scheduling period is the target scheduling period itself.
[0064] In the runtime calibration strategy 2, the target scheduling period is any other scheduling period except the first (N-1) scheduling periods in the scheduling period of the target process of the first service device executing the target task. Accordingly, the historical scheduling period is the N historical scheduling periods closest to the current time, including the target scheduling period.
[0065] In the runtime calibration strategy 3, the target scheduling period is the N*ith scheduling period of the target process of the first service device executing the target task. Accordingly, the historical scheduling period is the N historical scheduling periods closest to the current time, including the target scheduling period (i.e., the N*ith scheduling period).
[0066] The target scheduling cycle also belongs to the historical scheduling cycle, mainly because when the historical running time of the target process in the historical scheduling cycle is obtained, the target scheduling cycle has been executed and completed, and the target scheduling cycle already belongs to the historical scheduling cycle compared to the current time.
[0067] After obtaining the historical running time of the target process of the first service device in the historical scheduling cycle, the running time of the target scheduling cycle can be calibrated according to the historical running time of the target process in the historical scheduling cycle. Specifically, in step 702, the target compensation time of the target process in the target scheduling cycle can be determined according to the historical running time of the target process in the historical scheduling cycle. The target compensation time is used to calibrate the running time of the target scheduling cycle so that the running time of the first service device executing the target task is aligned with the second service device.
[0068] In the embodiments of the present application, the specific implementation method of step 702 is not limited. In some embodiments, the running time of the target task executed by the second service device in the historical scheduling cycle of the corresponding position 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 cycle and the running time of the target task executed by the second service device in the historical scheduling cycle of the corresponding position can be calculated as the target compensation time of the target process in the target scheduling cycle. Since the target compensation time is based on the historical running time of the target process of the first service device in the historical scheduling cycle and the time difference between the running of the target task executed by the second service device in the historical scheduling cycle of the corresponding position, the running time of the target scheduling cycle is calibrated using the target compensation time, and the running time of the target process of the first service device in the historical scheduling cycle can be brought closer to or even aligned with the running time of the second service device, thereby reducing the computing power difference between the two, and even achieving computing power normalization between the two.
[0069] In other embodiments, the running time of the target process under different processor load levels varies. The processor load level can be characterized by processor utilization, which indicates the proportion of processor resources used by the target process to the total amount of processor resources allocated to the target process. Therefore, in combination with the processor utilization of the target process in the historical scheduling cycle, the target compensation time of the target process in the target scheduling cycle can be determined more accurately. Based on this, step 702 can be implemented as: determining the historical processor utilization of the target process in the historical scheduling cycle according to the historical running time of the target process in the historical scheduling cycle and the time limit of the target process. Specifically, the percentage of the historical running time of the target process in the historical scheduling cycle to the time limit of the target process can be used as the historical processor utilization of the target process in the historical scheduling cycle. Further, the target compensation time of the target process in the target scheduling cycle can be determined according to the historical processor utilization of the target process in the historical scheduling cycle.
[0070] In some embodiments, the correspondence between processor utilization and time compensation factor can be preconfigured. The time compensation factor is a parameter used to determine the compensation time, which can be a time length, or a proportional value, such as a percentage value. In the embodiment of the present application, the time compensation factor in the correspondence is pre-determined based on the 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 with the second service device under multiple processor utilizations. Multiple refers to more than 2 (including 2), generally more than 2.
[0071] Specifically, the first service device may be allowed to perform the same task as the second service device under various processor utilizations in advance, and the running time of the first service device and the running time of the second service device may be monitored; thereafter, the time difference between the running time of the first service device and the running time of the second service device under various processor utilizations may be calculated. Further, the time compensation factor corresponding to the first service device under various processor utilizations may be determined according to the time difference between the running time of the first service device and the second service device performing the same task under various processor utilizations. Specifically, for any processor utilization X, the time difference D between the running time of the first service device and the second service device performing the same task under the processor utilization X may be calculated as the time compensation factor of the first service device under the processor utilization X. Alternatively, the time difference D between the running time of the first service device and the second service device performing the same task under the processor utilization X may be calculated as the percentage of the running time of the first service device performing the task under the processor utilization X, as the time compensation factor of the first service device under the processor utilization X.
[0072] Among them, the time difference D between the running time of the first service device at the processor utilization rate X and the running time of the second service device performing the same task is used as the percentage of the running time of the first service device performing the task at the processor utilization rate X, as the time compensation factor of the first service device at the processor utilization rate X, and a relatively stable time compensation factor can be obtained. Because the percentage is a relative value, it is not affected by the absolute time length. Even if the absolute running time of the task changes, as long as the proportional relationship remains unchanged, the time compensation factor is still valid.
[0073] Furthermore, the corresponding relationship between various processor utilizations and the time compensation factors may be determined according to the time compensation factors corresponding to the first service device under various processor utilizations.
[0074] In actual use, the time compensation factors corresponding to processor utilization in certain intervals are the same or similar. If a time compensation factor is stored corresponding to each processor utilization, more storage resources will be occupied. In order to reduce the storage resources occupied by the above-mentioned correspondence, multiple processor utilization ranges and the time compensation factors corresponding to the multiple processor utilization ranges can be determined according to the time compensation factors corresponding to the first service device under multiple processor utilizations, as the correspondence between the above-mentioned processor utilization and the time compensation factor.
[0075] Specifically, the various processor utilizations may be divided into a plurality of processor utilization ranges according to the time compensation factors corresponding to the first service device under the various processor utilizations. Specifically, the processor utilizations whose errors between the corresponding time compensation factors are within a preset error range may be divided into the same processor utilization range to obtain a plurality of processor utilization ranges. Further, the maximum value, minimum value, median value or average value of the time compensation factors corresponding to the processor utilizations in the processor utilization range is used as the time compensation factor corresponding to the processor utilization range.
[0076] In the embodiment of the present application, the storage form of the correspondence between the processor utilization and the time compensation factor in the first service device is not limited. Since the correspondence between the processor utilization and the time compensation factor is used to assist in calibrating the running time of the target process and can act on the resource scheduling link of the target process, the correspondence between the processor utilization and the time compensation factor can be stored in the process group restriction directory in the first service device. Among them, the process group restriction directory is used to store some restriction information of the process group in the first service device. Accordingly, a parameter field corresponding to the time compensation factor of the processor's running time can be added to the process group restriction directory, such as the "cpu.runtime_tuning_factors" field, and the correspondence between the processor utilization and the time compensation factor is written into the field as the value of the field.
[0077] The process group restriction directory can be the " / sys / fs / cgroup / subcgroup" directory. " / sys / fs / " is a special directory in the Linux file system, which is used to store kernel information and configuration items related to the file system. " / sys / fs / cgroup / " is a directory used to configure and manage resource control groups (Control groups, Cgroups).
[0078] Cgroup is a function provided by the Linux kernel to limit and isolate the resource usage of process groups. Cgroup provides 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.
[0079] " / sys / fs / cgroup / subcgroup" is a subdirectory containing multiple subsystems, used to organize and manage specific process groups.
[0080] In some embodiments, the correspondence between processor utilization and time compensation factor can be stored in the form of a tuple under the process group restriction directory in the first service device. The tuple includes: a plurality of processor utilization ranges and the time compensation factors corresponding to the plurality of processor utilization ranges. Among them, a tuple refers to two tuples or more tuples of more than two tuples. Each element in the tuple corresponds to a processor utilization range. In some embodiments, the tuple is a five-tuple, and the corresponding processor utilization ranges may be (0%, 20%], (20%, 40%], (40%, 70%], (70%, 80%] and (80%, 100%], etc. Each processor utilization range corresponds to a time compensation factor. Among them, the correspondence between processor utilization and time compensation factor is stored in the form of a tuple under the process group restriction directory in the first service device, which can be easily read by the resource scheduling process of the process group.
[0081] Based on the correspondence between the preset processor utilization and the time compensation factor, when determining the target compensation time of the target process in the target scheduling cycle according to the historical processor utilization of the target process in the historical scheduling cycle, the target time compensation factor corresponding to the historical processor utilization in the corresponding relationship can be determined according to the historical processor utilization of the target process in the historical scheduling cycle and the preset correspondence between the processor utilization and the time compensation factor; further, the target compensation time can be determined according to the target time compensation factor. Since the time compensation factor in the correspondence between the processor utilization and the time compensation factor is determined according to the time difference between the running time of the first service device and the second service device performing the same task under multiple processor utilizations; therefore, according to the target time compensation factor corresponding to the historical processor utilization in the corresponding relationship, when calibrating the running time of the target scheduling cycle, the running time of the first service device in the historical scheduling cycle can be aligned with the second service device, which helps to reduce the computing power difference between the two, and even realize the computing power normalization of the two.
[0082] In some embodiments, the time compensation factor in the correspondence between processor utilization and the 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 at processor utilization X. The target time compensation factor can be directly used as the target compensation time.
[0083] In other embodiments, the time compensation factor in the correspondence between processor utilization and the time compensation factor is the time difference D between the running time of the first service device and the second service device performing the same task at the processor utilization X, which is a percentage of the running time of the first service device performing the task at the processor utilization X. The target compensation time can be determined based on the historical running time of the aforementioned target process in the historical scheduling cycle and the target time compensation factor.
[0084] In some embodiments, the run time calibration strategy is the aforementioned run time calibration strategy 1, and the product of the historical run time 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: (1).
[0085] In this formula, i represents the i-th tuple in the tuple; and They respectively represent the upper and lower limits of the range of processor utilization corresponding to the i-th tuple. Indicates the historical running time of the historical scheduling cycle (such as the target scheduling cycle); Represents the time compensation factor expressed in percentage form, that is, the time compensation factor corresponding to the i-th tuple. is the target compensation time of the target scheduling cycle when the processor utilization of the target process belongs to the processor utilization range corresponding to the i-th tuple.
[0086] For example, assuming that the multi-tuple is a five-tuple, the corresponding processor utilization ranges may be (0%, 20%], (20%, 40%], (40%, 70%], (70%, 80%], and (80%, 100%], then the calculation formula for the target compensation time of the target scheduling period is: (2).
[0087] Assuming that the target process's scheduling period is 100ms, the time limit is 400ms, and the target process's running time in the target scheduling period is 200ms, 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: .
[0088] If the target process runs for 100ms in the target scheduling period, the processor utilization is 25%. Therefore, the runtime_tuning_factors[1] target time compensation factor can be used. Accordingly, the target compensation time corresponding to the target scheduling period is: .
[0089] In other embodiments, the runtime calibration strategy is the aforementioned runtime calibration strategy 2 or the aforementioned runtime calibration strategy 3, and the historical scheduling period is the N historical scheduling periods closest to the current time. Accordingly, the target time compensation factors corresponding to the N historical scheduling periods in the corresponding relationship can be determined based on the processor utilization corresponding to each of the N historical scheduling periods and the corresponding relationship between the aforementioned processor utilization and the time compensation factor. Further, the compensation time corresponding to each of the N historical scheduling periods can be determined based on the historical running time corresponding to each of the N historical scheduling periods and the target time compensation factor corresponding to each of the N historical scheduling periods. Specifically, for any historical scheduling period X among the N historical scheduling periods, the product of the historical running time corresponding to the historical scheduling period X and the target time compensation factor corresponding to the historical scheduling period X can be used as the compensation time corresponding to the historical scheduling period X.
[0090] Furthermore, the target compensation time can be determined according to the compensation time corresponding to each of the N historical scheduling periods. Optionally, the sum of the compensation time corresponding to each of the N historical scheduling periods can be calculated as the target compensation time. Alternatively, the target compensation time can be obtained by weighted summing the compensation time corresponding to each of the N historical scheduling periods according to the weights corresponding to each of the N historical scheduling periods; the weight corresponding to the historical scheduling period closer to the current time is greater.
[0091] Since the load of the historical scheduling cycle closer to the current time is usually closer to the current load of the target process, therefore, by assigning a larger weight to the historical scheduling cycle closer to the current time, the historical scheduling cycle closer to the current time will contribute more to the determination of the target compensation time, which can make the determined target compensation time closer to the current actual needs and more accurate.
[0092] After determining the target compensation time for calibrating the running time of the target scheduling cycle, in step 703, the target process may be suspended for the target compensation time so that the target process suspends processing the target task. The suspension time during which the target process suspends processing the target task is the target compensation time. Since the target process is suspended, the target process cannot process the target task during the suspension period, which is equivalent to extending the running time of the target process during the target scheduling cycle by the target compensation time.
[0093] In the embodiments of the present application, the specific implementation method of suspending the target process for the target compensation time is not limited. In some embodiments, the aforementioned CFS strategy can be used to schedule resources for 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 (Quota) corresponding to the target process; then, according to the processor time corresponding to each of the multiple virtual processor cores, the physical processors of the corresponding time are allocated to the multiple virtual processor cores, so that the target process uses the physical processor to perform the target task within the allocated processor time. Afterwards, after the target process consumes the allocated processor time, the physical processor is allocated to other processes for use.
[0094] Based on the above resource scheduling method, resource scheduling for the target process can be suspended until the suspension time reaches the target compensation time, so as to suspend the target process for the target compensation time. Among them, suspending resource scheduling for the target process specifically means suspending the allocation of processor time to the target process, and suspending the allocation of physical processors to the target process. The target process is not allocated physical processor resources within the target compensation time, and the target process cannot execute the target task within the target compensation time, which is equivalent to extending the running time of the target process during the target scheduling cycle by the target compensation time.
[0095] In other embodiments, the first service device may be put to sleep for the target compensation time, thereby suspending the target process in the first service device for the target compensation time. The target process cannot process the target task during the suspension period, which is equivalent to extending the running time of the target process during the target scheduling period by the target compensation time.
[0096] 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, so that the target process can use the physical processor to execute the target task within the allocated processor time. In this way, in the aforementioned runtime calibration strategy 1, the scheduling cycle of the first service device is equivalent to the original scheduling cycle plus the target compensation time.
[0097] like Figure 8 As shown, assuming that model A is the second service device, model B represents the first service device, assuming that the scheduling period (Period) of model A and model B is 100ms, the number of vCPUs allocated to the process is 4, and the time quota (Quota) corresponding to the target process is 400ms. The second service device represented by model A still schedules resources for the process that handles 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 model B suspends the target compensation time and enters the next scheduling period of 100ms. This is equivalent to the first service device extending the target compensation time based on the original running time to align the running time of the second service device represented by model A to execute the target task. Figure 8 The target scheduling period is only taken as the target scheduling period in the aforementioned running time calibration strategy 1 as an example for illustration, but it does not constitute a limitation.
[0098] In this embodiment, the target compensation time of the target process in the target scheduling cycle is determined by the historical running time of the target process in the historical scheduling cycle, and the target process's resource scheduling is suspended for the target compensation time between the target scheduling cycle and its next scheduling cycle to achieve calibration of the running time of the target process in the target scheduling cycle. In this way, the running time of the target task in the first service device can be extended, and the difference in the running time of the target task caused by the difference in computing power between the first service device and the second service device can be reduced, thereby achieving the effect of reducing the difference in computing power between the first service device and the second service device. It can even eliminate the difference in the running time of the target task caused by the difference in computing power between the first service device and the second service device, thereby achieving the effect of computing power normalization.
[0099] On the other hand, the embodiment of the present application suspends the resource scheduling of the target process for the target compensation time between the target scheduling cycle and its next scheduling cycle, thereby calibrating the running time of the target process in the target scheduling cycle, and has no requirement on whether the target task is a processor (such as CPU) resource consuming task. Even for tasks that do not consume processor (such as CPU) resources, it can reduce the running time difference between devices due to computing power differences, thereby reducing the computing power differences between devices, and even achieving the computing power normalization effect.
[0100] For example, Fig. 9As shown, still taking the scheduling period (Period) as 100ms, the number of vCPUs allocated to the target process as 4, and the time quota (Quota) corresponding to the target process as 400ms as an example, the target task that does not consume processor (such as CPU) resources does not consume the time quota (Quota) within a scheduling period. Assuming that for the model B with better computing power, the running time of the target task within the scheduling period is 50% of the time quota (Quota), that is, 200ms, after the target scheduling period is completed, the running time calibration method provided in the embodiment of the present application can still be used to determine the target compensation time ( Fig. 9 The target compensation time is 50ms), but it does not directly enter the next scheduling cycle. Instead, it pauses for the target compensation time and then enters the next scheduling cycle to schedule resources for the target process. This can still reduce the running time difference caused by the computing power difference between devices, thereby achieving the effect of reducing the computing power difference between devices, and even achieving the computing power normalization effect.
[0101] The embodiment of the present application does not change the scheduling period (Period) and time quota (Quota) of the target process, so the restricted operation strategy remains valid in each scheduling period. Specifically, for any scheduling period Y in which the target process executes the target task, if the running time of the target process in the scheduling period Y exceeds the time quota (Quota) of the target process, the resource scheduling for the target process can be stopped until the next scheduling period of the scheduling period Y arrives, and the resource scheduling for the target process is performed again. In this way, the fairness of resource allocation can be ensured, and a certain process or process group can be prevented from excessively occupying processor resources, ensuring that other processes in the system can also obtain sufficient processor time, ensuring that each process group fairly allocates processor resources according to the predetermined share (i.e., time quota), and avoiding a certain process from monopolizing too many resources and affecting the normal operation of other processes.
[0102] The following is a comparative explanation of the advantages of the resource scheduling method provided in the embodiment of the present application that can achieve computing power alignment or computing power normalization compared to the aforementioned traditional solutions 1-4.
[0103] For traditional solution 1, due to the high abstraction of resources, different types of tasks may lead to resource fragmentation, which in turn causes resource waste. For example, some tasks that strongly rely on high computing power may not be able to fully utilize other computing resources. The main reason is that different tasks have different requirements for computing resources. Some tasks may require a lot of computing power, while other tasks may only require less computing resources. When a unified CU is used as the scheduling unit, if the size of the CU is not suitable for the needs of certain tasks, it will lead to resource waste. If a task only needs a small part of the computing power, if the CU allocated to it exceeds the actual requirement, then the remaining computing power cannot be effectively utilized, resulting in resource fragmentation and waste.
[0104] The solution provided in the embodiment of the present application allocates processor time according to the scheduling period (Period) and time quota (Quota) of the target process, and can perform resource scheduling through the CFS policy, so that each process obtains relatively balanced resource usage and reduces resource waste.
[0105] Conventional solution 1 normalizes different types of computing resources, which may increase the complexity of the system, especially when resource supply and demand do not match, and management and monitoring of these resources may become more difficult. The solution provided by the embodiment of the present application can use the existing CFS strategy for resource scheduling to reduce the complexity of resource management.
[0106] Traditional solution 1 lacks fine-grained control. In some embodiments of the present application, precise control at the granularity level of scheduling period (Period) and time quota (Quota) is achieved, which can refine the granularity of resource scheduling.
[0107] The computing power normalization effect of traditional solutions 1, 2 and 3 is ineffective for non-CPU consumption tasks, while the solution provided in the embodiment of the present application still has a good computing power normalization effect for non-CPU consumption tasks. For specific analysis, please refer to the relevant content of the aforementioned embodiment.
[0108] In addition, traditional solution 2 allocates additional processor cores to application instances deployed on service devices with lower computing power, so that a portion of the cores of the service device are used for computing power compensation, thereby reducing the total number of deployable instances, that is, reducing the deployment density of application instances. The solution provided in the embodiment of the present application allocates processor resources according to the resource request of the application instance, and there is no need to allocate more processor cores to devices with low computing power for computing power compensation, which has no effect on the deployment density of the application instance.
[0109] In the conventional solution 4, shortening the scheduling cycle will cause the scheduler to frequently switch contexts, increasing the kernel scheduling load. The solution provided by the embodiment of the present application is equivalent to extending the scheduling cycle, and the time interval for the scheduler to switch contexts becomes longer, which can reduce the kernel scheduling load compared with the conventional solution 4.
[0110] It should be noted that the execution subject of each step of the method provided in the above embodiment 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; for another example, the execution subject of step 701 can be device A, and the execution subject of step 702 can be device B; and so on.
[0111] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 701, 702, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.
[0112] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned resource scheduling method.
[0113] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps in the above-mentioned resource scheduling method. In the embodiment of the present application, the specific implementation form of the computer program product is not limited. In some embodiments, the computer program product can be implemented as an application (Application, APP), a mini-program, a computer-side client, a program module, a plug-in, an installation package, a software development kit (Software Development Kit, SDK), an image file of a CD (such as an ISO file), a plug-in or software in the form of software as a service (Software as a Service, SaaS), etc., but is not limited to this.
[0114] Fig.10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.10 As shown, the electronic device includes: a memory 100a and a processor 100b. The memory 100a is used to store computer programs.
[0115] The processor 100b is coupled to the memory 100a and is used to execute a computer program to execute the steps in the resource scheduling method provided in the above embodiments. The specific implementation of each step can be found in the relevant description of the above embodiments, which will not be repeated here.
[0116] In some optional embodiments, such as Fig.10 As shown, the electronic device may also include optional components such as a communication component 100c, a power component 100d, a display component 100e and an audio component 100f. Fig.10 The components are shown schematically only, and do not mean that the electronic device must include Fig.10 The components shown do not necessarily mean that the electronic device can only include Fig.10 Components shown.
[0117] in addition, Fig.10 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the electronic device. The electronic device of this embodiment may be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an IoT device; or it may be various server devices such as a traditional server, a cloud server, or a server cluster.
[0118] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the 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 (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0119] In the embodiment of the present application, the processor may be any hardware processing device that can execute the logic of the above method. Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it may also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) or other programmable devices; or it may be an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (System on Chip, SoC), etc., but not limited thereto.
[0120] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.
[0121] In an embodiment of the present application, 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 touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0122] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. 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 is located.
[0123] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user may be achieved through an audio component.
[0124] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.
[0125] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented 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 codes.
[0126] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0129] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.
[0130] Memory may include non-permanent storage in a computer-readable medium, in the form of random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0131] Computer storage media is readable storage media, also known as readable media. Readable storage media include permanent and non-permanent, removable and non-removable media that 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 technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0132] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the above elements.
[0133] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A resource scheduling method, characterized in that: The first service device and the second service device run application instances of the same specification; the computing power of the first service device is better than that of the second service device; the method includes: For the currently completed target scheduling cycle, obtaining the historical running time of the target process of the first service device in the historical scheduling cycle; the target process is the process that executes the target task of the application instance; the historical scheduling cycle includes the target scheduling cycle; Determine, according to the historical running time, a target compensation time of the target process in the target scheduling period; 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; suspending the target process for the target compensation time; The next scheduling cycle of the target scheduling cycle is started to perform resource scheduling for the target process.
2. The method according to claim 1, characterized in that Determining the target compensation time of the target process in the target scheduling period according to the historical running time includes: Determine a historical processor utilization of the target process in the historical scheduling period according to the historical running time and the time limit of the target process; The target backoff time is determined based on the historical processor utilization.
3. The method according to claim 2, characterized in that The determining the target compensation time according to the historical processor utilization includes: Determine, according to the historical processor utilization and the corresponding relationship between the preset processor utilization and the time compensation factor, the target time compensation factor corresponding to the historical processor utilization in the corresponding relationship; Determining the target compensation time according to the target time compensation factor; The time compensation factor in the corresponding relationship is determined according to 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 with the second service device under various processor utilization rates.
4. The method according to claim 3, characterized in that The step of determining the target compensation time according to the target time compensation factor includes: The target compensation time is determined according to the historical running time and the target time compensation factor.
5. The method according to claim 4, characterized in that The historical scheduling period is the target scheduling period; the target scheduling period is any scheduling period for the target process to execute the target task; The determining the target compensation time according to the historical running time and the target time compensation factor includes: The product of the historical running time corresponding to the target scheduling period and the target time compensation factor is used as the target compensation time.
6. The method according to claim 4, characterized in that The historical scheduling period is the N historical scheduling periods closest to the current time, where N is ≥ 2 and is an integer; The target scheduling cycle is a scheduling cycle of the target process executing the target task except the first (N-1) scheduling cycles, or the target scheduling cycle is the N*ith scheduling cycle of the target process executing the target task, i=1,2,3,…; The determining, according to the historical processor utilization and the correspondence between the preset processor utilization and the time compensation factor, a target time compensation factor corresponding to the historical processor utilization in the correspondence, comprises: Determine, according to the historical processor utilizations corresponding to the N historical scheduling periods and the corresponding relationships, target time compensation factors corresponding to the N historical scheduling periods in the corresponding relationships; The determining the target compensation time according to the historical running time and the target time compensation factor includes: Determine the compensation time corresponding to each of the N historical scheduling periods according to the historical running time corresponding to each of the N historical scheduling periods and the target time compensation factor corresponding to each of the N historical scheduling periods; The target compensation time is determined according to the compensation times corresponding to the N historical scheduling periods.
7. The method according to claim 6, characterized in that The determining the target compensation time according to the compensation times corresponding to the N historical scheduling periods respectively includes: According to the weights corresponding to the N historical scheduling periods, the compensation times corresponding to the N historical scheduling periods are weighted and summed to obtain the target compensation time; the historical scheduling period closer to the current time has a larger weight.
8. The method according to any one of claims 3 to 7, characterized in that: Also includes: Determining a time compensation factor corresponding to the first service device under various processor utilizations according to a time difference between the running time of the first service device and the second service device executing the same task under various processor utilizations; According to the time compensation factors corresponding to the first service device under the various processor utilizations, determining various processor utilization ranges and the time compensation factors corresponding to the various processor utilization ranges as the corresponding relationships; The corresponding relationship is stored in the form of a tuple under the process group restriction directory in the first service device.
9. The method according to any one of claims 1 to 7, characterized in that: The step of suspending the target process for the target compensation time includes: The resource scheduling for the target process is suspended until the suspension time reaches the target compensation time, so as to suspend the target process for the target compensation time.
10. The method according to any one of claims 1 to 7, characterized in that: 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, resource scheduling for the target process is stopped until the next scheduling cycle of any scheduling cycle arrives, and then resource scheduling for the target process is performed again.
11. The method according to any one of claims 1 to 7, characterized in that: The first service device and the second service device are of different models, and the computing power of the model of the first service device is better than the computing power of the model of the second service device.
12. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps of the method according to any one of claims 1 to 11.
13. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 11.
14. A computer program product, characterized in that The method comprises a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Scheduling method and device, electronic equipment, storage medium and software product
CN113296905A
Resource scheduling method and device and storage medium
CN116204314A
Resource scheduling method, device, storage medium and system
CN116400999A
Task scheduling method, electronic equipment and computer readable storage medium
CN117632400A
Computing power management method and device, computing power scheduling equipment and storage medium
CN117632509A
Cited By
Resource scheduling method, and device, storage medium and program product
WO2026098172A1
