Resource scheduling method and related equipment

By detecting and adjusting the number of threads and tasks of the instance, the problem of inefficient execution of the instance in the prior art is solved, real-time monitoring and dynamic adjustment are realized, and task execution efficiency is improved.

CN119690629APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411932604.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The prior art cannot monitor and dynamically adjust the instance configuration parameters issued by the server in real time, resulting in inefficient execution of tasks in some instances.

Method used

By detecting the running parameters of the instance, such as the number of threads and the number of tasks executed, if the preset operation requirements are not met, determine the instance type and dynamically adjust the number of threads and tasks according to the preset resource scheduling rules.

Benefits of technology

It realizes monitoring and dynamic adjustment of the efficiency of instance execution tasks, and improves the efficiency of instance execution tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690629A_ABST
    Figure CN119690629A_ABST
Patent Text Reader

Abstract

The invention provides a resource scheduling method and related device.The method comprises the steps that operation parameters of an instance are detected according to a preset detection rule, the operation efficiency of the instance is obtained, and the operation parameters comprise the number of threads and the number of execution tasks; under the condition that the running efficiency of the instance does not meet the preset running requirement, determining the instance type of the instance; and determining a corresponding preset resource scheduling rule according to the instance type, adjusting the thread count of the instance to a first thread count according to the preset resource scheduling rule, and adjusting the execution task number of the instance to a first task number. The task number and the thread number of the instance can be dynamically adjusted, so that the task execution efficiency of the instance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource scheduling, and in particular to a resource scheduling method and related equipment. Background Art

[0002] Currently, the server sends the instance configuration parameters and tasks at one time, and the instance executes the task based on the configuration parameters sent by the server. During the instance execution process, the server cannot monitor the instance's operating efficiency, nor can it dynamically adjust the configuration parameters, resulting in the phenomenon that some instances have very low efficiency in executing tasks. Summary of the invention

[0003] In view of this, the present application provides a resource scheduling method and related equipment, which can dynamically adjust the number of tasks and the number of threads of an instance, thereby improving the efficiency of the instance in executing tasks.

[0004] A first aspect of an embodiment of the present application provides a resource scheduling method, comprising: detecting an operating parameter of an instance according to a preset detection rule to obtain an operating efficiency of the instance, wherein the operating parameters include the number of threads and the number of executed tasks; when the operating efficiency of the instance does not meet preset operating requirements, determining the instance type of the instance; determining a corresponding preset resource scheduling rule according to the instance type, and adjusting the number of threads of the instance to a first number of threads and the number of executed tasks of the instance to a first number of tasks according to the preset resource scheduling rule.

[0005] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of executed tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0006] In the second aspect, an embodiment of the present application also provides a resource scheduling device, comprising: a detection module, a type determination module and a resource scheduling module; the detection module is used to detect the operating parameters of the instance according to preset detection rules to obtain the operating efficiency of the instance, and the operating parameters include the number of threads and the number of executed tasks; the type determination module is used to determine the instance type of the instance when the operating efficiency of the instance does not meet the preset operating requirements; the resource scheduling module is used to determine the corresponding preset resource scheduling rules according to the instance type, and adjust the number of threads of the instance to a first number of threads and the number of executed tasks of the instance to a first number of tasks according to the preset resource scheduling rules.

[0007] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the electronic device executes the resource scheduling method described in the first aspect.

[0008] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the resource scheduling method as described in the first aspect.

[0009] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the resource scheduling method as described in the first aspect.

[0010] The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A schematic diagram of an implementation environment of a resource scheduling system provided in an embodiment of the present application.

[0012] Figure 2 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0013] Figure 3 A schematic diagram of the interaction between a server and a database provided in one embodiment of the present application.

[0014] Figure 4 Another schematic diagram of interaction between a server and a database provided in one embodiment of the present application.

[0015] Figure 5 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0016] Figure 6 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0017] Figure 7 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0018] Figure 8 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0019] Fig. 9 A flowchart of the steps of a resource scheduling method provided in one embodiment of the present application.

[0020] Fig.10 A functional module diagram of a resource scheduling device provided in one embodiment of the present application.

[0021] Fig.11 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the implementation methods of the present application and the features in the implementation methods can be combined with each other without conflict.

[0023] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described implementations are only part of the implementations of the present application, rather than all the implementations.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0025] It should be further noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0026] In this application, "at least one" means one or more, and "more" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0027] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0028] To facilitate understanding, some illustrations of concepts related to the embodiments of the present application are given by way of example for reference.

[0029] Persistence: Saving data (such as objects in memory) to a storage device (such as a disk) that can be permanently saved. The main application of persistence is to store objects in memory in a database, or in a disk file, XML data file, etc.

[0030] DB: Database, which can be used to store data permanently, is a product specifically for storing structured data.

[0031] Thread: It is the smallest unit that the operating system can schedule operations.

[0032] Instance: A resource unit for real task operation. Its operation status determines the efficiency of resource scheduling and execution. Instances include physical machine instances, virtual machine instances, and container instances. Physical machine instances run directly on hardware without a virtualization layer; virtual machine instances simulate their own complete set of hardware, including CPU, memory, network interface, and storage, through virtualization technology, and run on the host. Multiple virtual machines on the host can run different operating systems independently of each other; container instances are a lightweight virtualization implemented at the operating system level, which allows multiple isolated processes to run on a single host and share the host's operating system.

[0033] Please refer to Figure 1 , Figure 1 A schematic diagram of the implementation environment of the resource scheduling system provided in an embodiment of the present application.

[0034] Those skilled in the art will understand that Figure 1The implementation environment diagram of the resource scheduling system shown is merely an example. The implementation environment described in the embodiment of the present application is intended to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.

[0035] exist Figure 1 In the embodiment of the present application, the resource scheduling system provided by the embodiment of the present application may include a server 110 and a database 120. The server 110 may be integrated with the resource scheduling device provided by the embodiment of the present application.

[0036] The server 110 may be communicatively connected to the database 120 . For example, the server 110 and the database 120 may be connected via a wired communication link or a wireless communication link, etc. This embodiment of the present application is not limited to this.

[0037] It is understandable that the server 110 may be an independent server, or a server network or server cluster composed of servers. For example, the server 110 described in the embodiments of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.

[0038] In some embodiments, the database 120 may be a database disposed in the server 110 , or may be a database independent of the server 110 , which is not specifically limited in this embodiment.

[0039] The server 110 may obtain configuration parameters in the database 120 to execute the resource scheduling method provided in the embodiment of the present application and perform resource scheduling on the instance.

[0040] Please refer to Figure 2 , Figure 2 This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0041] The specific process of this embodiment is as follows Figure 2 As shown, the following steps are included: Step 201 , detect the operating parameters of the instance according to preset detection rules to obtain the operating efficiency of the instance, where the operating parameters include the number of threads and the number of executed tasks.

[0042] In some embodiments, in addition to the number of threads and the number of executed tasks, the operating parameters may also include but are not limited to: CPU usage, memory usage, disk I / O, task execution time, instance type, number of tasks, task type, etc.

[0043] Specifically, the number of threads is the current number of threads of the instance, the number of executed tasks is the current number of executed tasks of the instance; CPU usage, memory usage, and disk I / O are all used to characterize the resource usage of the instance; task execution time, number of tasks, and task type are all used to characterize the task execution of the instance, and task types include scheduling tasks, data collection tasks, etc. Instance types include physical machine instances, container instances, or virtual machine instances.

[0044] In some embodiments, before detecting the running parameters of the instance according to preset detection rules, resource scheduling is performed on the instance according to initial configuration parameters, wherein the initial configuration parameters include at least an initial number of threads and an initial number of tasks.

[0045] Specifically, the server 110 obtains the initial configuration parameters of the instance from the database 120, and then schedules resources for the instance based on the initial configuration parameters, so that the instance starts to execute tasks. That is, before the running parameters of the instance are detected according to the preset detection rules, the number of threads in the instance running process is configured as the initial number of threads, and the number of tasks is configured as the initial number of tasks.

[0046] More specifically, the initial configuration parameters also include instance parameters, task information, task allocation strategy, etc. The instance parameters include the address and instance type of the instance.

[0047] Task information includes the frequency of task execution, the business attributes of the task itself, and the relationship between the task and the instance. When a task is about to be executed, the number of tasks that the instance currently needs to execute, that is, the initial number of tasks, can be obtained.

[0048] The default task allocation strategy is to evenly distribute tasks among related instances. For example, if there are 5 instances and 100 tasks to be allocated, each instance will be allocated 20 tasks on average.

[0049] In some embodiments, when the instance is running, it actively sends its own operating parameters to the server 110, and the server 110 can also actively obtain the operating parameters of the instance, which is not specifically limited in this embodiment.

[0050] How to detect the operating parameters according to the preset detection rules is described in detail in the subsequent embodiments, and will not be described again here to avoid repetition.

[0051] Step 202: When the operating efficiency of the instance does not meet the preset operating requirements, determine the instance type of the instance.

[0052] In some embodiments, instance types include, but are not limited to: physical machine instances, virtual machine instances, and container instances.

[0053] In some embodiments, the server 110 can obtain the operating efficiency of the instance according to different types of operating parameters, and then detect whether the operating efficiency of the instance meets the preset operating requirements. For example, in the case where the operating parameters include the executed task type, the number of executed tasks, and the task execution time of the instance, the server 110 can calculate the first total number of the first tasks executed by the instance within the first preset time period by the number of executed tasks, the executed task type, and the task execution time of the instance. Taking the preset operating requirement that the first total number is greater than 100 as an example, the server 110 determines whether the operating efficiency of the instance meets the preset operating requirements by detecting whether the first total number is greater than 100. When it is detected that the first total number is greater than 100, the server 110 detects whether the operating efficiency of the instance meets the preset operating requirements. It can be understood that how the server 110 obtains the operating efficiency of the instance according to other types of operating parameters and how to determine whether the obtained operating efficiency meets the preset operating requirements are described in detail in subsequent embodiments. In order to avoid repetition, it will not be repeated here.

[0054] Step 203, determining a corresponding preset resource scheduling rule according to the instance type, adjusting the number of threads of the instance to the first number of threads, and adjusting the number of execution tasks of the instance to the first number of tasks according to the preset resource scheduling rule.

[0055] In some embodiments, since instance types include physical machine instances, container instances, and virtual machine instances, and the processing task capabilities of physical machine instances are better than those of container instances and virtual machine instances, this embodiment sets the preset resource scheduling rules corresponding to physical machine instances to increase the number of threads and the number of execution tasks of the instance by a larger amount, and sets the preset resource scheduling rules corresponding to container instances or virtual machine instances to increase the number of threads and the number of execution tasks of the instance by a smaller amount. In this way, the efficiency of instance execution tasks can be more reasonably improved, and the resource utilization rate of the instance can be further improved.

[0056] How to determine the corresponding preset resource scheduling rules according to the instance type is described in detail in the subsequent embodiments, and will not be described again here to avoid repetition.

[0057] In some embodiments, the server 110 determines the first number of threads and the first number of tasks according to the preset resource scheduling rules corresponding to the instance type, and sends the first number of threads and the first number of tasks to the resource scheduling module. The resource scheduling module adjusts the number of threads of the instance to the first number of threads, and adjusts the number of execution tasks of the instance to the first number of tasks.

[0058] For ease of understanding, the following Figure 3 and Figure 4 The resource scheduling method of this embodiment is specifically described by an example: Please refer to Figure 3 and Figure 4 , Figure 3 A schematic diagram of the interaction between the server and the database provided in the embodiment of the present application, Figure 4 Another interactive diagram between a server and a database provided in an embodiment of the present application. The server 110 includes a parameter configuration module, a monitoring module, a calculation module, and a resource scheduling module. The interactive process between the server 110 and the database 120 is as follows: (1) The parameter configuration module submits the initial configuration parameters of the instance to the database 120 to persist the initial configuration parameters.

[0059] (2) After the server 110 is started, the resource scheduling module obtains initial configuration parameters from the database 120 and schedules resources for the instance according to the initial configuration parameters.

[0060] (3) When the instance is executing a task, the monitoring module collects the operating parameters of the instance when executing the task and stores the operating parameters in the database 120 .

[0061] (4) The calculation module obtains the operating parameters from the database 120 , and calculates the execution status of the current thread of the instance based on the operating parameters, and gives the recommended values ​​of the scheduling parameters, that is, the first task number and the first thread number, and stores the recommended values ​​of the scheduling parameters in the database 120 .

[0062] (5) The resource scheduling module obtains the first number of tasks and the first number of threads from the database 120, and adjusts the number of threads of the instance to the first number of threads, and adjusts the number of execution tasks of the instance to the first number of tasks.

[0063] In some embodiments, after adjusting the number of threads of the instance to the first number of threads and adjusting the number of execution tasks of the instance to the first number of tasks, the method further includes: replacing the initial number of threads with the first number of threads and the initial number of tasks with the first number of tasks to obtain final configuration parameters; and in response to the next task execution request, scheduling resources for the instance according to the final configuration parameters. In this way, the final configuration parameters of the instance when the task was last executed can be retained, and when the instance executes a task next time, the server 110 directly schedules resources for the instance according to the final configuration parameters, further improving the efficiency of the instance in executing tasks.

[0064] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0065] Please refer to Figure 5 , Figure 5 This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0066] This embodiment is a specific description of the above embodiment, and further describes: when the operating parameters include CPU usage and memory usage, a method of detecting the operating parameters according to a preset detection rule. In this way, the accuracy of the instance's operating efficiency detection can be improved, and it is ensured that the adjusted first task number and first thread number can improve the instance's efficiency in executing tasks.

[0067] The specific process of this embodiment is as follows Figure 5 As shown, the following steps are included: Step 301 : Compare the CPU usage with a first preset CPU usage, and compare the memory usage with a first preset memory usage to obtain the operation efficiency of the instance.

[0068] Step 302: When the CPU usage is lower than a first preset CPU usage and the memory usage is lower than a first preset memory usage, determine the instance type of the instance.

[0069] Specifically, the preset operation requirement includes that the CPU usage of the instance is greater than or equal to a first preset CPU usage, and the memory usage is greater than or equal to the first preset memory usage. When the server 110 detects that the CPU usage is lower than the first preset CPU usage, and the memory usage is lower than the first preset memory usage, it indicates that the operation efficiency of the instance does not meet the preset operation requirement.

[0070] In some embodiments, the first preset CPU usage rate can be set according to actual needs. For example, the first preset CPU usage rate can be set to 90%, 85%, 80%, etc. There is no specific limitation on the size of the first preset CPU usage rate. It is only necessary to ensure that when the CPU usage rate of the instance is lower than the first preset CPU usage rate, it can be characterized as low operating efficiency of the instance.

[0071] In some embodiments, the first preset memory usage rate can be set according to actual needs. For example, the first preset memory usage rate can be set to 90%, 85%, 80%, etc. There is no specific limitation on the size of the first preset memory usage rate. It is only necessary to ensure that when the memory usage rate of the instance is lower than the first preset memory usage rate, it can be characterized that the operating efficiency of the instance is low.

[0072] Step 303: determine a corresponding preset resource scheduling rule according to the instance type, and adjust the number of threads of the instance to the first number of threads and the number of execution tasks of the instance to the first number of tasks according to the preset resource scheduling rule.

[0073] In some embodiments, the detection of operating parameters according to preset detection rules can also be: detecting whether the CPU usage is greater than a second preset CPU usage, and whether the memory usage is greater than a second preset memory usage. When the CPU usage is greater than the second preset CPU usage, and the memory usage is greater than the second preset memory usage, there is no need to determine the instance type of the instance, and the number of execution tasks of the instance can be directly reduced, and the number of threads can be reduced.

[0074] Specifically, this embodiment does not specifically limit the size of the second preset CPU usage rate, and can be set according to actual needs. For example, the second preset CPU usage rate can be 100%, 99%, 98%, etc. This embodiment does not specifically limit the size of the second preset memory usage rate, and can be set according to actual needs. For example, the second preset memory usage rate can be 95%, 92%, 90%, etc. Since when the CPU usage rate and memory usage rate of the instance are too high, the efficiency of the instance in executing tasks will be reduced. Therefore, the server 110 reduces the number of execution tasks of the instance and reduces the number of threads, thereby improving the efficiency of the instance in executing tasks.

[0075] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0076] Please refer to Figure 6 , Figure 6 This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0077] This embodiment is a specific description of the above embodiment, and further describes: when the operating parameters include CPU usage and memory usage, a method of adjusting the operating parameters according to a preset resource scheduling rule. In this way, the accuracy of the first number of threads and the first number of tasks can be improved, so that the instance after resource scheduling according to the first number of tasks and the first number of threads can improve the efficiency of executing tasks.

[0078] The specific process of this embodiment is as follows Figure 6 As shown, the following steps are included: Step 401 : Compare the CPU usage with a first preset CPU usage, and compare the memory usage with a first preset memory usage to obtain the operation efficiency of the instance.

[0079] Step 402, when the CPU usage is lower than the first preset CPU usage and the memory usage is lower than the first preset memory usage, determine the instance type of the instance. When the instance type is a container instance or a virtual machine instance, execute step 403; when the instance type is a physical machine instance, execute step 404.

[0080] Step 403: Increase the number of executed tasks by a first preset number of tasks to obtain a first number of tasks, and increase the number of threads by a first preset number of threads to obtain a first number of threads.

[0081] Step 404, increase the number of execution tasks by the second preset number of tasks to obtain the first number of tasks, increase the number of threads by the second preset number of threads to obtain the first number of threads, wherein the first preset number of tasks is smaller than the second preset number of tasks, and the first preset number of threads is smaller than the second preset number of threads.

[0082] For ease of understanding, the following specifically describes how to obtain the first number of threads and the first number of tasks in this embodiment: Assume that the current CPU usage of the instance is 50%, the memory usage is 40%, the first preset CPU usage is 80%, and the first preset memory usage is 85%; the number of executed tasks is 50, the number of threads is 10, the first preset number of tasks is 10, the second preset number of tasks is 20, the first preset number of threads is 5, and the second preset number of threads is 10.

[0083] The server 110 detects that the CPU usage is lower than the first preset CPU usage and the memory usage is lower than the first preset memory usage, and detects the instance type of the instance: (1) When it is detected that the instance type is a container instance or a virtual machine instance, the number of tasks to be executed is 50 + the first preset number of tasks 10, that is, the first number of tasks is 60, and the number of threads 5 + the first preset number of threads 5, that is, the first number of threads is 10.

[0084] (2) When it is detected that the instance type is a physical machine instance, the number of tasks to be executed is 50 + the second preset number of tasks is 20, that is, the first number of tasks is 70, and the number of threads is 5 + the second preset number of threads is 10, that is, the first number of threads is 15.

[0085] It is worth noting that since the processing task capability of a physical machine instance is superior to that of a container instance and a virtual machine instance, when the server 110 detects that the CPU usage is lower than the first preset CPU usage and the memory usage is lower than the first preset memory usage, that is, the operating efficiency of the instance is low and the number of threads and tasks needs to be increased, the server 110 detects the instance type of the instance, and when the instance type is a physical machine instance, the number of threads and the number of executed tasks added are larger, and when the instance type is a container instance or a virtual machine instance, the number of threads and the number of executed tasks added are smaller, thereby more reasonably improving the efficiency of the instance in executing tasks and further improving the resource utilization of the instance.

[0086] It should also be noted that since the instance uses different CPU usage and memory usage when processing tasks of different task types, for example, the task type of task A is a scheduling task, and the task type of task B is a data acquisition task. The memory usage of the instance when executing task A is less than the memory usage when executing task B. Therefore, in order to avoid excessive CPU usage and memory usage of the instance when executing tasks due to an excessive increase in the number of tasks, the number of tasks added in this embodiment will also be determined according to the task type.

[0087] For ease of understanding, the following specifically describes how to obtain the first number of threads and the first number of tasks in the task type of this embodiment: Assume that the CPU usage of the instance is 50%, the memory usage is 40%, the first preset CPU usage is 80%, the first preset memory usage is 85%, the number of executed tasks is 50, and the number of threads is 10.

[0088] The server 110 detects that the CPU usage is lower than the first preset CPU usage and the memory usage is lower than the first preset memory usage, and detects the instance type of the instance: (1) When it is detected that the instance type is a container instance or a virtual machine instance, the number of executed tasks is increased by 50 by the first preset number of tasks. If the added task types are all scheduling tasks, the first preset number of tasks is set to 10, and the first preset number of threads is set to 5, that is, the first number of tasks is 60, and the first number of threads is 10; if the added task types are all data collection tasks, the first preset number of tasks is set to 5, and the first preset number of threads is set to 5, that is, the first number of tasks is 55, and the first number of threads is 10.

[0089] (2) When it is detected that the instance type is a physical machine instance, the number of executed tasks is increased by 50 by the second preset number of tasks. If the added task types are all scheduling tasks, the second preset number of tasks is set to 20, and the second preset number of threads is set to 10, that is, the first number of tasks is 70, and the first number of threads is 20; if the added task types are all data collection tasks, the second preset number of tasks is set to 10, and the second preset number of threads is set to 10, that is, the first number of tasks is 60, and the first number of threads is 20.

[0090] Step 405: Adjust the number of threads of the instance to the first number of threads, and adjust the number of execution tasks of the instance to the first number of tasks.

[0091] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of executed tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0092] Please refer to Figure 7 , Figure 7 This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0093] This embodiment is a specific description of the above embodiment, and further describes: when the operating parameters include CPU usage and memory usage, another method of adjusting the operating parameters according to the preset resource scheduling rules. In this way, the accuracy of the first number of threads and the first number of tasks can be further improved, so that the instance after resource scheduling according to the first number of tasks and the first number of threads can improve the efficiency of executing tasks.

[0094] The specific process of this embodiment is as follows Figure 7 As shown, the following steps are included: Step 501 : Compare the CPU usage with a first preset CPU usage, and compare the memory usage with a first preset memory usage to obtain the operation efficiency of the instance.

[0095] Step 502, when the CPU usage is lower than a first preset CPU usage and the memory usage is lower than a first preset memory usage, calculate a first difference between the CPU usage and the first preset CPU usage and a second difference between the memory usage and the first preset memory usage.

[0096] Step 503, detecting the instance type of the instance, when the instance type is a container instance or a virtual machine instance, executing step 504; when the instance type is a physical machine instance, executing step 506.

[0097] Step 504 , calculating the to-be-increased amount of the first number of tasks and the to-be-increased amount of the first number of threads of the instance according to the first difference and the second difference.

[0098] Step 505: The sum of the first task number to be increased and the number of executed tasks is taken as the first task number, and the sum of the first thread number to be increased and the number of threads is taken as the first thread number.

[0099] Step 506 , calculating the amount of the second task number to be increased and the amount of the second thread number to be increased of the instance according to the first difference and the second difference.

[0100] Step 507, taking the sum of the second task number to be increased and the number of executed tasks as the first task number, and taking the sum of the second thread number to be increased and the number of threads as the first thread number, wherein the first task number to be increased is less than the second task number to be increased, and the first thread number to be increased is less than the second thread number to be increased.

[0101] For ease of understanding, the following specifically describes how to obtain the first number of threads and the first number of tasks in this embodiment: Assume that the current CPU usage of the instance is 50%, the memory usage is 40%, the first preset CPU usage is 80%, and the first preset memory usage is 85%; the number of executed tasks is 50, the number of threads is 10, the first preset number of tasks is 10, the second preset number of tasks is 20, the first preset number of threads is 5, and the second preset number of threads is 10.

[0102] Server 110 detects that the CPU usage is lower than the first preset CPU usage, and the memory usage is lower than the first preset memory usage, and calculates that the first difference between the CPU usage and the first preset CPU usage is 30%, and the second difference between the memory usage is 40% and the first preset memory usage is 45%.

[0103] Server 110 continues to detect the instance type of the instance: (1) When it is detected that the instance type is a container instance or a virtual machine instance, the first task number to be increased is calculated as 30 and the first thread number to be increased is 15 according to the first difference 30% and the second difference 45%. The number of tasks to be executed is 50 + the first task number to be increased by 30, that is, the first task number is 80, and the number of threads is 5 + the first thread number to be increased by 15, that is, the first thread number is 20.

[0104] (2) When it is detected that the instance type is a physical machine instance, the second task number to be increased is calculated to be 60 and the second thread number to be increased is 30 according to the first difference 30% and the second difference 45%. The number of tasks to be executed is 50 + the second task number to be increased by 60, that is, the first task number is 110, and the number of threads is 5 + the second thread number to be increased by 30, that is, the first thread number is 35.

[0105] In some embodiments, there is no specific limitation on how to calculate the first task number to be increased, the first thread number to be increased, the second task number to be increased, and the second thread number to be increased according to the first difference of 30% and the second difference of 45%, and it can be set according to actual needs. For example, it can be set that for every 10% difference between the CPU usage and the first preset CPU usage, and for every 15% difference between the memory usage and the first preset memory usage, when the instance type is a physical machine instance, the number of threads +10, the number of executed tasks +20; when the instance type is a container instance or a virtual machine instance, the number of threads +5, the number of executed tasks +10.

[0106] In some embodiments, the amount to be increased in the first number of tasks, the amount to be increased in the first number of threads, the amount to be increased in the second number of tasks, and the amount to be increased in the second number of threads can also be calculated only by the first difference or only by the second difference. The calculation method is similar to the above-mentioned method of calculating together by the first difference and the second difference, and will not be repeated here.

[0107] In some embodiments, different first task number to be increased amounts and second task number to be increased amounts may be set according to different task types. Taking the calculation of the first task number to be increased, the first thread number to be increased, the second task number to be increased, and the second thread number to be increased by only the first difference as an example, assuming that the first difference is 20%, it is set that for every 10% difference between the CPU usage and the first preset CPU usage, when the instance type is a physical machine instance and the task type of the added task is a scheduling task, the number of threads is increased by 10 and the number of executed tasks is increased by 20; for every 10% difference between the CPU usage and the first preset CPU usage, when the instance type is a physical machine instance and the task type of the added task is a data collection task, the number of threads is increased by 10 and the number of executed tasks is increased by 10; for every 10% difference between the CPU usage and the first preset CPU usage, when the instance type is a physical machine instance and the task type of the added task is a data collection task, the number of threads is increased by 10 and the number of executed tasks is increased by 10; for every 10% difference between the CPU usage and the first preset CPU usage, when the instance type is a container instance or a virtual machine instance and the task type of the added task is a scheduling task, the number of threads is increased by 5 and the number of executed tasks is increased by 10; for every 10% difference between the CPU usage and the first preset CPU usage, when the instance type is a container instance or a virtual machine instance and the task type of the added task is a data collection task, the number of threads is increased by 5 and the number of executed tasks is increased by 5.

[0108] Step 508: Adjust the number of threads of the instance to the first number of threads, and adjust the number of execution tasks of the instance to the first number of tasks.

[0109] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0110] Please refer to Figure 8 , Figure 8 This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0111] This embodiment is a specific description of the above embodiment, and further describes: when the operating parameters include the executed task type, the executed task number and the task execution time, a method of detecting the operating parameters according to a preset detection rule, and a method of adjusting the operating parameters according to the preset resource scheduling rule under the detection method. In this way, the accuracy of the first number of threads and the first number of tasks can be further improved, so that the instance after resource scheduling according to the first number of tasks and the first number of threads can improve the efficiency of executing tasks.

[0112] The specific process of this embodiment is as follows Figure 8 As shown, the following steps are included: Step 601, calculating a first total number of first tasks executed by an instance within a first preset time period according to the number of executed tasks, the type of executed tasks and the task execution time corresponding to the instance, wherein the task types of the first tasks are the same.

[0113] In some embodiments, the first preset duration is not specifically limited and can be set according to actual needs. For example, the first preset duration can be set to 10 minutes, 30 minutes, 1 hour, etc.

[0114] Step 602: Obtain the operating efficiency of the instance according to the first total.

[0115] Step 603: When the operating efficiency of the instance does not meet the preset operating requirements, determine the instance type of the instance.

[0116] In some embodiments, whether the operating efficiency of the instance meets the preset operating requirements can be determined by detecting whether the first total is greater than a preset threshold. For example, assuming the preset threshold is 30, if the first total is greater than 30, the operating efficiency of the instance meets the preset operating requirements, and if the first total is less than or equal to 30, the operating efficiency of the instance does not meet the preset operating requirements.

[0117] This embodiment does not specifically limit the size of the preset threshold, and it can be set according to actual needs.

[0118] Step 604: Determine, according to the instance type, the first instance whose first total number in the instance type satisfies a preset number.

[0119] Step 605: Adjust the number of tasks of the second instance to be consistent with the number of tasks of the first instance, and adjust the number of threads of the second instance to be consistent with the number of threads of the first instance, wherein the second instance and the first instance have the same instance type.

[0120] For ease of understanding, the following specifically describes how to adjust the number of tasks and the number of threads of the second instance in this embodiment: Assume that the first instance is instance A and the second instance is instance B. Both instance A and instance B are physical machine instances. The first preset duration is 5 minutes. According to the number of executed tasks, executed task types and task execution time corresponding to instance A, it is obtained that instance A executed 50 tasks of task type a within 5 minutes. According to the number of executed tasks, executed task types and task execution time corresponding to instance B, it is obtained that instance B executed 10 tasks of task type a within 5 minutes. Since instance A and instance B have the same instance type and both instance A and instance B execute tasks of the same task type, the configuration parameters of instance A are copied to instance B, that is, the number of tasks of instance A is used as the number of tasks of instance B, and the number of threads of instance A is used as the number of threads of instance B.

[0121] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0122] Please refer to Fig. 9 , Fig. 9This is a flowchart of the steps of an embodiment of the resource scheduling method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. The resource scheduling method can be applied to Figure 1 The server 110 is shown, but is not limited to this, and the embodiments of the present application are not limited to this.

[0123] This embodiment is a specific description of the above embodiment, and further describes: when the operating parameters include the number of executed tasks and the task execution time, a method of detecting the operating parameters according to a preset detection rule, and a method of adjusting the operating parameters according to a preset resource scheduling rule under the detection method. In this way, the accuracy of the first number of threads and the first number of tasks can be further improved, so that the instance after resource scheduling according to the first number of tasks and the first number of threads can improve the efficiency of executing tasks.

[0124] The specific process of this embodiment is as follows Fig. 9 As shown, the following steps are included: Step 701: Calculate a second total number of tasks executed by the instance within a second preset time period according to the number of executed tasks and the task execution time.

[0125] In some embodiments, there is no specific limitation on the size of the second preset duration, and it can be set according to actual needs.

[0126] Step 702, calculating a first ratio between the second total and the second preset time length, and obtaining the operating efficiency according to the first ratio.

[0127] Step 703: When the operating efficiency of the instance does not meet the preset operating requirements, determine the instance type of the instance.

[0128] In some embodiments, the preset operation requirement includes that the first ratio is greater than or equal to the preset ratio. When the server 110 detects that the first ratio is less than the preset ratio, it indicates that the operation efficiency of the instance does not meet the preset operation requirement.

[0129] Step 704, determining a corresponding preset resource scheduling rule according to the instance type, adjusting the number of threads to the number of intermediate threads according to the preset resource scheduling rule, and adjusting the number of executed tasks to the number of intermediate tasks.

[0130] Step 705 , calculating the total number of third tasks executed by the instance within the second preset time, and calculating a second ratio between the total number of third tasks and the second preset time.

[0131] Step 706, determining whether the second ratio is greater than the first ratio. If the second ratio is greater than the first ratio, executing step 707; otherwise, executing step 708.

[0132] Step 707: The number of intermediate threads is used as the first number of threads, and the number of intermediate tasks is used as the first number of tasks.

[0133] Step 708 , reduce the number of intermediate threads and the number of intermediate tasks, and return to step 705 .

[0134] For ease of understanding, the following specifically describes how to obtain the first number of tasks and the first number of threads in this embodiment: Assuming that the number of threads of instance A is 10, the number of tasks to be executed is 30, the second preset time is 5 minutes, and the number of tasks executed by instance A within 5 minutes is 50, then the server 110 calculates the initial ratio to be 50 / 5=10; the number of tasks to be executed is increased to 100, and the number of threads is increased to 15, that is, the number of intermediate threads is 15, and the number of intermediate tasks is 100. The server 110 continues to monitor the running data of instance A, and obtains that after the number of threads of instance A is increased to 15 and the number of tasks to be executed is increased to 100, the number of tasks executed by instance A within 5 minutes is assumed to be 40, and the server 110 calculates the final ratio to be 4 0 / 5=8. Since the final ratio at this time is smaller than the initial ratio, the number of intermediate threads and the number of intermediate tasks are reduced. Assume that the number of intermediate threads is reduced from 15 to 12, and the number of intermediate tasks is reduced from 100 to 80. The server continues to monitor the running data of instance A, and obtains the number of tasks executed by instance A within 5 minutes after the number of threads of instance A is reduced to 12 and the number of executed tasks is reduced to 80. Assume that the number is 60. The server 110 calculates the final ratio to be 60 / 5=12. Since the final ratio at this time is larger than the initial ratio, the number of intermediate tasks 80 is used as the first number of tasks, and the number of intermediate threads 12 is used as the first number of threads.

[0135] Step 709: Adjust the number of threads of the instance to the first number of threads, and adjust the number of execution tasks of the instance to the first number of tasks.

[0136] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting the running parameters of the instance, since the running parameters include the number of threads and the number of executed tasks, the resource usage and task execution status of the instance can be known according to the running parameters, thereby being able to know the running efficiency of the instance in executing tasks, thereby realizing the monitoring of the instance execution status; when it is detected that the running efficiency of the instance does not meet the preset running requirements, the running parameters are adjusted, the number of threads of the instance is adjusted to the first number of threads, and the number of executed tasks of the instance is adjusted to the first number of tasks, thereby realizing dynamic adjustment of the number of tasks and the number of threads of the instance, and improving the efficiency of the instance in executing tasks.

[0137] Based on the same idea as the resource scheduling method in the above embodiment, the present application also provides a resource scheduling device, which can be used to execute the above resource scheduling method. For ease of explanation, the structural diagram of the resource scheduling device embodiment only shows the parts related to the embodiment of the present application. It can be understood by those skilled in the art that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.

[0138] like Fig.10 As shown, the resource scheduling device 80 includes a detection module 801, a type determination module 802 and a resource scheduling module 803. In some embodiments, the above modules can be programmable software instructions stored in a memory and can be called and executed by a processor. It is understood that in other embodiments, the above modules can also be program instructions or firmware fixed in the processor.

[0139] The detection module 801 is used to detect the operating parameters of the instance according to the preset detection rules to obtain the operating efficiency of the instance, wherein the operating parameters include the number of threads and the number of executed tasks; A type determination module 802, configured to determine the instance type of the instance when the operating efficiency of the instance does not meet a preset operating requirement; The resource scheduling module 803 is used to determine the corresponding preset resource scheduling rule according to the instance type, and adjust the number of threads of the instance to the first number of threads and the number of execution tasks of the instance to the first number of tasks according to the preset resource scheduling rule.

[0140] Please refer to Fig.11 , Fig.11 This is a schematic diagram of an embodiment of an electronic device of the present application.

[0141] The electronic device 100 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. When the processor 30 executes the computer program 40, the steps in the above resource scheduling method embodiment are implemented, for example Figure 2 Steps 201 to 203 shown, or, Figure 5 Steps 301 to 303 shown, or, Figure 6 Steps 401 to 405 shown, or, Figure 7 Steps 501 to 508 shown, or, Figure 8 Steps 601 to 605 shown, or, Fig. 9 Steps 701 to 709 are shown.

[0142] Exemplarily, the computer program 40 can also be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 30. The one or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 40 in the electronic device 100. For example, it can be divided into the detection module 801, the type determination module 802, and the resource scheduling module 803 shown.

[0143] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation of the electronic device 100. The electronic device 100 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 100 may also include input and output devices, network access devices, buses, etc.

[0144] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, a single-chip microcomputer, or the processor 30 may also be any conventional processor, etc.

[0145] The memory 20 can be used to store the computer program 40 and / or the module / unit. The processor 30 realizes various functions of the electronic device 100 by running or executing the computer program and / or the module / unit stored in the memory 20 and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.

[0146] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

Claims

1. A resource scheduling method, characterized in that: include: Detecting the running parameters of the instance according to the preset detection rules to obtain the running efficiency of the instance, wherein the running parameters include the number of threads and the number of executed tasks; If the operating efficiency of the instance does not meet the preset operating requirements, determine the instance type of the instance; A corresponding preset resource scheduling rule is determined according to the instance type, and the number of threads of the instance is adjusted to a first number of threads and the number of execution tasks of the instance is adjusted to a first number of tasks according to the preset resource scheduling rule.

2. The resource scheduling method according to claim 1, characterized in that: The operating parameters include the type of executed tasks, the number of executed tasks and the task execution time; The detecting the operating parameters of the instance according to the preset detection rules to obtain the operating efficiency of the instance includes: Calculate a first total number of first tasks executed by the instance within a first preset time period according to the number of executed tasks, the type of executed tasks, and the task execution time corresponding to the instance, where the task types of the first tasks are the same; The operating efficiency of the instance is obtained according to the first total.

3. The resource scheduling method according to claim 1, characterized in that: The operating parameters include the number of executed tasks and the task execution time; The detecting the operating parameters of the instance according to the preset detection rules to obtain the operating efficiency of the instance includes: Calculate a second total number of tasks executed by the instance within a second preset time period according to the number of executed tasks and the task execution time; A first ratio of the second total number to the second preset time length is calculated, and the operating efficiency is obtained according to the first ratio.

4. The resource scheduling method according to claim 3, characterized in that: The step of adjusting the number of threads of the instance to the first number of threads and the number of execution tasks of the instance to the first number of tasks according to the preset resource scheduling rule includes: Adjusting the number of threads to the number of intermediate threads, and adjusting the number of execution tasks to the number of intermediate tasks; Calculate the total number of third tasks executed by the instance during the second preset time, and calculate a second ratio of the total number of third tasks to the second preset time; When the second ratio is greater than the first ratio, adjusting the first number of threads to the intermediate number of threads, and adjusting the first number of tasks to the intermediate number of tasks; When the second ratio is less than or equal to the first ratio, reduce the number of intermediate threads and the number of intermediate tasks; repeatedly calculate the total number of third tasks of the instance executing tasks in the second preset time, and calculate the second ratio of the total number of third tasks and the second preset time, until the second ratio is greater than the first ratio.

5. The resource scheduling method according to claim 1, characterized in that: The operating parameters include CPU usage and memory usage; The detecting the operating parameters of the instance according to the preset detection rules to obtain the operating efficiency of the instance includes: Comparing the CPU usage with a first preset CPU usage, and comparing the memory usage with a first preset memory usage, to obtain the operation efficiency of the instance; When the operating efficiency of the instance does not meet the preset operating requirement, determining the instance type of the instance includes: When the CPU usage is lower than the first preset CPU usage and the memory usage is lower than the first preset memory usage, the instance type of the instance is determined.

6. The resource scheduling method according to claim 5, characterized in that: The determining a corresponding preset resource scheduling rule according to the instance type, adjusting the number of threads of the instance to a first number of threads according to the preset resource scheduling rule, and adjusting the number of execution tasks of the instance to a first number of tasks, includes: Calculating a first difference between the CPU usage and the first preset CPU usage, and a second difference between the memory usage and the first preset memory usage; When the instance type is a container instance or a virtual machine instance, calculating a first task number to be increased and a first thread number to be increased of the instance according to the first difference and the second difference; The sum of the first task number to be increased and the number of executed tasks is used as the first task number, and the sum of the first thread number to be increased and the number of threads is used as the first thread number; When the instance type is a physical machine instance, calculating a second amount of tasks to be increased and a second amount of threads to be increased of the instance according to the first difference and the second difference; The sum of the second number of tasks to be increased and the number of executed tasks is taken as the first number of tasks, and the sum of the second number of threads to be increased and the number of threads is taken as the first number of threads, wherein the first number of tasks to be increased is less than the second number of tasks to be increased, and the first number of threads to be increased is less than the second number of threads to be increased.

7. A resource scheduling device, characterized in that: include: Detection module, type determination module and resource scheduling module; The detection module is used to detect the operating parameters of the instance according to the preset detection rules to obtain the operating efficiency of the instance, and the operating parameters include the number of threads and the number of executed tasks; The type determination module is used to determine the instance type of the instance when the operating efficiency of the instance does not meet the preset operating requirements; The resource scheduling module is used to determine the corresponding preset resource scheduling rule according to the instance type, and adjust the number of threads of the instance to the first number of threads and the number of execution tasks of the instance to the first number of tasks according to the preset resource scheduling rule.

8. An electronic device, comprising a processor and a memory, characterized in that: The memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the resource scheduling method according to any one of claims 1 to claim 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the resource scheduling method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the resource scheduling method according to any one of claims 1 to 6 is implemented.