Resource scheduling method and device of processor
By determining the scheduling priority based on the business characteristic information of the thread in the hyperconverged service system and dynamically adjusting the processor resource configuration strategy, the problem of unreasonable processor resource allocation is solved, adaptive resource allocation under different load conditions is realized, and system performance and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202412000540.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2044-12-31
Smart Images

Figure CN120045316A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and more particularly, to a method and device for resource scheduling of a processor. Background Art
[0002] Currently, hyper-convergence is a basic infrastructure that integrates computing, storage, and network functions. By integrating traditional computing, storage, and network devices into a unified software-defined platform, flexibility, scalability, and simplicity are provided through software management and automation.
[0003] In related technologies, when allocating processor resources, a fixed set of configurations is usually output based on specific hardware configurations and simulated fixed loads, but the adaptation to complex pressure load changes in actual production situations is not considered, resulting in the technical problem of unreasonable processor resource allocation.
[0004] For the above technical problem of unreasonable processor resource allocation, no effective solution has been proposed yet. Summary of the Invention
[0005] The embodiments of the present application provide a method and device for resource scheduling of a processor to at least solve the problem of unreasonable processor resource allocation in related technologies.
[0006] According to an embodiment of the present application, a method for resource scheduling of a processor is provided, which is applied to a hyper-converged service system. The method includes: determining the scheduling priorities corresponding to multiple threads based on the service characteristic information of the multiple threads in the hyper-converged service system, where the service characteristic information is used to at least represent the resource occupancy rate of the processor during the execution of tasks by the multiple threads; determining the initialization configuration policies corresponding to the multiple threads based on the scheduling priorities corresponding to the multiple threads, where the initialization configuration policies at least include the binding status between the corresponding threads and the processors in the hyper-converged service system; initializing the multiple threads based on the initialization configuration policies; monitoring the running status of the processors corresponding to the multiple threads after initialization, where the running status is used to at least represent the running frequency of the corresponding processors; and adjusting the initial configuration policies corresponding to the multiple threads based on the running status of the processors corresponding to the multiple threads.
[0007] In an exemplary embodiment, when determining the scheduling priorities corresponding to multiple threads based on the service characteristic information of the multiple threads in a hyper-converged service system, the method further includes: configuring the multiple threads into a non-exclusive mode respectively, where the non-exclusive mode is used to indicate that the multiple threads have the permission to share the same processor resource; in the non-exclusive mode, establishing the binding status between the multiple threads and multiple processors in the hyper-converged service system, where the binding status is used to indicate the association relationship between the thread and the processor; increasing the load of the hyper-converged service system to determine the resource occupancy rate of the multiple threads for the processors; determining the scheduling priorities corresponding to the multiple threads based on the service characteristic information of the multiple threads in the hyper-converged service system, including: determining the scheduling priorities corresponding to the multiple threads based on the resource occupancy rate of the multiple threads for the processors.
[0008] In an exemplary embodiment, increasing the load of the hyper-converged service system to determine the resource occupancy rate of the multiple threads for the processors includes: increasing the load of the hyper-converged service system in ascending order; during the dynamic increase of the load of the hyper-converged service system, monitoring the resource occupancy rate of the multiple threads for the processors when the hyper-converged service system is at different loads.
[0009] In an exemplary embodiment, determining the scheduling priorities corresponding to the multiple threads based on the resource occupancy rate of the multiple threads for the processors includes: determining the scheduling priority of the threads whose resource occupancy rate for the processors is within the first threshold range among the multiple threads as the high priority; determining the scheduling priority of the threads whose resource occupancy rate for the processors is within the second threshold range among the multiple threads as the medium priority, where the first threshold range is greater than the second threshold range; determining the scheduling priority of the threads whose resource occupancy rate for the processors is within the third threshold range among the multiple threads as the low priority, where the second threshold range is greater than the third threshold range.
[0010] In an exemplary embodiment, an initialization configuration policy for multiple threads is determined based on the scheduling priorities respectively corresponding to the multiple threads, including: determining the initialization configuration policy of the threads with high scheduling priority among the multiple threads as the first initialization configuration policy, where the first initialization configuration policy is used to indicate setting the corresponding threads to the exclusive mode, and the exclusive mode is used to represent that the threads are individually bound to a processor; determining the initialization configuration policy of the threads with medium scheduling priority among the multiple threads as the second initialization configuration policy, where the second initialization configuration policy is used to indicate setting the corresponding threads to the range binding mode, and the range binding mode allows the corresponding threads to be bound to multiple processors within a preset range; determining the initialization configuration policy of the threads with low scheduling priority among the multiple threads as the third initialization configuration policy, where the third initialization configuration policy is used to indicate setting the corresponding threads to the non-exclusive and range binding mode, and the non-exclusive and range binding mode allows the corresponding threads to be bound to multiple processors and does not exclusively occupy any processor.
[0011] In an exemplary embodiment, the resource scheduling method of the processor further includes: the threads with high priority are configured with first priority scheduling parameters, the threads with medium priority are configured with second priority scheduling parameters, and the threads with low priority are configured with third priority scheduling parameters, where the first priority scheduling parameter is less than the second priority scheduling parameter, the second priority scheduling parameter is less than the third priority scheduling parameter, and there is an inverse proportional relationship between the scheduling priority and the scheduling priority parameter.
[0012] In an exemplary embodiment, monitoring the running states of the processors corresponding to the multiple threads after initialization configuration includes: using a processor monitoring tool to monitor the frequency states of the processors corresponding to the multiple threads; determining the running states of the processors corresponding to the multiple threads based on the frequency states of the processors corresponding to the multiple threads.
[0013] In an exemplary embodiment, determining the running states of the processors corresponding to the multiple threads based on the frequency states of the processors corresponding to the multiple threads includes: in response to the frequency states of the processors corresponding to the multiple threads being the highest frequency states, determining the running states of the processors corresponding to the multiple threads as the first running state; in response to the frequencies of the processors corresponding to the multiple threads decreasing and there being inactive processors in the hyper-converged service system, determining the running states of the processors corresponding to the multiple threads as the second running state; in response to the processors corresponding to the multiple threads being in an active state, determining the running states of the processors corresponding to the multiple threads as the third running state.
[0014] In an exemplary embodiment, based on the operating states of processors corresponding to multiple threads, an initial configuration policy corresponding to the multiple threads is adjusted, including: in response to the operating state of the processors corresponding to the multiple threads being a first operating state, determining that the initial configuration policy of the multiple threads remains unchanged; in response to the operating state of the processors corresponding to the multiple threads being a second operating state, adjusting the initial configuration policy of the threads with low priorities; in response to the operating state of the processors corresponding to the multiple threads being a third operating state, adjusting the initial configuration policy of the threads with low priorities and the initial configuration policy of the threads with medium priorities.
[0015] In an exemplary embodiment, adjusting the initial configuration policy of the threads with low priorities includes: reducing the number of processors bound to the threads with low priorities; increasing the priority scheduling parameter corresponding to the threads with low priorities.
[0016] In an exemplary embodiment, adjusting the initial configuration policy of the threads with low priorities and the initial configuration policy of the threads with medium priorities includes: binding the threads with low priorities to the processors corresponding to the threads with medium priorities; adjusting the priority scheduling parameter corresponding to the threads with medium priorities.
[0017] According to another embodiment of the present application, a resource scheduling device for a processor is provided, including: a first determination unit, configured to determine the scheduling priorities corresponding to multiple threads respectively based on the service characteristic information of the multiple threads in a hyper-converged service system, where the service characteristic information is used to at least represent the resource occupancy rate of the processors during the execution of tasks by the multiple threads; a second determination unit, configured to determine the initialization configuration policy of the multiple threads based on the scheduling priorities corresponding to the multiple threads respectively, where the initialization configuration policy at least includes the binding state between the corresponding threads and the processors in the hyper-converged service system; a configuration unit, configured to perform initialization configuration on the multiple threads based on the initialization configuration policy; a monitoring unit, configured to monitor the operating state of the processors corresponding to the multiple threads after the initialization configuration, where the operating state is used to at least represent the operating frequency of the corresponding processors; an adjustment unit, configured to adjust the initial configuration policy corresponding to the multiple threads based on the operating state of the processors corresponding to the multiple threads.
[0018] According to still another embodiment of the present application, a computer-readable storage medium is further provided, where a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0019] According to still another embodiment of the present application, an electronic device is further provided, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0020] According to another embodiment of the present application, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0021] Through the present application, according to the service characteristic information of multiple threads in a hyper-converged service system, the scheduling priorities corresponding to the multiple threads can be determined, and then according to the scheduling priorities corresponding to the multiple threads respectively, the initial configuration policies of the multiple threads can be determined, and then the multiple threads can be initialized and configured. After that, the running states of the processors corresponding to the multiple threads can be monitored, and according to the running states of the processors, the configuration policies of the threads can be dynamically adjusted, so as to dynamically adjust the processor resources, ensure that under different load conditions, the resource allocation policy of the processor can be adaptively adjusted to achieve the optimal system performance and resource utilization efficiency, realize the technical effect of reasonably allocating processor resources, and further solve the technical problem of unreasonable allocation of processor resources. Description of the Drawings
[0022] Figure 1 is a hardware structure block diagram of a server device for a processor resource scheduling method according to an embodiment of the present application;
[0023] Figure 2 is a flowchart of a processor resource scheduling method according to an embodiment of the present application;
[0024] Figure 3 is a schematic diagram of resource occupancy in a hyper-converged environment according to an embodiment of the present application;
[0025] Figure 4 is a flowchart of a processor resource scheduling method based on load in a hyper-converged scenario according to an embodiment of the present application;
[0026] Figure 5 is a structure block diagram of a processor scheduling device according to an embodiment of the present application. Detailed Embodiments
[0027] In the following, the embodiments of the present application will be described in detail with reference to the drawings and in conjunction with the embodiments.
[0028] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0029] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 is a hardware structure block diagram of a server device for a processor resource scheduling method according to an embodiment of the present application. As Figure 1As shown, the server device may include one or more ( Figure 1 only one is shown in the figure) processors 102 (the processor 102 may include, but is not limited to, processing devices such as a microprocessor MCU or a field-programmable gate array FPGA), and a memory 104 for storing data. Among them, the above server device may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above server device. For example, the server device may further include more or fewer components than Figure 1 shown in the figure, or have a different configuration from Figure 1 shown in the figure.
[0030] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the resource scheduling method of the processor in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely set relative to the processor 102, and these remote memories can be connected to the server device through a network. Examples of the above network include, but are not limited to, the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by the communication provider of the server device. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (Radio Frequency, abbreviated as RF) module, which is used to communicate with the Internet wirelessly.
[0032] In this embodiment, a resource scheduling method for a processor is provided. Figure 2 is a flowchart of the resource scheduling method for the processor according to the embodiments of the present application. As Figure 2 shown, the process includes the following steps:
[0033] Step S202, based on the service characteristic information of multiple threads in the hyper-converged service system, determine the scheduling priorities corresponding to the multiple threads respectively.
[0034] In the technical solution provided in step S202 of the present application, the hyper-converged service system is a system integrating computing, storage, and network functions. Multiple threads are used to indicate the computing task execution units in the hyper-converged service system, and the service characteristic information of the multiple threads is used to at least represent the resource occupancy rate of the processor during the execution of tasks by the multiple threads. The scheduling priority is used to indicate the priority degree of a thread in the allocation of processor time. For example, when the operating system schedules processor resources, the thread has the right to be scheduled preferentially.
[0035] In this embodiment, based on the service characteristic information of multiple threads in the hyper-converged service system, the scheduling priorities of the multiple threads are divided into three priorities: high, medium, and low. Among them, when resources are scheduled, the high-priority threads correspond to more CPU time slices and are executed preferentially; the medium-priority threads are scheduled according to resource requirements on the premise of ensuring the normal operation of the high-priority threads; the low-priority threads are executed when resources are sufficient or do not affect other threads, and the scheduling is greatly affected by the high-priority and medium-priority threads.
[0036] For example, when a high-priority thread is executing, it has a continuous high demand for the resources of the processor (Central Processing Unit, abbreviated as CPU). If the resource occupancy rate of a certain thread among the multiple threads is close to or equal to 100% during the execution of the task, the scheduling priority of this thread is determined to be high priority. If the resource occupancy rate of a certain thread among the multiple threads is between 20% and 100% during the execution of the task, the scheduling priority of this thread is determined to be medium priority. If the resource occupancy rate of a certain thread among the multiple threads is between 0% and 20% during the execution of the task, it indicates that the demand for the resources of the processor is low and unstable. In this case, the scheduling priority of this thread can be determined to be low priority.
[0037] Step S204: Determine the initialization configuration policies of the multiple threads based on the scheduling priorities respectively corresponding to the multiple threads.
[0038] In the technical solution provided in step S204 of the present application, the initialization configuration policies include, but are not limited to: the binding state between the thread and the processor, and other resource configuration parameters.
[0039] In this embodiment, after determining the scheduling priorities respectively corresponding to the multiple threads, the initialization configuration policies of the multiple threads can be determined according to the scheduling priorities respectively corresponding to the multiple threads, so as to optimize the thread scheduling and the allocation of processor resources.
[0040] For example, for a high-priority thread, its corresponding initialization configuration policy is determined to be the first initialization configuration policy. Among them, the first initialization configuration policy instructs to configure the high-priority thread in an exclusive mode, that is, the high-priority thread will exclusively occupy a specific CPU core during execution, and other threads cannot use the resources of this processor. For a medium-priority thread, its corresponding initialization configuration policy is determined to be the second initialization configuration policy. Among them, the second initialization configuration policy instructs to configure the medium-priority thread in a range-binding mode, that is, it allows the medium-priority thread to be bound to multiple processors within a preset range, that is, the medium-priority thread can be bound to a group of processors but does not exclusively occupy the processor, so as to allow a certain degree of resource sharing while maintaining a certain degree of resource isolation. For a low-priority thread, its corresponding initialization configuration policy is determined to be the third initialization configuration policy. Among them, the third initialization configuration policy is used to instruct to set the corresponding thread to a non-exclusive and range-binding mode, where the non-exclusive and range-binding mode allows the low-priority thread to be bound to multiple processors but does not exclusively occupy any processor.
[0041] Optionally, the binding state in the initialization configuration policy can indicate the association setting between the thread and the CPU, including thread exclusivity, non-exclusivity, range binding, etc. Through a reasonable binding policy, it is possible to limit the thread to run on a specific processor core, reduce the overhead of thread scheduling, avoid excessive resource competition, and improve the overall stability and response speed of the system. In addition, the initialization configuration policy may also include settings such as the priority scheduling parameter (nice value) of the thread, thread queue management, interrupt affinity setting, etc., to further optimize the scheduling priority and execution efficiency of the thread, which is not specifically limited here.
[0042] Step S206, based on the initialization configuration policy, perform initialization configuration on multiple threads.
[0043] In the technical solution provided in step S206 of the present application above, after the initialization configuration is completed, multiple threads can be initialized according to the initialization policy.
[0044] In this embodiment, as can be seen from the introduction of step S204 above, the initialization configuration policy corresponding to the high-priority thread is the first initialization configuration policy, the initialization configuration policy corresponding to the medium-priority thread is the second initialization configuration policy, and the initialization configuration policy corresponding to the low-priority thread is the third initialization configuration policy. Based on this, the first initialization configuration policy can be used to configure the high-priority thread so that the high-priority thread is not interfered by other threads during the task execution; the second initialization configuration policy can be used to configure the medium-priority thread so that the medium-priority thread can share resources with threads of the same priority or low-priority threads when resources are sufficient; the third initialization configuration policy can be used to configure the low-priority thread so that the low-priority thread can make full use of the idle processor resources without affecting the execution of the high-priority thread and the medium-priority thread.
[0045] Optionally, the threads can be initialized and configured when the system starts up or when a thread is created to ensure that the threads can obtain the best scheduling policy and resource allocation according to their priorities and resource requirements from the very beginning.
[0046] Step S208, monitor the running status of the processors corresponding to the multiple threads after initialization configuration.
[0047] In the technical solution provided in step S208 of the present application above, after the initialization configuration is completed, the running status of the processors allocated to all threads can be continuously monitored to timely understand the current utilization rate and frequency status of the processors. When it is detected that the main frequency of the active CPU core starts to decrease, it indicates that the system is facing a resource shortage or a high-load state. When all CPU cores are in the active state, it means that the system is under extremely high load pressure and may require a more refined resource scheduling strategy to cope with.
[0048] In this embodiment, a processor monitoring tool can be used to monitor the multiple processors in the hyper-converged service system. When all the cores of the processors are in the highest frequency state, the running status of the processors corresponding to the multiple threads is determined as the first state. When the main frequency of all the cores of the processors starts to decrease, but there are still some processor cores in the inactive state, the running status of the processors corresponding to the multiple threads is determined as the second state. When all the cores of the processors are in the active state, the running status of the processors corresponding to the multiple threads is determined as the third state.
[0049] Step S210, adjust the initial configuration policies corresponding to the multiple threads based on the running status of the processors corresponding to the multiple threads.
[0050] In the technical solution provided in step S210 of the present application, after determining the operating states of the processors corresponding to multiple threads, the initial configuration policies corresponding to the multiple threads can be adjusted according to the operating states of the processors. Among them, in a hyper-converged service system, the operating state of a processor (CPU) directly reflects the pressure level of system resources and the efficiency of allocation.
[0051] In this embodiment, when the system detects a change in the operating state of the processor, it will dynamically adjust the configuration policy of the thread according to the current state, including the binding state between the thread and the CPU core, the nice value, etc., which are not specifically limited here.
[0052] For example, if the processors of multiple threads are in the first operating state, it means that all active CPU cores are in the highest frequency state, which usually indicates that the system resources are sufficient. In this case, the initial configuration policies of the multiple threads can be maintained unchanged.
[0053] Optionally, if the processors of multiple threads are in the second operating state, it means that the main frequencies of all active CPU cores start to decrease and there are inactive cores, that is, some resources are not fully utilized. In this case, the system will adjust the binding policy of low-priority threads, bind the low-priority threads to the processor cores with reduced frequency but not fully utilized, so as to avoid resource waste. At the same time, reduce the nice values of these threads. This policy reduces the demand of low-priority threads for CPU resources, thereby releasing more resources for high-priority threads to use.
[0054] Optionally, if the processors of multiple threads are in the third operating state, it means that all CPU cores are in an active state and under high load, which is usually a sign that the system is under high pressure and almost all resources are occupied. In this case, the low-priority threads can be bound to the CPU cores used by the medium-priority threads, and the nice value can be adjusted to balance the resource requirements of each thread, reduce excessive competition between threads, and ensure the running efficiency of all threads and the overall performance of the system. By adjusting the nice value, the system ensures that even when the core resources are shared, the core CPU utilization rate of the medium-priority threads still remains at a reasonable level and does not affect the execution efficiency of key tasks.
[0055] In this step, by adjusting the thread configuration policy based on the processor operating state, it is ensured that CPU resources are reasonably allocated under different load conditions, resource waste is reduced, and the overall system efficiency is improved. By dynamically adjusting the nice value and the core binding policy, unnecessary resource competition between threads is reduced, thread scheduling is optimized, and the user experience is enhanced.
[0056] In the above steps S202 to S210, according to the service characteristic information of multiple threads in the hyper-converged service system, the scheduling priorities corresponding to the multiple threads can be determined. Then, according to the scheduling priorities corresponding to the multiple threads, the initial configuration policies of the multiple threads can be determined. Furthermore, the multiple threads can be initialized and configured. After that, the running states of the processors corresponding to the multiple threads can be monitored, and according to the running states of the processors, the configuration policies of the threads can be dynamically adjusted to realize the dynamic adjustment of the processor resources, so as to ensure that under different load conditions, the resource allocation policy of the processor can be adaptively adjusted to achieve the optimal system performance and resource utilization efficiency, and realize the technical effect of reasonably allocating the processor resources, thereby solving the technical problem of unreasonable allocation of processor resources.
[0057] Among them, the execution subject of the above steps can be [server, terminal], etc., but not limited thereto.
[0058] The above method implemented by this application will be further introduced below.
[0059] As an optional implementation manner, step S102, determining the scheduling priorities corresponding to multiple threads based on the service characteristic information of multiple threads in the hyper-converged service system, includes: configuring the multiple threads as non-exclusive modes respectively, where the non-exclusive mode is used to indicate that the multiple threads have the permission to share the same processor resource; in the non-exclusive mode, establishing the binding states between the multiple threads and multiple processors in the hyper-converged service system, where the binding state is used to indicate the association relationship between the thread and the processor; increasing the load of the hyper-converged service system to determine the resource occupancy rate of the multiple threads for the processors; and determining the scheduling priorities corresponding to the multiple threads based on the resource occupancy rate of the multiple threads for the processors.
[0060] In this embodiment, all threads in the system are configured to run in a non-exclusive mode. The non-exclusive mode means that threads can share processor resources. This mode setting provides flexibility for subsequent thread classification and dynamic scheduling, enabling the system to more efficiently utilize the CPU under limited resources, while avoiding performance waste caused by excessive resource isolation.
[0061] Optionally, in the non-exclusive mode, the system needs to establish the binding state between the thread and the processor, that is, determine the processor to which each thread will run. It should be noted that the binding state here is not a permanent exclusive binding, but a dynamic binding based on resource requirements, aiming to ensure that the thread can obtain reasonable and stable CPU resources according to its service characteristic information. The binding state reflects the association relationship between the thread and the CPU core and is an important part of the resource allocation and scheduling strategy.
[0062] Optionally, after establishing the binding state between multiple threads and multiple processors in the hyper-converged service system, the resource requirements in different business scenarios can be simulated by increasing the load of the hyper-converged service system, and the scheduling priorities corresponding to the multiple threads can be determined according to the resource occupancy rates of the multiple threads for the processors.
[0063] In this step, the scheduling policy can be adaptively adjusted according to the business characteristic information and actual resource requirements of the threads, so as to realize the dynamic and reasonable allocation of processor resources, and improve the overall performance and resource utilization rate of the hyper-converged service system.
[0064] As an optional implementation manner, increasing the load of the hyper-converged service system to determine the resource occupancy rates of multiple threads for the processors includes: increasing the load of the hyper-converged service system in ascending order; during the dynamic increase of the load of the hyper-converged service system, monitoring the resource occupancy rates of multiple threads for the processors when the hyper-converged service system is under different loads.
[0065] In this embodiment, the load of the hyper-converged service system is gradually increased in ascending order by simulating different business scenarios or using a stress testing tool. For example, gradually increasing the number of virtual machines, increasing the data processing volume or concurrent requests, etc., to simulate the load pressure that the hyper-converged service may encounter in actual use.
[0066] Optionally, during the process of increasing the load, the resource occupancy rates of each thread for the processors can be continuously monitored. That is, as the load of the hyper-converged service system changes dynamically, every time a load unit (such as a virtual machine) is increased, the CPU usage of all threads will be observed and recorded in real time. This monitoring is not limited to the CPU usage rate, but also includes other processor running states, such as the running frequency of each core, cache hit rate, etc., to comprehensively understand the resource occupancy and performance of the system.
[0067] In this step, by collecting and analyzing the resource occupancy rates of threads at different load levels, the business characteristic information and resource requirements of each thread can be more accurately evaluated.
[0068] As an optional implementation manner, determining the scheduling priorities corresponding to multiple threads based on the resource occupancy rates of multiple threads for the processors includes: determining the scheduling priority of the threads whose resource occupancy rates for the processors are within the first threshold range among the multiple threads as high priority; determining the scheduling priority of the threads whose resource occupancy rates for the processors are within the second threshold range among the multiple threads as medium priority, where the first threshold range is greater than the second threshold range; determining the scheduling priority of the threads whose resource occupancy rates for the processors are within the third threshold range among the multiple threads as low priority, where the second threshold range is greater than the third threshold range.
[0069] In this embodiment, after determining the resource occupancy rates of multiple threads for the processor, the scheduling priorities corresponding to the multiple threads can be further determined according to the resource occupancy rates of the multiple threads for the processor.
[0070] Optionally, the scheduling priority of a thread whose resource occupancy rate for the processor is within the first threshold range can be determined as a high priority; the scheduling priority of a thread whose resource occupancy rate for the processor is within the second threshold range can be determined as a medium priority, where the first threshold range is greater than the second threshold range; the scheduling priority of a thread whose resource occupancy rate for the processor is within the third threshold range can be determined as a low priority, where the second threshold range is greater than the third threshold range. Among them, the first threshold range can be about 100%, the threshold range of the second threshold can be 20%-100%, and the third threshold range can be 0-20%. This is only an exemplary example here and does not limit the specific data corresponding within the threshold.
[0071] Optionally, the resource requirements of high-priority threads for the processor are stable and high, the resource requirements of medium-priority threads are relatively flexible and may fluctuate within a certain range, and the resource requirements of low-priority threads for the processor are low and may be unstable. The setting of the threshold for low-priority threads ensures that low-priority threads do not overly occupy resources and affect the execution efficiency of high-priority and medium-priority threads.
[0072] In this step, the hyper-converged service system can adaptively adjust the scheduling priorities and resource allocation strategies of threads based on the actual resource occupancy of the threads for the processor, ensuring that the system can efficiently and reasonably utilize CPU resources in a dynamically changing business scenario, and improving the overall performance and user experience.
[0073] As an alternative implementation, in step S104, based on the scheduling priorities corresponding to multiple threads, an initialization configuration strategy for the multiple threads is determined, including: determining the initialization configuration strategy for the threads with high scheduling priority among the multiple threads as the first initialization configuration strategy, where the first initialization configuration strategy is used to indicate setting the corresponding threads to the exclusive mode, and the exclusive mode is used to represent that a thread is separately bound to a processor; determining the initialization configuration strategy for the threads with medium scheduling priority among the multiple threads as the second initialization configuration strategy, where the second initialization configuration strategy is used to indicate setting the corresponding threads to the range binding mode, and the range binding mode allows the corresponding threads to be bound to multiple processors within a preset range; determining the initialization configuration strategy for the threads with low scheduling priority among the multiple threads as the third initialization configuration strategy, where the third initialization configuration strategy is used to indicate setting the corresponding threads to the non-exclusive and range binding mode, and in the non-exclusive and range binding mode, the corresponding threads are allowed to be bound to multiple processors and do not exclusively occupy any processor.
[0074] In this embodiment, the first initialization configuration strategy is set to the exclusive mode, that is, each thread will be separately bound to a processor to ensure that it has stable CPU resources, is not affected by other threads, and improves the execution efficiency and task response speed; the second initialization configuration strategy is set to the range binding mode, allowing the thread to be bound to multiple processors within a preset range but not exclusively occupying any processor. The third initialization configuration strategy is set to the non-exclusive and range binding mode, that is, the thread can be bound to multiple processors but does not exclusively occupy any processor. This strategy allows low-priority threads to reasonably use the remaining processor resources without affecting high-priority and medium-priority threads.
[0075] Optionally, for high-priority threads, since the demand for processor resources is stable and high during task execution, the utilization rate is usually close to 100%. Therefore, the first initialization configuration strategy can be used to set such threads (high-priority threads) to the exclusive mode, that is, each high-priority thread will be separately bound to a processor to ensure that it has stable CPU resources, is not affected by other threads, and improves the execution efficiency and task response speed. Under this configuration strategy, high-priority threads can obtain the maximum processing power and the minimum scheduling delay, which is the basic guarantee for the execution of key tasks in the system.
[0076] Optionally, for medium-priority threads, since the CPU utilization rate of medium-priority threads fluctuates between 20% and 100%, that is, the requirements of medium-priority threads are relatively flexible. They require a certain amount of processor resources and can also accept a certain degree of resource sharing. Therefore, the second initialization configuration strategy can be used to set such threads to the range-binding mode, allowing medium-priority threads to be bound to multiple processors within a preset range, but not exclusive to any processor. This configuration strategy enables medium-priority threads to run on multiple CPU cores, flexibly adjust according to the current system load, achieve efficient utilization of resources, and ensure scheduling fairness among threads.
[0077] Optionally, for low-priority threads, since the CPU utilization rate of low-priority threads is between 0 and 20%, the requirements of such threads for processor resources are low and unstable. The third initialization configuration strategy can be used to set such threads to the non-exclusive and range-binding mode, that is, such threads can be bound to multiple processors but not exclusive to any processor. Optionally, the priority scheduling parameter (nice value) of low-priority threads is also adjusted according to the system state to further control its allocation of CPU time slices and ensure that the execution of high-priority tasks is not interfered with.
[0078] In this step, through the priority-based initialization configuration strategy, the hyper-converged service system can intelligently allocate processor resources according to the resource requirements and business characteristic information of different threads, achieving refined management and efficient utilization of resources. In a high-load situation, the system can give priority to ensuring the execution efficiency of critical tasks. At the same time, when resources are relatively sufficient, it can reasonably utilize the remaining processor resources to execute low-priority tasks, improving the overall system response ability and user satisfaction. The implementation of this strategy requires the system to have the ability to monitor the running state of the processor in real time and a mechanism to dynamically adjust thread configurations to ensure the flexibility and self-adaptability of resource scheduling.
[0079] As an optional implementation manner, the resource scheduling method of this processor further includes: high-priority threads are configured with a first priority scheduling parameter, medium-priority threads are configured with a second priority scheduling parameter, and low-priority threads are configured with a third priority scheduling parameter, where the first priority scheduling parameter is less than the second priority scheduling parameter, the second priority scheduling parameter is less than the third priority scheduling parameter, and there is an inverse proportional relationship between the scheduling priority and the scheduling priority parameter.
[0080] In this embodiment, high-priority threads are configured with a first priority scheduling parameter, medium-priority threads are configured with a second priority scheduling parameter, and low-priority threads are configured with a third priority scheduling parameter. In the actual scheduling strategy, these parameters usually appear as nice values, representing the priority of threads in the allocation of processor time slices.
[0081] Optionally, the first priority scheduling parameter is less than the second priority scheduling parameter, and the second priority scheduling parameter is less than the third priority scheduling parameter. This means that the nice value is inversely proportional to the priority, that is, the smaller the nice value, the higher the scheduling priority of the thread, and the more processor time it can obtain; the larger the nice value, the lower the scheduling priority of the thread, and the relatively less processor time is allocated.
[0082] Optionally, the scheduling priority is inversely proportional to the priority scheduling parameter, that is, the higher the scheduling priority of the thread, the lower the corresponding priority scheduling parameter.
[0083] In this step, through this scheduling parameter configuration based on thread priority, it can be ensured that under different load and pressure conditions, CPU resources are reasonably allocated, and critical tasks can be processed preferentially. This scheduling mechanism can not only maximize the utilization rate of the processor, but also avoid resource waste and excessive competition, and improve the stability and performance of the hyper-converged service.
[0084] As an alternative implementation, in step S106, monitor the running states of the processors corresponding to multiple threads after initialization configuration, including: using a processor monitoring tool to monitor the frequency states of the processors corresponding to multiple threads; based on the frequency states of the processors corresponding to multiple threads, determine the running states of the processors corresponding to multiple threads.
[0085] In this embodiment, the processors corresponding to multiple threads are used to indicate the processors bound by multiple threads, and the frequency state is used to indicate the core frequency of the processor, which is an important indicator reflecting the activity and load level of the processor.
[0086] Optionally, use a processor monitoring tool, such as CPU performance monitoring software or a kernel module, to monitor the core frequencies of the processors bound by each thread in the hyper-converged service system. When the processor is at a high frequency, it usually means that the load is light and the processor can run at the highest performance; while when the processor frequency drops, it indicates that the processor is under high load and the system may need to adjust resource allocation to cope.
[0087] Optionally, according to the frequency state of the processor, the operating state of the processor is divided into three categories, namely the first operating state, the second operating state, and the third operating state. Among them, the first operating state is used to indicate that all active processor cores are in the highest frequency state. In this operating state, the current load pressure of the system is relatively small, the processor resources are sufficient, and the execution efficiency of the threads is relatively high. The second operating state is used to indicate that the main frequency of the processor cores begins to decrease, but there are still some cores in the inactive state, indicating that the system begins to face resource tension, and the processor begins to adjust the frequency to balance performance and power consumption. At this time, it may be necessary to optimize the configuration of low-priority threads to reduce resource waste. The third operating state is used to indicate that all processor cores are in the active state and under high load, which indicates that the system has reached or is close to full-load operation, and almost all resources are occupied. At this time, it is necessary to make more detailed adjustments to the configuration of medium-priority and low-priority threads to ensure that the execution efficiency of critical tasks is not affected.
[0088] In this step, by continuously monitoring the operating state of the processor and intelligently adjusting the thread configuration strategy according to the state change, it is possible to achieve dynamic optimization allocation of CPU resources in the hyper-converged service system, ensuring that the system can maintain a high operating efficiency and stable performance under different load pressures.
[0089] As an optional implementation manner, in step S108, based on the frequency state of the processors corresponding to multiple threads, determining the operating state of the processors corresponding to multiple threads includes: in response to the frequency state of the processors corresponding to multiple threads being the highest frequency state, determining the operating state of the processors corresponding to multiple threads as the first operating state; in response to the frequency of the processors corresponding to multiple threads decreasing and there being inactive processors in the hyper-converged service system, determining the operating state of the processors corresponding to multiple threads as the second operating state; in response to the processors corresponding to multiple threads being in the active state, determining the operating state of the processors corresponding to multiple threads as the third operating state.
[0090] In this embodiment, in response to the frequency state of the processors corresponding to multiple threads being the highest frequency state, that is, all active CPU cores are in the highest frequency state, determining the operating state of the processors corresponding to multiple threads as the first operating state. In response to the frequency of the processors corresponding to multiple threads decreasing and there being inactive processors in the hyper-converged service system, determining the operating state of the processors corresponding to multiple threads as the second operating state; in response to the processors corresponding to multiple threads being in the active state, determining the operating state of the processors corresponding to multiple threads as the third operating state.
[0091] In this step, by real-time monitoring of the processor frequency state, it helps to provide a data reference for subsequent thread configuration.
[0092] As an alternative implementation, based on the operating states of the processors corresponding to multiple threads, adjust the initial configuration policies corresponding to the multiple threads, including: in response to the operating state of the processors corresponding to the multiple threads being the first operating state, determining that the initial configuration policies of the multiple threads remain unchanged; in response to the operating state of the processors corresponding to the multiple threads being the second operating state, adjusting the initial configuration policies of the low-priority threads; in response to the operating state of the processors corresponding to the multiple threads being the third operating state, adjusting the initial configuration policies of the low-priority threads and the medium-priority threads.
[0093] In this embodiment, when the operating states of the processors corresponding to the multiple threads are all in the first operating state, that is, all active CPU cores are in the highest frequency state, it indicates that the system resources are sufficient and the current load level does not put pressure on the processors. In this case, there is no need to adjust the initial configuration policies of the threads, that is, it is determined that the initial configuration policies of the multiple threads remain unchanged. Each thread maintains its initial configuration based on priority. High-priority threads exclusively occupy and bind to specific CPU cores, medium-priority threads are range-bound, and low-priority threads are in a non-exclusive and range-bound state. This policy retention mechanism ensures that when resources are not tight, the system can run with a stable configuration, avoiding performance fluctuations caused by unnecessary configuration adjustments.
[0094] Optionally, when the operating state of the processors corresponding to the multiple threads is in the second operating state, that is, the frequencies of the CPU cores of all processors start to decrease, but there are still some CPU cores in an inactive state, it indicates that certain pressure begins to appear in the system resources, but it has not reached the level of full tension. In this case, the initial configuration policies of the low-priority threads can be adjusted to release more CPU resources to the medium- and high-priority threads. For example, reduce the number of CPU cores bound to the low-priority threads by running the low-priority threads on fewer cores, and adjust the nice value to limit the allocation of CPU time slices to the low-priority threads, reducing the impact on high-priority tasks. This adjustment can be made at the initial stage of resource pressure, avoiding further decline in system performance and ensuring that the operation of critical services is not affected.
[0095] Optionally, when the operating states of the processors corresponding to multiple threads are in the third operating state, that is, all CPU cores are in a highly loaded active state, it indicates that the system is under extremely high pressure. In this case, not only the configuration of low-priority threads will be adjusted, but also the configuration strategy of medium-priority threads will be further optimized. For example, low-priority threads are required to further reduce resource occupancy, which may include adjusting the bound cores to share resources with medium-priority threads, and at the same time, through more stringent nice value settings, ensuring that the resource requirements of low-priority threads do not hinder the execution of medium- and high-priority threads. The configuration of medium-priority threads will also be adjusted. For example, by adjusting the nice value, ensuring that the resource allocation obtained by medium-priority threads on CPU cores can remain stable and maintain a certain execution efficiency even under high load.
[0096] In this step, by continuously monitoring the operating states of CPU cores, the configuration strategy of threads is intelligently adjusted to adapt to the changing business load, ensuring the reasonable allocation and efficient utilization of resources. This strategy adjustment mechanism not only improves the overall performance of the system, but also enhances the adaptability and flexibility of the system to complex operating environments.
[0097] As an optional implementation method, adjusting the initial configuration strategy of low-priority threads includes: reducing the number of processors bound to low-priority threads; increasing the priority scheduling parameters corresponding to low-priority threads.
[0098] In this embodiment, in a hyper-converged service system, when the operating state of the processor changes from the first operating state (all active CPU cores are in the highest frequency state) to the second operating state (the main frequencies of all active CPU cores start to decrease, but there are still inactive cores), it is necessary to adjust the configuration of low-priority threads to adapt to the change in load pressure.
[0099] Optionally, when the operating state of the processor switches from the first operating state to the second operating state, it indicates that the system begins to feel resource pressure. To ensure that the performance of high-priority and medium-priority threads is not affected, the binding strategy of low-priority threads can be adjusted. For example, the number of processors bound to low-priority threads can be reduced so that these threads no longer occupy too many core resources. The implementation of this strategy usually involves reallocating or restricting low-priority threads from the previously bound multiple processor cores to fewer processor cores for running. For example, unbinding low-priority threads from the previously bound active cores and rebinding them to inactive or lower-frequency processor cores. By reducing the resource occupancy of low-priority threads, the system can reserve more processor cores for high-priority and medium-priority threads, thus ensuring the execution efficiency and response speed of critical services.
[0100] Optionally, when the operating state of the processor is switched from the first operating state to the second operating state, in addition to adjusting the number of processors bound to the threads, the resource allocation of low-priority threads can be further controlled by increasing the priority scheduling parameter (e.g., the nice value). In the second operating state, increasing the priority scheduling parameter of low-priority threads means that these threads are at a lower priority level in the allocation of processor time slices. This adjustment of the scheduling strategy can ensure that even when the number of processor cores is limited, high-priority and medium-priority threads can obtain sufficient processor time to maintain their execution efficiency. By increasing the nice value of low-priority threads, the system can effectively limit the occupancy of these threads on processor resources and prevent them from overly affecting the execution of critical tasks when resources are scarce.
[0101] In this step, by reducing the number of processors bound to low-priority threads and increasing their priority scheduling parameters, the configuration strategy of the threads can be dynamically adjusted to adapt to the changing load pressure in the hyper-converged service system. This adjustment mechanism ensures that when the system faces resource pressure, it can prioritize the performance of critical tasks and high-priority services, while reasonably utilizing the remaining resources, avoiding resource waste, and improving the overall system efficiency.
[0102] As an optional implementation manner, adjusting the initial configuration strategy of low-priority threads and the initial configuration strategy of medium-priority threads includes: binding low-priority threads to the processors corresponding to medium-priority threads; adjusting the priority scheduling parameters corresponding to medium-priority threads.
[0103] In this embodiment, when the processor in the hyper-converged service system enters the state of switching from the second operating state to the third operating state, the initial configuration strategies of low-priority and medium-priority threads can be adjusted to adapt to the current resource pressure and load conditions.
[0104] Optionally, when the processor in the hyper-converged service system enters the state of switching from the second operating state to the third operating state, it means that the processor switches from a state where the frequency starts to decrease but there are still inactive cores to a state where all cores are active. In this case, the configuration of low-priority threads will be readjusted. For example, low-priority threads will be bound to the processors used by medium-priority threads. By adjusting the nice value, it is ensured that when low-priority threads share resources with medium-priority threads, the execution efficiency of medium-priority threads will not be affected.
[0105] Optionally, when the processor in the hyper-converged service system switches from the second operating state to the third operating state, it indicates that when the system enters the resource pressure state due to the change of the processor state, the configuration of the medium-priority threads will also be adjusted. For example, the nice value of the medium-priority threads may be appropriately adjusted to reduce their occupancy of the processor resources. The nice value of the medium-priority threads can be dynamically adjusted according to the current CPU usage to ensure that critical tasks can be executed preferentially under limited resources, and the execution efficiency of the medium-priority threads will not be severely affected.
[0106] In this step, the configuration strategies of the low-priority and medium-priority threads can be adaptively adjusted in the face of different resource pressures, so as to achieve the optimal allocation of resources, improve the overall system performance and resource utilization rate.
[0107] The technical solutions of the embodiments of the present invention will be illustrated below in conjunction with preferred embodiments.
[0108] Currently, when allocating CPU resources in the hyper-converged scenario, a fixed set of configurations is usually output according to specific hardware configurations and simulated fixed loads, but the adaptation to complex pressure load changes in actual production situations is not considered, resulting in the technical problem of unreasonable allocation of processor resources.
[0109] However, the embodiments of the present application provide a method for scheduling processor resources based on load in the hyper-converged scenario. First, the threads in the hyper-converged service are divided into high, medium, and low priorities by actual measurement. Then, the hyper-converged environment is pressurized, for example, the number of virtual machines is increased successively. By monitoring the utilization of CPU resources and the status of the entire CPU frequency, the system status is set into three categories, and the switching between the statuses is used as a trigger condition to adjust the configurations such as the priorities of the threads and the core-binding strategy, so as to achieve the purpose of dynamically adjusting the resource occupancy of the processor according to the load, realize the purpose of reasonably scheduling the resources of the processor, and further solve the technical problem of unreasonable scheduling of the resources of the processor.
[0110] Next, the process of dividing the priorities of the threads in the hyper-converged scenario in the embodiments of the present application will be further introduced.
[0111] In this implementation, when dividing the priorities of the threads in the hyper-converged scenario, the threads are configured as non-exclusive, and all threads are corresponding to the CPU cores one by one and bound to fixed cores. Then, the hyper-converged service is stress-tested by a stress-testing tool. During the successive pressurization process, the CPU occupied by each thread will change, and then the priorities of each thread are divided according to the CPU usage rate of each thread.
[0112] Optionally, if the CPU usage rate of a thread is around 100%, determine that the priority corresponding to the thread is high priority; if the CPU usage rate of the thread fluctuates between 20% and 100%, determine that the priority corresponding to the thread is medium priority; if the CPU usage rate of the thread fluctuates between 0% and 20%, determine that the priority corresponding to the thread is low priority.
[0113] Optionally, after dividing the priorities of the threads, the thread configuration policy can be further initialized according to the priorities.
[0114] Next, the process of initializing the thread configuration policy according to the priorities will be introduced.
[0115] In this embodiment, according to the priority corresponding to the thread, the initial configuration policy of the thread is determined. For example, set the high-priority thread to be an exclusive core and bind and isolate the occupied CPU core. According to the total highest usage rate of the medium-priority threads, isolate enough CPU cores and perform range binding on the threads, and record the number of CPU cores as N mid . Bind the CPU of the low-priority thread and set it to be non-exclusive.
[0116] Optionally, after configuring the initial policy for the threads, the thread configuration policy can be dynamically adjusted according to the pressure of the processor during actual business operations. Next, the process of dynamically adjusting the thread configuration policy will be further introduced.
[0117] In this embodiment, a CPU monitoring tool can be used to monitor all CPU cores in the hyper-converged environment, and the operating state of the CPU is divided into three different situations.
[0118] For example, when all active CPU cores are in the highest frequency state, determine that the operating state of the CPU is the first operating state; when the main frequencies of all active CPU cores start to decrease, but there are still cores in the inactive state, determine that the operating state of the CPU is the second operating state; when all CPU cores are in the active state, determine that the operating state of the CPU is the third operating state.
[0119] Optionally, when the CPU is in the first operating state, keep the initial configuration policy of the thread unchanged.
[0120] Optionally, when the CPU is in the second operating state, adjust the initial configuration policy of the thread. For example, when the CPU is in the critical state between state one and state two, record the CPU usage rate of the hyper-converged service thread through the following formula.
[0121] u cpu ={u 1 , u 2 , ……u n}
[0122] where u i is used to represent the CPU usage rate of the i-th process.
[0123] Optionally, after recording the CPU usage rate, group and bind the processes in the low priority to fixed cores, and make the processes on the same core satisfy the following formula.
[0124] ∑u i = 100%
[0125] Optionally, when the CPU is in the third running state, adjust the initial configuration strategy of the threads. For example, record the CPU usage rate and the currently used CPU core number of each thread with medium and low priorities when in the critical state between state two and state three; bind the processes with medium priority to the CPU cores recorded in the previous step; sort each thread with medium priority according to the CPU usage rate, and set different nice values for the processes on the same core according to different CPU usage rates; bind the threads with low priority to the medium priority according to the following rules.
[0126] Optionally, when binding the threads with low priority to the CPU corresponding to the threads with medium priority, first take out the threads with low priority and record the CPU occupancy rate of the current process; put the thread into the core with medium priority where the CPU usage rate has not reached 100%, and adjust the nice value of the thread from high to low until the CPU usage rate of the original threads in this CPU core is not affected; traverse all the threads with low priority in the same way until all the threads with low priority are bound to the cores with medium priority; when the positions of all the processes with low priority are determined, fix the configuration; when the CPU usage rate of the upper layer drops, roll back the configuration according to the state.
[0127] Optionally, Figure 3 is a schematic diagram of resource occupancy in a hyper-converged environment according to an embodiment of the present application, as Figure 3 shown, which shows the occupancy of CPU resources by threads with different priorities.
[0128] Figure 4 is a flowchart of a processor resource scheduling method based on load in a hyper-converged scenario according to an embodiment of the present application, as Figure 4 shown, and the method includes the following steps:
[0129] Step S401, bind the hyper-converged service threads to cores.
[0130] In this embodiment, set the threads in the hyper-converged service to non-exclusive mode, and bind all the threads to the CPU cores one by one.
[0131] Step S402, simulate stress testing.
[0132] In this embodiment, the hyper-converged service is stress-tested by a stress-testing tool, and during the process of gradually increasing the pressure, the CPU usage of the threads under different pressures is observed.
[0133] Step S403, grading of hyper-converged service threads.
[0134] In this embodiment, according to the CPU usage, the hyper-converged service threads are divided into three priorities: high, medium, and low.
[0135] Step S404, initializing thread configuration.
[0136] In this embodiment, according to the grading result in step one, an initial scheduling policy is set for threads with different priorities.
[0137] Step S405, running upper-layer services.
[0138] In this embodiment, after setting the initial scheduling policy for threads with different priorities, upper-layer services are run to judge the change in the running state of the processor.
[0139] Step S406, judging state upgrade.
[0140] In this embodiment, if the running state is upgraded, the running state of the CPU is further determined. If the CPU is in the first running state, step S407 is executed. If the running state of the CPU switches from the first running state to the second running state, step S408 is executed. If the running state of the CPU switches from the second running state to the third running state, step S409 is executed.
[0141] Step S407, keeping the configuration unchanged.
[0142] Step S408, reducing the total CPU number used by CPU binding of low-priority threads.
[0143] Step S409, binding low-priority threads to the core where medium-priority threads are located to further reduce CPU occupancy.
[0144] Step S410, judging whether the state regresses.
[0145] In this embodiment, it is judged whether the running state of the CPU regresses. If so, step S411 is executed. If not, step S412 is executed.
[0146] Step S411, reverting the configuration.
[0147] In this embodiment, the configuration of the threads is reverted.
[0148] Step S412, determine whether the status is upgraded.
[0149] In this embodiment, it is determined whether the CPU operating status is upgraded. If so, step S406 is executed; if not, step S413 is executed.
[0150] Step S413, keep the configuration unchanged.
[0151] In the above steps S401 to S413, by finely adjusting the CPU resource allocation according to the business pressure degree in the hyper-converged environment, efficient and adaptive scheduling can be achieved, which can effectively cope with complex and changeable business scenarios and improve the response speed and overall efficiency of the hyper-converged service.
[0152] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that makes a contribution to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0153] In this embodiment, a scheduling device for a processor is further provided. The device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that can implement a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0154] Figure 5 is a structural block diagram of a scheduling device for a processor according to an embodiment of the present application. As Figure 5 shown, the scheduling device 500 for the processor includes: a first determination unit 501, a second determination unit 502, a configuration unit 503, a monitoring unit 504, and an adjustment unit 505.
[0155] The first determination unit 501 is used to determine the scheduling priorities corresponding to multiple threads respectively based on the business characteristic information of multiple threads in the hyper-converged service system, where the business characteristic information is used to at least represent the resource occupancy rate of the processor during the execution of tasks by the multiple threads.
[0156] A second determination unit 502, configured to determine an initialization configuration policy for multiple threads based on the scheduling priorities respectively corresponding to the multiple threads, where the initialization configuration policy at least includes the binding status between the corresponding thread and the processor in the hyper-converged service system.
[0157] A configuration unit 503, configured to perform initialization configuration on the multiple threads based on the initialization configuration policy.
[0158] A monitoring unit 504, configured to monitor the running status of the processors corresponding to the multiple threads after initialization configuration, where the running status is used to at least represent the running frequency of the corresponding processor.
[0159] An adjustment unit 505, configured to adjust the initial configuration policy corresponding to the multiple threads based on the running status of the processors corresponding to the multiple threads.
[0160] Optionally, the apparatus 500 is further configured to: configure the multiple threads into a non-exclusive mode respectively, where the non-exclusive mode is used to indicate that the multiple threads have the permission to share the same processor resource; in the non-exclusive mode, establish the binding status between the multiple threads and the multiple processors in the hyper-converged service system, where the binding status is used to indicate the association relationship between the thread and the processor; increase the load of the hyper-converged service system to determine the resource occupancy rate of the multiple threads for the processors; the first determination unit 501 is further configured to: determine the scheduling priorities respectively corresponding to the multiple threads based on the resource occupancy rate of the multiple threads for the processors.
[0161] Optionally, the apparatus 500 is further configured to: increase the load of the hyper-converged service system in an order from low to high; during the process of dynamically increasing the load of the hyper-converged service system, monitor the resource occupancy rate of the multiple threads for the processors when the hyper-converged service system is at different loads.
[0162] Optionally, the first determination unit 501 is further configured to: determine the scheduling priority of the threads whose resource occupancy rate for the processors is within the first threshold range among the multiple threads as a high priority; determine the scheduling priority of the threads whose resource occupancy rate for the processors is within the second threshold range among the multiple threads as a medium priority, where the first threshold range is greater than the second threshold range; determine the scheduling priority of the threads whose resource occupancy rate for the processors is within the third threshold range among the multiple threads as a low priority, where the second threshold range is greater than the third threshold range.
[0163] Optionally, the second determination unit 502 is further configured to: determine the initialization configuration policy of the threads with high scheduling priority among the multiple threads as the first initialization configuration policy, where the first initialization configuration policy is used to indicate that the corresponding threads are set to the exclusive mode, and the exclusive mode is used to represent that the threads are separately bound to a processor; determine the initialization configuration policy of the threads with medium scheduling priority among the multiple threads as the second initialization configuration policy, where the second initialization configuration policy is used to indicate that the corresponding threads are set to the range binding mode, and the range binding mode allows the corresponding threads to be bound to multiple processors within a preset range; determine the initialization configuration policy of the threads with low scheduling priority among the multiple threads as the third initialization configuration policy, where the third initialization configuration policy is used to indicate that the corresponding threads are set to the non-exclusive and range binding mode, and the non-exclusive and range binding mode allows the corresponding threads to be bound to multiple processors and does not exclusively occupy any processor.
[0164] Optionally, the monitoring unit 504 is further configured to: use a processor monitoring tool to monitor the frequency status of the processors bound by the multiple threads; determine the running status of the processors corresponding to the multiple threads based on the frequency status of the processors corresponding to the multiple threads.
[0165] Optionally, the monitoring unit 504 is further configured to: determine that the running status of the processors corresponding to the multiple threads is the first running status in response to the frequency status of the processors corresponding to the multiple threads being the highest frequency status; determine that the running status of the processors corresponding to the multiple threads is the second running status in response to the frequency of the processors corresponding to the multiple threads decreasing and there being inactive processors in the hyper-converged service system; determine that the running status of the processors corresponding to the multiple threads is the third running status in response to the processors corresponding to the multiple threads being in an active state.
[0166] Optionally, the adjustment unit 505 is further configured to: determine that the initial configuration policy of the multiple threads remains unchanged in response to the running status of the processors corresponding to the multiple threads being the first running status; adjust the initial configuration policy of the threads with low priority in response to the running status of the processors corresponding to the multiple threads being the second running status; adjust the initial configuration policy of the threads with low priority and the initial configuration policy of the threads with medium priority in response to the running status of the processors corresponding to the multiple threads being the third running status.
[0167] Optionally, the adjustment unit 505 is further configured to: reduce the number of processors bound by the threads with low priority; increase the priority scheduling parameter corresponding to the threads with low priority.
[0168] Optionally, the adjustment unit 505 is further configured to: bind the threads with low priority to the processors corresponding to the threads with medium priority; adjust the priority scheduling parameter corresponding to the threads with medium priority.
[0169] In this device, according to the service characteristic information of multiple threads in the hyper-converged service system, the scheduling priorities corresponding to the multiple threads can be determined. Then, according to the scheduling priorities corresponding to the multiple threads, the initial configuration policies of the multiple threads can be determined, and then the multiple threads can be initialized and configured. After that, the running states of the processors corresponding to the multiple threads can be monitored, and according to the running states of the processors, the configuration policies of the threads can be dynamically adjusted, so as to dynamically adjust the processor resources, ensure that under different load conditions, the resource allocation policy of the processor can be adaptively adjusted to achieve the optimal system performance and resource utilization efficiency, and realize the technical effect of reasonably allocating processor resources, thereby solving the technical problem of unreasonable allocation of processor resources.
[0170] It should be noted that the above-mentioned various modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned various modules are respectively located in different processors in any combination form.
[0171] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. Wherein, the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0172] In an exemplary embodiment, the above-mentioned computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks or optical discs and other various media that can store computer programs.
[0173] An embodiment of the present application also provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0174] In an exemplary embodiment, the above-mentioned electronic device may further include a transmission device and an input / output device. Wherein, the transmission device is connected to the above-mentioned processor, and the input / output device is connected to the above-mentioned processor.
[0175] An embodiment of the present application also provides a computer program product. The above-mentioned computer program product includes a computer program, and the steps in any one of the above method embodiments are implemented when the computer program is executed by a processor.
[0176] Embodiments of the present application further provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, where the computer program, when executed by a processor, implements the steps in any of the above method embodiments.
[0177] Embodiments of the present application further provide a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in any of the above method embodiments.
[0178] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be repeated here.
[0179] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.
[0180] The above are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.
Claims
1. A processor resource scheduling method, characterized in that: Applied to hyper-converged service systems, The method comprises: Based on the service characteristic information of the multiple threads in the hyper-converged service system, determining the scheduling priorities respectively corresponding to the multiple threads, wherein the service characteristic information is used to at least indicate the resource occupancy rate of the processor by the multiple threads in the process of executing the task; Determine initialization configuration strategies for the multiple threads based on the scheduling priorities respectively corresponding to the multiple threads, wherein the initialization configuration strategies at least include a binding state between the corresponding threads and the processors in the hyper-converged service system; perform initialization configuration on the multiple threads based on the initialization configuration strategies; Monitoring the running status of the processors corresponding to the plurality of threads after the initialization configuration, wherein the running status is used to at least indicate the running frequency of the corresponding processor; Based on the running states of the processors corresponding to the multiple threads, the initial configuration policies corresponding to the multiple threads are adjusted.
2. The method according to claim 1, characterized in that Based on the service characteristic information of the multiple threads in the hyper-converged service system, determining the scheduling priorities respectively corresponding to the multiple threads, the method further includes: Configuring the multiple threads to be in a non-exclusive mode respectively, wherein the non-exclusive mode is used to indicate that the multiple threads have the right to share the same processor resource; In the non-exclusive mode, establishing a binding state between the multiple threads and the multiple processors in the hyper-converged service system, wherein the binding state is used to represent an association relationship between the threads and the processors; Increasing the load of the hyper-converged service system to determine resource occupancy rates of the multiple threads on the processor; The determining, based on the service characteristic information of the multiple threads in the hyper-converged service system, the scheduling priorities respectively corresponding to the multiple threads includes: Based on the resource occupancy rates of the multiple threads on the processor, the scheduling priorities respectively corresponding to the multiple threads are determined.
3. The method according to claim 2, characterized in that Increasing the load of the hyper-converged service system to determine resource occupancy rates of the multiple threads on the processor includes: Increasing the load of the hyper-converged service system in order from low to high; During a process in which the load of the hyper-converged service system increases dynamically, resource occupancy rates of the processor by the multiple threads when the hyper-converged service system is under different loads are monitored.
4. The method according to claim 2, characterized in that: Determining scheduling priorities corresponding to the plurality of threads respectively based on resource occupancy rates of the plurality of threads on the processor includes: Determine the scheduling priority of a thread, among the multiple threads, whose resource occupancy rate of the processor is within a first threshold range, as a high priority; Determine the scheduling priority of a thread, among the multiple threads, whose resource occupancy rate of the processor is within a second threshold range as a medium priority, wherein the first threshold range is greater than the second threshold range; The scheduling priority of a thread among the multiple threads whose resource occupancy rate of the processor is within a third threshold range is determined as a low priority, wherein the second threshold range is greater than the third threshold range.
5. The method according to claim 4, characterized in that Determining initialization configuration strategies for the multiple threads based on the scheduling priorities respectively corresponding to the multiple threads includes: Determine the initialization configuration policy of the thread with the high scheduling priority among the multiple threads as a first initialization configuration policy, wherein the first initialization configuration policy is used to indicate that the corresponding thread is set to an exclusive mode, and the exclusive mode is used to indicate that the thread is bound to a processor alone; Determine the initialization configuration policy of the thread with the medium priority among the multiple threads as a second initialization configuration policy, wherein the second initialization configuration policy is used to indicate that the corresponding thread is set to a range binding mode, and the range binding mode allows the corresponding thread to be bound to multiple processors within a preset range; The initialization configuration policy of the thread with the low scheduling priority among the multiple threads is determined as a third initialization configuration policy, wherein the third initialization configuration policy is used to indicate that the corresponding thread is set to a non-exclusive and range binding mode, wherein the non-exclusive and range binding mode allows the corresponding thread to be bound to multiple processors without monopolizing any processor.
6. The method according to claim 5, characterized in that The method further comprises: The high-priority thread is configured with a first priority scheduling parameter, the medium-priority thread is configured with a second priority scheduling parameter, and the low-priority thread is configured with a third priority scheduling parameter, wherein the first priority scheduling parameter is smaller than the second priority scheduling parameter, the second priority scheduling parameter is smaller than the third priority scheduling parameter, and the scheduling priority and the scheduling priority parameter are inversely proportional.
7. The method according to claim 1, characterized in that Monitoring the running status of the processors corresponding to the multiple threads after the initialization configuration includes: Using a processor monitoring tool, monitoring the frequency status of the processors to which the multiple threads are bound; Based on the frequency states of the processors corresponding to the multiple threads, the running states of the processors corresponding to the multiple threads are determined.
8. The method according to claim 1, characterized in that Determining the operating states of the processors corresponding to the multiple threads based on the frequency states of the processors corresponding to the multiple threads includes: In response to the frequency state of the processors corresponding to the multiple threads being the highest frequency state, determining that the running state of the processors corresponding to the multiple threads is the first running state; In response to a decrease in the frequency of the processors corresponding to the multiple threads and the presence of an inactive processor in the hyper-converged service system, determining that the operating state of the processors corresponding to the multiple threads is a second operating state; In response to the processors corresponding to the multiple threads being in an active state, determining that the running state of the processors corresponding to the multiple threads is a third running state.
9. The method according to claim 8, characterized in that Adjusting the initial configuration policies corresponding to the multiple threads based on the running states of the processors corresponding to the multiple threads includes: In response to the running state of the processors corresponding to the multiple threads being the first running state, determining that the initial configuration policies of the multiple threads remain unchanged; In response to the running state of the processors corresponding to the multiple threads being the second running state, adjusting the initial configuration policy of the low-priority threads; In response to the running state of the processors corresponding to the multiple threads being the third running state, the initial configuration policy of the low-priority thread and the initial configuration policy of the medium-priority thread are adjusted.
10. The method according to claim 9, characterized in that Adjusting the initial configuration strategy of the low-priority thread includes: reducing the number of processors to which the low-priority thread is bound; Increase the priority scheduling parameter corresponding to the low-priority thread.
11. The method according to claim 9, characterized in that Adjusting the initial configuration policy of the low-priority thread and the initial configuration policy of the medium-priority thread includes: Binding the low-priority thread to the processor corresponding to the medium-priority thread; The priority scheduling parameters corresponding to the medium priority thread are adjusted.
12. A processor resource scheduling device, characterized in that: include: A first determining unit is configured to determine scheduling priorities respectively corresponding to the plurality of threads based on business characteristic information of the plurality of threads in the hyper-converged service system, wherein the business characteristic information is used to at least indicate resource occupancy rates of the plurality of threads on the processor in the process of executing tasks; A second determining unit is used to determine the initialization configuration strategy of the multiple threads based on the scheduling priorities respectively corresponding to the multiple threads, wherein the initialization configuration strategy at least includes a binding state between the corresponding thread and the processor in the hyper-converged service system; A configuration unit, configured to initialize the configuration of the multiple threads based on the initialization configuration strategy; a monitoring unit, configured to monitor the running status of the processors corresponding to the multiple threads after the initialization configuration, wherein the running status is used to at least indicate the running frequency of the corresponding processor; An adjusting unit is used to adjust the initial configuration policies corresponding to the multiple threads based on the running states of the processors corresponding to the multiple threads.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 11 when executed by a processor.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Processor scheduling method and system
CN106293902A
Dynamic resource regulation and control method and system for guaranteeing delay sensitive application delay SLO
CN111444012A
Service thread running method and device, storage medium and electronic equipment
CN111597042A
Resource application method and device, electronic equipment and storage medium
CN117453413A
Task processing method and system for comprehensive resource management of intelligent monitoring system
CN117608840A
Cited By
Real-time duplex translation method based on multi-channel parallel processing and corresponding product
CN121237095A