Job scheduling method, electronic equipment and storage medium
By monitoring the resource occupation of target equipment and changes in the number of processes, the number of target processes is determined to optimize the use of resource use, solve the problem of low operating efficiency in existing technologies, and achieve more efficient operating task execution.
Patent Information
- Application Number
- CN202411487894.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art fails to fully utilize equipment resources when performing job tasks, resulting in low job processing efficiency.
By obtaining the resource occupation of the target equipment, the number of target processes in the increasing growth trend when the number of processes increases as the number of processes increases, and operates tasks based on this number.
Make full use of equipment resources to perform operating tasks, improve operating efficiency, and reduce the time and energy occupation of development and maintenance personnel.
Smart Images

Figure CN119336472A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computers, and specifically relates to a job scheduling method, an electronic device, and a storage medium. Background Art
[0002] In the process of executing a job task on a device, the related technology often executes the job task according to the set parameters. However, this way of executing the job task often does not fully utilize the resources of the device, resulting in low efficiency of job processing. Summary of the invention
[0003] The embodiments of the present application provide a job scheduling method, an electronic device, and a storage medium, which can fully utilize the resources of a target device to execute job tasks to improve job processing efficiency.
[0004] In a first aspect, an embodiment of the present application provides a job scheduling method, including: When the target device executes a job task, obtaining a change trend of resource occupancy of the target device as the number of processes used to execute the job task increases; In the case where the resource occupation of the target device shows a growing trend as the number of processes used to execute the job task increases, determining a target number of processes used to execute the job task, the target number of processes being the last process number value obtained in the process of increasing the number of processes; Based on the target number of processes, the job task is executed.
[0005] In a second aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0006] In a third aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0007] According to a fourth aspect, a computer program product comprises a computer program, wherein when the computer program is executed, the method according to the first aspect is implemented.
[0008] In an embodiment of the present application, when a target device executes a job task, the resource occupancy of the target device is obtained as the number of processes used to execute the job task increases; when the resource occupancy of the target device shows a growing trend as the number of processes used to execute the job task increases, the target number of processes used to execute the job task is determined, and the target number of processes is the last value of the number of processes obtained in the process of increasing the number of processes; based on the target number of processes, the job task is executed. In this way, since the target number of processes is determined when the resource occupancy of the device is relatively high, the determined target number of processes fully utilizes the resources on the device, and the job task is executed based on the target number of processes, and the resources of the target device can be fully utilized to execute the job task, so as to improve the job processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a flow chart of a job scheduling method provided by an embodiment of the present application; Figure 2 is a flow chart of another job scheduling method provided by an embodiment of the present application; Figure 3 is a schematic diagram of a job scheduling method provided in an embodiment of the present application; Figure 4 is a structural block diagram of a job scheduling device provided in an embodiment of the present application; Figure 5 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0010] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0011] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0012] In existing software systems, when executing job tasks, some jobs are of high priority and have urgent time requirements, and often require exclusive electronic equipment (such as servers) resources to execute in order to obtain results as soon as possible. Some related means often require development and operation personnel to continuously monitor the execution of jobs, and continuously adjust operating parameters and input conditions according to equipment resources to maximize hardware utilization and improve job throughput, which takes up a lot of time and energy of development and operation personnel. The embodiment of the present application proposes an automatic adjustment scheme, which can automatically detect the resource utilization of electronic equipment when executing related jobs, so as to automatically evaluate the operating parameters and continuously adjust them, and finally achieve the optimal execution result, ensure that the job is completed as soon as possible, and obtain the desired results. In this process, the resources of the equipment can be fully utilized to execute job tasks to improve job processing efficiency.
[0013] The embodiment of the present application provides a job scheduling method, an electronic device and a storage medium. The job scheduling method can be executed by a target device, and the target device can be an electronic device. The electronic device can be a terminal device such as a desktop computer, a laptop computer, or a server, such as an independent physical server or a cloud server capable of cloud computing.
[0014] The job scheduling method provided in the embodiment of the present application may involve concepts such as process and thread. For ease of understanding, these concepts are now explained.
[0015] Process: Process is the most basic and important concept in the operating system. It is a running activity of a program in a computer on a certain data set. It is the basic unit for resource allocation in the system and the foundation of the operating system structure. A process is the basic execution entity of a program and a container for threads. Each process has its own address space, which generally includes a text region, a data region, and a stack region.
[0016] Thread: A thread is the smallest unit that the operating system can schedule operations on. It is contained in a process and is the actual operating unit in the process. A thread refers to a single sequential control flow in a process. Multiple threads can run concurrently in a process, and each thread executes different tasks in parallel. A thread is the basic unit of independent scheduling and dispatching. Multiple threads in the same process will share all system resources in the process, such as virtual address space, file descriptors, and signal processing, etc. However, multiple threads in the same process have their own call stack, their own register context, and their own thread-local storage.
[0017] The job scheduling method provided in the embodiment of the present application uses a resource detection mechanism, combines resource usage trends, and integrates electronic equipment related data to obtain job scheduling parameters, and reasonably configures parameters for the jobs involved in the scheduling to complete the jobs as soon as possible. In the process of job scheduling, the execution status of the job tasks can be judged in real time, and the operating parameters and quantity can be continuously adjusted according to the resource occupancy, reducing the energy and time occupied by development and operation personnel, and obtaining better job scheduling parameters.
[0018] The job scheduling method provided in the embodiment of the present application may involve the four processes of job process execution, job resource detection, thread adjustment, and process adjustment. Of course, in some cases, the job scheduling method provided in the embodiment of the present application may involve the three processes of job process execution, job resource detection, and process adjustment, but not thread adjustment.
[0019] These processes are explained below.
[0020] Job Process Execution: Starts a job according to the default parameters.
[0021] Job resource detection: detects the resources occupied by the job, including one or more of CPU usage, memory usage, IO usage, network usage, etc.
[0022] Thread adjustment: For job processes that can adjust threads, try to gradually increase the number of running threads. Based on the job resource detection situation, if resource usage is growing linearly, continue to increase and adjust until the changes in resource usage and the number of threads no longer conform to the linear growth curve.
[0023] Process adjustment: For job processes, based on the job resource detection, if the server has available resources, the number of process executions will be increased (the process whose threads have been adjusted will be executed according to the adjusted number of threads).
[0024] The following describes in detail the job scheduling method provided in the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0025] See also Figure 1 , Figure 1 is a flow chart of a job scheduling method provided by an embodiment of the present application. Figure 1 As shown, the method comprises the following steps: Step 110, when the target device executes the job task, obtaining a change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases; Step 120, when the resource occupation of the target device shows a growing trend as the number of processes used to execute the job task increases, determine the target number of processes used to execute the job task, the target number of processes being the last process number value obtained in the process of increasing the number of processes; Step 130: Execute the job task based on the target process quantity.
[0026] The changing trend of the resource occupancy of the target device as the number of processes used to execute the job task increases in step 110 may be pre-stored or may be obtained through detection when the target device executes the job task. The changing trend of the resource occupancy of the target device may include a continuous growth trend, an intermittent growth trend, a downward trend, etc.
[0027] Among them, the resource occupancy of the target device can be the occupancy of various resources on the target device, and the various resources can be hardware resources and software resources on the target device, for example, including one or more of CPU usage, memory usage, system IO, network occupancy, etc.
[0028] In the embodiments of the present application, the "resource occupancy" mentioned may refer to the occupancy of one resource or the occupancy of multiple resources. The specific occupancy of one or more resources may be determined according to actual needs. For example, resources (such as memory or CPU) that are greatly affected by process execution or thread execution may be selected as target resources, and the resource occupancy of these selected target resources may be considered, while the resource occupancy of unselected resources may not be considered. The resource occupancy in the embodiments of the present application may be the resource occupancy amount, resource occupancy percentage, etc.
[0029] In step 120, the target number of processes for executing the job task may be determined when a specified condition is met, and the specified condition may include, for example, that the resource occupancy reaches a set threshold or the resource margin reaches a threshold value.
[0030] Among them, the target number of processes in step 130 is the last process number value obtained in the process of increasing the number of processes that keeps the resource occupancy increasing. That is to say, in the process of increasing the number of processes, the resource occupancy rate corresponding to the target number of processes is the highest. If the number of processes continues to increase on the basis of the target number of processes, the resource occupancy rate may not continue to increase. For example, the resource occupancy of the target device increases continuously as the number of processes increases from 1 to 5. For example, the resource occupancy rate increases from 30% to 100%. When the number of processes increases from 5 to 6, the resource occupancy rate is still 100%. At this time, since the resource occupancy rate does not show a continuous increasing trend as the number of processes increases from 5 to 6, the target number of processes is 5, not 6.
[0031] In the job scheduling method provided in the embodiment of the present application, when the target device executes the job task, the resource occupancy of the target device is obtained as the number of processes used to execute the job task increases; when the resource occupancy of the target device shows a continuous increasing trend as the number of processes used to execute the job task increases, the target number of processes used to execute the job task is determined, and the target number of processes is the last process number value obtained in the process of increasing the number of processes; based on the target number of processes, the job task is executed. In this way, since the target number of processes is determined when the resource occupancy of the device is relatively high, the determined target number of processes fully utilizes the resources on the device, and the job task is executed based on the target number of processes, which can fully utilize the resources of the target device to execute the job task, thereby improving the job processing efficiency.
[0032] In a specific embodiment of the present application, in step 120, when the resource occupancy of the target device shows an increasing trend as the number of processes used to execute the job task increases, the target number of processes used to execute the job task is determined, including: when the resource occupancy of the target device shows a linear increasing trend as the number of processes used to execute the job task increases, and the increased resource occupancy indicates that there is no resource margin, the target number of processes used to execute the job task is determined.
[0033] It should be understood that the linear growth mentioned in the embodiments of the present application refers to a straight-line upward trend while the growth amount remains equal over time. The linear growth in the embodiments of the present application can be a roughly linear growth, that is, a certain deviation can be allowed, such as a deviation within 10%. For example, the resource occupancy when the number of processes is A is B, and the proportional relationship can be obtained through B / A. This proportional relationship is then compared with the resource occupancy C obtained when the number of processes is 1. If this proportional relationship is equal to C, it can be considered to be a linear growth trend. If the deviation between this proportional relationship and C is small, for example within 10%, it can also be considered to be a linear growth trend.
[0034] In the embodiment of the present application, the resource occupancy after the increase indicates that there is no margin for the resource, and the resource margin can be 0. Taking the resource occupancy as the memory occupancy rate as an example, if the memory occupancy rate increases from 80% to 100%, it can be considered that there is no margin for the memory resource. Taking the resource occupancy as the memory occupancy as an example, if the total memory is 2G, and the memory occupancy increases from 1.5G to 2G, it can be considered that there is no margin for the memory resource.
[0035] In a specific embodiment of the present application, obtaining the change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases in step 110 may include: Obtain the first resource occupancy of the target device at a first time point; when the first resource occupancy indicates that there is a surplus of resources, increase the number of processes used to execute the job task; obtain the second resource occupancy of the target device at a second time point when the target device executes the job task with the increased number of processes; when the second resource occupancy indicates that there is a surplus of resources, continue to increase the number of processes used to execute the job task until the Nth resource occupancy obtained at the Nth time point indicates that there is no surplus of resources; wherein N is a positive integer greater than 2; based on the number of processes of the target device executing the job task at each time point and the resource occupancy of the target device at each time point, determine the change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases. In this way, by determining the change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases through the number of processes of the target device executing the job task at each time point and the resource occupancy of the target device at each time point, it can be ensured that the obtained change trend conforms to the actual operation situation and has a high accuracy.
[0036] The method of increasing the number of processes for executing the task may be to increase the number gradually, for example, to increase a fixed number of processes each time, for example, to increase one process each time for executing the task. In this way, by increasing the same number of processes each time, it is possible to ensure that the obtained change trend is more accurate.
[0037] Wherein, when the second resource occupancy indicates that there is no resource margin, the number of processes used to execute the job task may not be further increased. Instead, the change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases may be obtained directly based on the first resource occupancy at the first time point and the number of processes at the first time point (hereinafter referred to as the first process number), and the second resource occupancy at the second time point and the number of processes at the second time point (hereinafter referred to as the second process number). Specifically, the change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases may be obtained by comparing the quotient of the first resource occupancy and the first process number, and the quotient of the second resource occupancy and the second process number.
[0038] In the embodiment of the present application, based on the number of processes of the target device executing the job task at each time point and the resource occupation of the target device at each time point, the process of determining the change trend of the resource occupation of the target device as the number of processes used to execute the job task increases can be similar to the change trend obtained based on the two time points and the two process numbers above, except that the number of time points and the number of processes change. The specific process will not be repeated.
[0039] In the embodiment of the present application, the time point can be a time point after the preset window period. When a process or thread is started, there will be an initialization operation, and resource occupancy will fluctuate. Generally, a period of time after the process or thread is started is selected as the preset window period. The time of the preset window period may vary with different software. In other words, the resource occupancy obtained at each time point in the embodiment of the present application can be obtained when the resource occupancy is relatively stable.
[0040] See also Figure 2 , Figure 2 is a flow chart of a job scheduling method provided by an embodiment of the present application. Figure 2 As shown, the method comprises the following steps: Step 210, when the target device executes the job task and the process used to execute the job task is a target process supporting multi-threading, obtaining first target information, wherein the first target information includes the number of threads supported by the target process for simultaneous execution; Step 220, starting a target process for executing the job task according to the first target information; Step 230, obtaining a change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases; Step 240, when the resource occupation of the target device shows a growing trend as the number of processes used to execute the job task increases, determine the target number of processes used to execute the job task, the target number of processes being the last process number value obtained in the process of increasing the number of processes; Step 250: Execute the job task based on the target number of processes.
[0041] The first target information obtained in step 210 may be recorded first target information, or may be first target information obtained during the execution of the operation task.
[0042] In an embodiment of the present application, the process of obtaining the first target information may include: when the target device executes a job task, obtaining a changing trend of the target resource occupancy of the target device as the number of threads in the target process increases; when the target resource occupancy of the target device shows an increasing trend as the number of threads in the target process increases, determining the target number of threads, the target process number being the last thread number value obtained in the process of increasing the number of threads; and using the target number of threads as the first target information.
[0043] In the embodiment of the present application, the change trend of the target resource occupancy of the target device as the number of threads in the target process increases can be pre-stored, or can be obtained by detection when the target device executes a job task. The change trend of the target resource occupancy of the target device can include a continuous growth trend, an intermittent growth trend, a downward trend, etc.
[0044] Among them, the target resource occupancy of the target device can be the occupancy of various resources on the target device, and the various target resources can be hardware resources and software resources on the target device, for example, including one or more of CPU usage, memory usage, system IO, network occupancy, etc.
[0045] The target number of threads for executing the job task may be determined when a specified condition is met, and the specified condition may include, for example, that the target resource occupancy reaches a set threshold or the target resource margin reaches a threshold value.
[0046] It should be understood that after obtaining the first target information, the first target information may also be recorded, so that the next target process supporting multi-threading may be started later according to the recorded first target information.
[0047] In the embodiment of the present application, the process of obtaining the change trend of the target resource occupancy of the target device as the number of threads in the target process increases is similar to the process of obtaining the change trend of the resource occupancy of the target device as the number of processes increases.
[0048] In a specific embodiment, obtaining the changing trend of the target resource occupancy of the target device as the number of threads in the target process increases may include: obtaining the first target resource occupancy of the target device at a first target time point; when the first target resource occupancy indicates that there is a margin of target resources, increasing the number of threads in the target process; obtaining the second target resource occupancy at a second target time point when the job task is executed with the increased number of threads; when the second target resource occupancy indicates that there is a margin of target resources, continuing to increase the number of threads used to execute the job task until the Nth target resource occupancy obtained at the Nth target time point indicates that there is no margin of target resources; wherein N is a positive integer greater than 2; based on the number of threads of the target device executing the job task at each target time point and the target resource occupancy of the target device at each target time point, determining the changing trend of the target resource occupancy of the target device as the number of threads in the target process increases. In this way, when the process used to execute the job task is a target process that supports multi-threading, the number of threads of the target device executing the job task at each target time point and the target resource occupancy of the target device at each target time point can be used to determine the changing trend of the target resource occupancy of the target device as the number of threads in the target process increases. This can ensure that the obtained changing trend is consistent with the actual operating conditions and has high accuracy.
[0049] The number of threads used to execute the task can be increased gradually, for example, by increasing a fixed number of threads each time, for example, by increasing one thread each time for executing the task. In this way, by increasing the same number of threads each time, the obtained change trend can be ensured to be more accurate.
[0050] Among them, when the second target resource occupancy indicates that there is no margin for the target resource, the number of threads used to execute the job task may not be further increased. Instead, the change trend of the target resource occupancy of the target device as the number of threads used to execute the job task increases can be obtained directly based on the first target resource occupancy at the first target time point and the number of threads at the first target time point (hereinafter referred to as the first thread number), and the second target resource occupancy at the second target time point and the number of threads at the second target time point (hereinafter referred to as the second thread number). Specifically, the change trend of the target resource occupancy of the target device as the number of threads in the target process increases can be obtained by comparing the quotient of the first target resource occupancy and the first thread number, and the quotient of the second target resource occupancy and the second thread number.
[0051] In the embodiment of the present application, based on the number of threads of the target device executing the job task at each target time point and the target resource occupancy of the target device at each target time point, the process of determining the change trend of the target resource occupancy of the target device as the number of threads increases can be similar to the change trend obtained based on the two target time points and the two target numbers of threads above, except that the number of target time points and the number of target threads change. The specific process will not be repeated.
[0052] In the embodiment of the present application, the target time point can be a time point after the preset window period. When the thread starts, there will be an initialization operation, and the resource occupancy will fluctuate. Generally, a period of time after the thread starts is selected as the preset window period. The time of the preset window period can vary with different software. In other words, the target resource occupancy obtained at each target time point in the embodiment of the present application can be obtained when the target resource occupancy is relatively stable.
[0053] In a specific embodiment, determining the target number of threads when the target resource occupancy of the target device shows an increasing trend as the number of threads in the target process increases may include: determining the target number of threads when the target resource occupancy of the target device shows a linear increasing trend as the number of threads in the target process increases, and the increased target resource occupancy indicates that there is no margin of target resources.
[0054] The description of steps 230 to 250 may refer to the above discussion.
[0055] In the job scheduling method provided in the embodiment of the present application, when the target device executes the job task, the resource occupancy of the target device is obtained as the number of processes used to execute the job task increases; when the resource occupancy of the target device shows a continuous increasing trend as the number of processes used to execute the job task increases, the target number of processes used to execute the job task is determined, and the target number of processes is the last process number value obtained in the process of increasing the number of processes; based on the target number of processes, the job task is executed. In this way, since the target number of processes is determined when the resource occupancy of the device is relatively high, the determined target number of processes fully utilizes the resources on the device, and the job task is executed based on the target number of processes, which can fully utilize the resources of the target device to execute the job task, thereby improving the job processing efficiency.
[0056] The job scheduling method provided in the embodiment of the present application is further explained below in conjunction with specific situations.
[0057] In daily work, system developers often need to develop tools to achieve specific needs, such as statistics on performance and sales revenue over a period of time. Such needs are short-term templates. After the developers have developed the tools, they need to execute them on electronic devices (such as servers) to obtain the required results. Many tasks are time-sensitive and need to draw conclusions as soon as possible for management decisions. In this case, developers often need to constantly adjust the tool operating parameters in order to maximize the use of server resources, complete the job as quickly as possible, and obtain the required data.
[0058] During the execution adjustment process, relevant personnel constantly conduct manual attempts. For processes that support multi-threading, they constantly adjust the thread data that is executed simultaneously, constantly monitor the data, and repeatedly measure and adjust to achieve the optimal number of thread executions. At the same time, after the thread adjustment is completed, it is often necessary to increase the number of simultaneously executed processes to use all available resources, process multiple batches of tasks at the same time, and improve processing efficiency.
[0059] Since jobs are generally developed by developers, some developers will use multi-threading technology. For such job processes, threads can be adjusted as needed; while some developers do not use multi-threading development, and for such jobs, only the number of processes can be adjusted.
[0060] When adjusting, the process includes threads, so you can start a process first and adjust the threads. After the threads are adjusted, record the comparison between the number of processes and threads as a template. When starting the process subsequently, you can start it according to this template without repeatedly adjusting the number of threads for each process.
[0061] This solution may include a scheduler and a scheduling strategy. Start the scheduling program, configure the scheduled job in the scheduler, and the scheduler will automatically detect resource usage and job parameter information, and continuously adjust according to the scheduling strategy. After reaching the optimal configuration, the job is scheduled according to the optimal configuration plan.
[0062] like Figure 3 As shown, the job scheduling method provided in the embodiment of the present application may involve a resource detection process, a thread adjustment process and a process adjustment process. The resource detection process, the thread adjustment process and the process adjustment process are discussed below.
[0063] Resource detection process Purpose: To obtain basic information about the system that is executing the job so that the operation parameters can be adjusted in the next step.
[0064] The scheduler automatically obtains the resource usage of the scheduled jobs, including CPU usage, memory usage, system IO, network occupancy, etc.
[0065] Thread Adjustment Purpose: To adjust the optimal number of threads for a process to run.
[0066] process: For processes that can adjust the number of threads, the scheduler attempts to increase the number of threads and monitors resource usage simultaneously. If resource usage and thread number follow a linear growth trend, for example, for thread number A and resource usage B, if the ratio obtained by B / A is close to the ratio obtained by thread number 1, with a deviation within 10%, the number of threads will continue to increase. During the adjustment process, the electronic device resource usage will be monitored simultaneously. If there is no resource margin, the number of threads will not be increased.
[0067] In the case where a single thread has occupied all server resources, continue to monitor resource usage and try to use the above strategy to adjust it when resource usage decreases.
[0068] The adjustment cycle starts from the process running. After the resources are occupied stably, you can select the resource usage analysis within t time (t time can be customized for 1 minute, 2 minutes, etc.). Since there will be initialization operations when the process or thread starts, the occupied resources fluctuate. Generally, a period of time after the start is selected (this time varies according to different software, you can start it manually once to get a reasonable time) as the window period to observe the resource usage. The period of stable resource usage after the window period is used as the evaluation basis. After the number of threads is adjusted, after the window period, if the continuous stable resource occupation occurs for t time, it means that this adjustment is completed. Then, you can analyze whether to make the next adjustment. When the resource usage and the number of threads do not conform to the linear growth trend or the electronic device has no resource margin, the analysis result is not to make the next adjustment, and record the final adjustment result A. For processes that cannot adjust threads, A is 1. A is the startup template parameter corresponding to the process thread. When each process is started subsequently, it is started according to the adjusted number of threads A.
[0069] Process Adjustment Purpose: Adjust the number of process executions to achieve synchronous execution of a better number of processes process: After the thread adjustment is completed, the number of process executions is adjusted, and the number of thread executions is configured according to the thread adjustment result A. The number of processes executed simultaneously is gradually increased, and the resource usage is monitored simultaneously. The resource usage and the number of processes are judged based on the linear growth trend. Whether to increase the number of process executions is determined based on the resource usage and the number of processes being in line with the linear growth trend. If the resource usage and the number of processes are in line with the linear growth trend, the number of process executions is continuously increased. At the same time, during the adjustment process, the resource usage of the electronic device is monitored simultaneously. If there is no resource margin, the number of process executions is no longer increased.
[0070] In the case where a single process has occupied all server resources, continue to monitor resource usage and try to adjust it with the above strategy when resource usage decreases.
[0071] The adjustment period of the process is consistent with the thread adjustment period, and the resource usage analysis at time t is selected as the analysis basis.
[0072] After adopting the above technical solution, the execution status of the job task can be judged in real time, and the operating parameters and the number of processes can be continuously adjusted according to the resource usage (the number of threads can be adjusted if multi-threading is supported), thereby reducing the energy and time occupied by development and operation personnel and obtaining better job scheduling parameters.
[0073] Figure 4 is a structural block diagram of a job scheduling device provided in an embodiment of the present application. Figure 4 , the job scheduling device 400 provided in the embodiment of the present application includes: An acquisition module 410 is used to acquire, when a target device executes a job task, a change trend of resource occupancy of the target device as the number of processes used to execute the job task increases; A determination module 420 is used to determine a target number of processes for executing the job task when the resource occupation of the target device shows a growing trend as the number of processes for executing the job task increases, wherein the target number of processes is the last process number value obtained in the process of increasing the number of processes; The execution module 430 is used to execute the job task based on the target process quantity.
[0074] In the job scheduling device provided in the embodiment of the present application, since the target number of processes is determined when the resource occupancy of the device is relatively high, the determined target number of processes fully utilizes the resources on the device. Job tasks are executed based on the target number of processes, and the resources of the target device can be fully utilized to execute job tasks, thereby improving job processing efficiency.
[0075] The job scheduling device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0076] Figure 5 is a schematic diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 provided in the embodiment of the present application includes: a processor 510 and a memory 520, wherein the memory 520 stores a program or instruction, and when the program or instruction is executed by the processor 510, the steps in any one of the job scheduling methods described above are implemented. For example, when the program is executed by the processor 610, the following process is implemented: when the target device executes a job task, the resource occupancy of the target device is obtained as the number of processes used to execute the job task increases; when the resource occupancy of the target device shows a continuous increasing trend as the number of processes used to execute the job task increases, the target number of processes used to execute the job task is determined, and the target number of processes is the last process number value obtained in the process of increasing the number of processes; based on the target number of processes, the job task is executed.
[0077] In the electronic device provided in the embodiment of the present application, since the target process number is determined when the resource occupancy of the device is relatively high, the determined target process number fully utilizes the resources on the device. Based on the target process number, job tasks are executed, and the resources of the target device can be fully utilized to execute job tasks, thereby improving job processing efficiency.
[0078] An embodiment of the present application also provides a computer-readable storage medium, on which a program or instruction is stored. When the program or instruction is executed, the steps in the business data transmission method provided in any embodiment of the present application are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0079] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0080] In the readable storage medium provided in the embodiment of the present application, since the target number of processes is determined when the resource occupancy of the device is relatively high, the determined target number of processes fully utilizes the resources on the device, and the job tasks are executed based on the target number of processes, which can fully utilize the resources of the target device to execute the job tasks, thereby improving the job processing efficiency.
[0081] In addition, an embodiment of the present application also provides a computer program product, including a computer program, which, when executed, implements the job scheduling method provided by any embodiment of the present application.
[0082] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the 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, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course 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, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0084] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A job scheduling method, characterized in that: include: When the target device executes a job task, obtaining a change trend of resource occupancy of the target device as the number of processes used to execute the job task increases; In the case where the resource occupation of the target device shows a growing trend as the number of processes used to execute the job task increases, determining a target number of processes used to execute the job task, the target number of processes being the last process number value obtained in the process of increasing the number of processes; Based on the target number of processes, the job task is executed.
2. The method according to claim 1, characterized in that In a case where the resource occupation of the target device shows a growing trend as the number of processes used to execute the job task increases, determining the target number of processes used to execute the job task includes: When the resource occupancy of the target device increases linearly with the increase in the number of processes used to execute the job task, and the increased resource occupancy indicates that there is no resource margin, the target number of processes used to execute the job task is determined.
3. The method according to claim 1 or 2, characterized in that: The obtaining of a change trend of the resource occupancy of the target device as the number of processes used to execute the job task increases includes: Obtaining a first resource occupancy status of the target device at a first time point; When the first resource occupancy situation indicates that there is a surplus of resources, increasing the number of processes used to execute the job task; Obtaining a second resource occupancy status at a second time point when the target device executes the job task with the increased number of processes; When the second resource occupancy situation indicates that there is a surplus of resources, continue to increase the number of processes used to execute the job task until the Nth resource occupancy situation obtained at the Nth time point indicates that there is no surplus of resources; wherein N is a positive integer greater than 2; Based on the number of processes of the target device executing the job task at each time point and the resource occupancy of the target device at each time point, a changing trend of the resource occupancy of the target device as the number of processes used to execute the job task increases is determined.
4. The method according to claim 1 or 2, characterized in that: Before obtaining the change trend of the resource occupation of the target device as the number of processes used to execute the job task increases, the method further includes: In the case where the process used to execute the job task is a target process supporting multi-threading, obtaining first target information, wherein the first target information includes the number of threads supported by the target process for simultaneous execution; A target process for executing the job task is started according to the first target information.
5. The method according to claim 4, characterized in that Get the first target information, including: When the target device executes the job task, obtaining the change trend of the target resource occupancy of the target device as the number of threads in the target process increases; In a case where the target resource occupancy of the target device shows a growing trend as the number of threads in the target process increases, determining a target number of threads, the target number of processes being the last thread number value obtained in the process of increasing the number of threads; The target number of threads is used as first target information.
6. The method according to claim 5, characterized in that In a case where the target resource occupation of the target device shows a growing trend as the number of threads in the target process increases, determining the number of target threads includes: The target number of threads is determined when the target resource occupancy of the target device increases linearly with the increase in the number of threads in the target process, and the increased target resource occupancy indicates that there is no resource margin.
7. The method according to claim 5 or 6, characterized in that: Obtaining a change trend of the target resource occupancy of the target device as the number of threads in the target process increases, including: Obtaining a first target resource occupancy status of the target device at a first target time point; When the first target resource occupancy situation indicates that there is a margin of the target resource, increasing the number of threads in the target process; Obtaining the second target resource occupancy at the second target time point when the job task is executed with the increased number of threads; When the second target resource occupancy status indicates that the target resource has a margin, continue to increase the number of threads used to execute the job task until the Nth target resource occupancy status obtained at the Nth target time point indicates that the target resource has no margin; wherein N is a positive integer greater than 2; Based on the number of threads of the target device executing the job task at each target time point and the target resource occupancy of the target device at each target time point, a changing trend of the target resource occupancy of the target device as the number of threads in the target process increases is determined.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium, characterized in that: The medium stores a program or an instruction, and when the program or the instruction is executed, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.
Citation Information
Patent Citations
Service execution method and device, terminal equipment and storage medium
CN115951954A
Resource scheduling method and device, equipment and storage medium
CN116263713A
Virtual network card detection method and device, equipment and storage medium
CN116723093A
Apparatus for dynamic data processing using resource monitoring and method thereof
KR1020130137503A
Time-bound task management in parallel processing environment
US20230168940A1