CN-122019109-A - Task scheduling method, device, equipment, medium and product
Abstract
The disclosure provides a task scheduling method, a task scheduling device, task scheduling equipment, task scheduling media and task scheduling products. The method comprises the steps of obtaining the task number and/or task execution duration corresponding to historical rendering frames of a visual page, determining the task number of a next rendering frame to be executed based on the task number and/or task execution duration corresponding to the historical rendering frames, determining a task group corresponding to the next rendering frame in a non-executed task based on the task number of the next rendering frame, and executing the task group in the time corresponding to the next rendering frame. By dynamically determining the number of tasks of each rendering frame, frame overtime or resource waste caused by fixed batch tasks is avoided, frame synchronization is realized, and flexibility of task scheduling is improved.
Inventors
- Pang Gai
Assignees
- 杭州网易智企科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260313
Claims (10)
- 1. A method for task scheduling, comprising: Acquiring the task number and/or task execution time length corresponding to the historical rendering frames of the visual page; determining the task number of the next rendering frame to be executed based on the task number and/or task execution duration corresponding to the historical rendering frame; and determining a task group corresponding to the next rendering frame in the unexecuted tasks based on the task number of the next rendering frame, and executing the task group in the time corresponding to the next rendering frame.
- 2. The method according to claim 1, wherein determining the number of tasks of the next rendering frame to be performed based on the number of tasks and/or task execution duration corresponding to the historical rendering frame comprises at least one of: determining a first task number of the next rendering frame to be executed based on a task growth strategy and the task number corresponding to the historical rendering frame; determining a second task number of the next rendering frame to be executed based on the duration of the next rendering frame and the task execution duration corresponding to the historical rendering frame; and determining a third task number of the next rendering frame to be executed based on the first task number and the second task number.
- 3. The method of claim 2, wherein determining the first number of tasks for the next rendered frame to be performed based on a task growth policy and the number of tasks corresponding to the historical rendered frame comprises: Determining an operation stage to which the next rendering frame belongs based on the operation time length and/or the task number corresponding to the historical rendering frame; Determining a corresponding growth parameter of an operation stage to which the next rendering frame belongs based on the task growth strategy; and determining a first task number of the next rendering frame to be executed based on the growth parameter and the task number corresponding to the historical rendering frame.
- 4. A method according to claim 3, wherein determining the run phase to which the next rendered frame belongs based on the run length and/or the number of tasks corresponding to the historical rendered frame comprises: determining that the operation phase to which the next rendering frame belongs is a cold start phase under the condition that the operation time length is smaller than a cold start time length threshold value; When the running time length is greater than or equal to the cold start time length threshold value and the task number corresponding to the historical rendering frame is less than a set batch threshold value, determining that the running phase to which the next rendering frame belongs is a first batch phase; When the running time length is greater than or equal to the cold start time length threshold value and the task number corresponding to the historical rendering frame is greater than or equal to the set batch threshold value, determining that the running stage to which the next rendering frame belongs is a second batch stage; And the growth parameters respectively corresponding to the cold start stage, the first batch stage and the second batch stage are sequentially reduced.
- 5. The method of claim 2, wherein determining the second number of tasks for the next rendered frame to be performed based on the duration of the next rendered frame and the task execution duration corresponding to the historical rendered frame comprises: Determining a theoretical task amount based on the ratio of the duration of the next rendering frame to the task execution duration corresponding to the historical rendering frame; And adjusting the theoretical task amount based on a safety coefficient to obtain a second task amount of the next rendering frame to be executed, wherein the safety coefficient is smaller than 1.
- 6. The method according to any one of claims 1-5, further comprising: determining the residual time length for completing execution of a task group corresponding to the current rendering frame aiming at any rendering frame; Waiting for the next rendering frame to continue executing the task under the condition that the residual duration is less than the lower time threshold; If the residual time length is greater than the task group execution time length threshold, continuing to execute the next task group in the residual time of the current rendering frame; And under the condition that the residual time length is larger than a lower time limit time threshold and smaller than or equal to the task group execution time length threshold, determining the number of executable tasks of the current rendering frame based on the residual time length, and continuing to execute tasks corresponding to the number of executable tasks in the residual time of the current rendering frame.
- 7. A task scheduling device, comprising: the information acquisition module is used for acquiring the task number and/or task execution duration corresponding to the historical rendering frame of the visual page; the task number determining module is used for determining the task number of the next rendering frame to be executed based on the task number and/or task execution duration corresponding to the historical rendering frame; And the task scheduling module is used for determining a task group corresponding to the next rendering frame in the unexecuted tasks based on the task number of the next rendering frame, and executing the task group in the time corresponding to the next rendering frame.
- 8. An electronic device, the electronic device comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the task scheduling method of any one of claims 1-6.
- 9. A computer readable storage medium storing computer instructions for causing a processor to implement the task scheduling method of any one of claims 1-6 when executed.
- 10. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the task scheduling method according to any one of claims 1-6.
Description
Task scheduling method, device, equipment, medium and product Technical Field The embodiment of the disclosure relates to the technical field of task scheduling, in particular to a task scheduling method, device, equipment, medium and product. Background In the field of visual development, core processes such as canvas rendering, node layout, wire routing, attribute panel interaction, preview code generation and the like often involve a large number of calculation and DOM operations, and the characteristic of a JavaScript single-thread execution environment makes a long task easily block a main thread, so that page jam and frame dropping are caused, and the smoothness of visual development is affected. Disclosure of Invention The embodiment of the disclosure provides a task scheduling method, device, equipment, medium and product, which dynamically determine the number of tasks corresponding to each rendering frame in the visual development process, avoid the problem of page blocking or frame dropping caused by frame timeout, and avoid resource waste. According to an aspect of the present disclosure, there is provided a task scheduling method, including: Acquiring the task number and/or task execution time length corresponding to the historical rendering frames of the visual page; determining the task number of the next rendering frame to be executed based on the task number and/or task execution duration corresponding to the historical rendering frame; and determining a task group corresponding to the next rendering frame in the unexecuted tasks based on the task number of the next rendering frame, and executing the task group in the time corresponding to the next rendering frame. Optionally, determining the task number of the next rendering frame to be executed based on the task number and/or task execution duration corresponding to the historical rendering frame includes at least one of the following: determining a first task number of the next rendering frame to be executed based on a task growth strategy and the task number corresponding to the historical rendering frame; determining a second task number of the next rendering frame to be executed based on the duration of the next rendering frame and the task execution duration corresponding to the historical rendering frame; and determining a third task number of the next rendering frame to be executed based on the first task number and the second task number. Optionally, determining, based on a task growth policy and the number of tasks corresponding to the historical rendering frame, the first number of tasks of the next rendering frame to be executed includes: Determining an operation stage to which the next rendering frame belongs based on the operation time length and/or the task number corresponding to the historical rendering frame; Determining a corresponding growth parameter of an operation stage to which the next rendering frame belongs based on the task growth strategy; and determining a first task number of the next rendering frame to be executed based on the growth parameter and the task number corresponding to the historical rendering frame. Optionally, determining, based on the operation duration and/or the number of tasks corresponding to the historical rendering frame, an operation stage to which the next rendering frame belongs includes: determining that the operation phase to which the next rendering frame belongs is a cold start phase under the condition that the operation time length is smaller than a cold start time length threshold value; When the running time length is greater than or equal to the cold start time length threshold value and the task number corresponding to the historical rendering frame is less than a set batch threshold value, determining that the running phase to which the next rendering frame belongs is a first batch phase; When the running time length is greater than or equal to the cold start time length threshold value and the task number corresponding to the historical rendering frame is greater than or equal to the set batch threshold value, determining that the running stage to which the next rendering frame belongs is a second batch stage; And the growth parameters respectively corresponding to the cold start stage, the first batch stage and the second batch stage are sequentially reduced. Optionally, determining, based on the duration of the next rendering frame and the task execution duration corresponding to the historical rendering frame, a second number of tasks of the next rendering frame to be executed includes: Determining a theoretical task amount based on the ratio of the duration of the next rendering frame to the task execution duration corresponding to the historical rendering frame; And adjusting the theoretical task amount based on a safety coefficient to obtain a second task amount of the next rendering frame to be executed, wherein the safety coefficient is smaller than 1. Optionally, t