Overtime task discarding optimization method for multi-control linkage delay response

By setting operation index and delay queue management for controls, and optimizing task processing with adaptive algorithms, UI lag and resource waste caused by multi-control linkage is solved, and more efficient system performance and user experience is achieved.

CN120407129AActive Publication Date: 2025-08-01GUANGZHOU CHUANGHUI INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510903670.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-08-01
Estimated Expiration
2045-07-01

AI Technical Summary

Technical Problem

In program development, UI refresh lags and server-side pressure caused by multi-control linkage and rapid editing. Although traditional delayed loading methods avoid user input lag, they fail to effectively reduce the burden on CPU resources and servers.

Method used

Set an operation index for each basic control, and store the task in a delay queue. By comparing the index values, the task execution or discarding is determined. Combining the adaptive algorithm dynamically adjusts the delay time and CPU idle detection to optimize the task processing process.

Benefits of technology

Reduces the pressure on the client CPU, reduces the burden of server API calls, and improves the smoothness of user operations and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407129A_ABST
    Figure CN120407129A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a multi-control linkage delay response overtime task discarding optimization method which comprises the following steps: S1, setting a corresponding latest operation index for each basic control, and updating an index value MaxActionIndex of the operation index when the basic control is operated each time; s2, operation tasks of the basic control are stored in a delay queue, and each task comprises operation content and a current index value; s3, setting execution delay time of the task; s4, when the CPU is idle, obtaining the expired task M from the delay queue, and extracting an index value ActionIndexM of the expired task M; and S5, comparing and judging whether the task is discarded or not based on the Action Index M and the maximum MaxAction Index in the current delay queue. By adopting the method and the device, the concurrent quantity of the server and the pressure of the network bandwidth can be reduced, the performance of the client and the server is optimized, and the use fluency of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and specifically to an optimization method for discarding timeout tasks with delayed response of multi-control linkage. Background Art

[0002] During the process of program development and use, whether it is a B / S or C / S program, there are often multiple front-end controls linked together and fast editing needs to be supported, and each edit interacts with the server. Since fast editing and multi-control linkage both require frequent UI refreshes, and real-time linkage with the server requires frequent calls to the backend API service. These two situations will first cause UI refresh lag, and second, frequent calls to the server will increase the backend pressure, and frequent requests and responses will cause the CPU resources of the client and server to skyrocket. The traditional method is to use lazy loading operations to avoid lag, that is, the operations of the user on the control are not immediately responded to, but are responded to after a delay of 30 - 50 milliseconds. This can avoid the problem of the user's fast operations being incoherent, but the delayed tasks will continue to execute, only in the next cycle. Although there is no lag in the user's current input, all the delayed tasks in the next cycle will be executed, so the computer's CPU resources will still increase. Especially when multiple controls are linked together and the operation of one control affects the display of other controls, this impact will be greater. Coupled with the need for server-side backend calculation and verification for each operation, this lag will be more obvious. The faster the operation and the more responses, the greater the burden on the server API interface calls.

[0003] Therefore, there is an urgent need for an interaction optimization technology to ensure the efficiency of program development. Summary of the Invention

[0004] The purpose of this application is to provide an optimization method for discarding timeout tasks with delayed response of multi-control linkage to solve the technical problems proposed in the above background art.

[0005] To achieve the above purpose, this application discloses the following technical solutions: An optimization method for discarding timeout tasks with delayed response of multi-control linkage, including the following steps: S1 - Set the corresponding latest operation index for each basic control, and update the index value MaxActionIndex of this operation index each time an operation is performed on the basic control; S2 - Store the operation tasks of the basic control in a delay queue, and each task in the delay queue includes the operation content and the current index value MaxActionIndex when it is pushed into the queue; S3 - Set the execution delay time of the tasks in the delay queue; S4 - When the CPU is idle, obtain the due task M from the delay queue, and extract the index value ActionIndexM of the operation index carried by the due task M; S5 - Compare ActionIndexM with the maximum MaxActionIndex in the current delay queue; S51 - If ActionIndexM is equal to the maximum MaxActionIndex, perform the following operations: S511 - Call the backend API to perform data verification on the content of the basic control; S512 - Notify the linked control to perform synchronous refresh based on the latest basic control value; S52 - If ActionIndexM is less than the maximum MaxActionIndex, discard the due task, and repeat S4 - S5 until the index value ActionIndexm corresponding to a due task m is equal to the maximum MaxActionIndex in the delay queue during this comparison.

[0006] Preferably, when S4 is executed, it supports continuously receiving new operations and pushing the tasks corresponding to the new operations into the delay queue.

[0007] Preferably, in S3, the setting of the execution delay time is based on the dynamic balance principle of avoiding UI jank and CPU resource waste.

[0008] Preferably, the execution delay time is 30 - 50 milliseconds.

[0009] Preferably, the index value MaxActionIndex is a globally unique increasing integer, and a new index value is automatically generated by incrementing by 1 in chronological order each time the basic control is operated; the delay queue is a priority queue, and the tasks in the queue are arranged in descending or ascending order of the index value.

[0010] Preferably, the execution delay time is dynamically adjusted by an adaptive algorithm, and the adaptive algorithm is: when the operation frequency of the basic control within a unit time exceeds the threshold, automatically shorten the delay time; when the system CPU load is higher than the set threshold, automatically extend the delay time.

[0011] Preferably, the judgment mechanism for whether the CPU is idle is: real - time monitor the system CPU utilization rate, and when the CPU utilization rate is lower than the preset threshold within consecutive N milliseconds, trigger the task execution process in the delay queue, where N is a configurable time parameter.

[0012] Preferably, the synchronous refresh of the linked control adopts a differential caching mechanism, and the differential caching mechanism is: only when there is a difference between the latest value and the cached value of the basic control, trigger the UI update of the linked control.

[0013] Preferably, the S52 further includes: generating a performance analysis log for the discarded task, where the performance analysis log includes: the recorded reason for discarding and context information.

[0014] Preferably, the method further includes: based on the performance analysis log, performing a timing analysis on the index value sequence of the discarded task, establishing a task discard trend prediction model, and dynamically adjusting the capacity threshold of the delay queue and the CPU idle detection sensitivity based on the prediction model.

[0015] Beneficial effects: The method for optimizing the discarding of timeout tasks with multi-control linkage delay response in this application, on the basis of delayed execution, through the timeout task discard mechanism, discards timeout tasks such as the response of unnecessary client basic controls, the invocation of server-side APIs, and the response of linkage controls after timeout, that is, no longer needs to be executed, thereby reducing the pressure on the client's CPU, reducing unnecessary API calls, and also reducing the pressure on the server-side concurrency and network bandwidth. It can solve the problem of the discontinuous UI experience of users' rapid operations, optimize the performance of the client and the server, and improve the user's usage fluency. Description of the Drawings

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0017] Figure 1 It is a flowchart of the method for optimizing the discarding of timeout tasks with multi-control linkage delay response provided by the embodiment of the present application. Detailed Embodiments

[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0019] In this document, the term "comprising" is intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0020] During application development and use, both B / S and C / S applications often involve multiple front-end controls and require fast editing, with each edit requiring interaction with the server. Fast editing and multi-control linkage require frequent UI refreshes, while real-time server interaction requires frequent calls to back-end API services. These two scenarios can cause UI refresh lags and, secondly, increased back-end pressure due to frequent server calls. Frequent requests and responses can significantly increase CPU usage on both the client and server. Traditionally, delayed loading is used to mitigate this lag. Instead of responding immediately to user actions on controls, the response is delayed by 30-50 milliseconds. This prevents choppy operation, but delayed loading tasks continue to execute in the next cycle. While the user's current input is not lag-free, the execution of delayed tasks in the next cycle still increases CPU usage. This impact is particularly pronounced when multiple controls are linked, where the operation of one control affects the display of others. Furthermore, when each operation requires server-side back-end computation and verification, the lag is even more pronounced. The faster the operation and the more frequent the response, the greater the burden on the server API calls.

[0021] Based on this, this embodiment provides a Figure 1 The timeout task discarding optimization method for delayed response of multi-control linkage shown is an optimization method for front-end multi-control linkage, fast editing, and frequent interaction with the server, including the following steps: S1-Set the latest operation index for each basic control. Update the index value MaxActionIndex of the operation index each time the basic control is operated. Each control maintains MaxActionIndex independently without interfering with each other. S2-Store the basic control's operation tasks into the delay queue. Each task in the delay queue includes the operation content and the current index value MaxActionIndex when it is pushed into the queue; S3-Set the execution delay time of tasks in the delay queue; S4 - When the CPU is idle, obtain the expired task M from the delay queue, and extract the index value ActionIndexM of the operation index carried by the expired task M; the expired task refers to tasks such as the response of the client - side basic control that should be executed immediately or has timed out according to the time sequence, the call of the server - side API, the response of the linked control, etc. S5 - Compare ActionIndexM with the maximum MaxActionIndex in the current delay queue. S51 - If ActionIndexM is equal to the maximum MaxActionIndex, then perform the following operations: S511 - Call the backend API to perform data verification on the basic control content (including legality, numerical range, and logical conflict verification). S512 - Notify the linked control to perform synchronous refresh based on the latest basic control value. S52 - If ActionIndexM is less than the maximum MaxActionIndex, then discard the expired task, and repeat S4 - S5 until the index value ActionIndexm of an expired task m is equal to the maximum MaxActionIndex in the delay queue during this comparison.

[0022] In this embodiment, when S4 is executed, it supports continuously receiving new operations and pushing the tasks corresponding to the new operations into the delay queue, forming a dynamic task - processing loop. That is, when the CPU is idle, it fetches the delayed tasks. Regardless of whether the judgment result is to execute or not, the user can still continue to operate the basic control, and at the same time, push new delayed tasks, and so on in a loop.

[0023] In this embodiment, the setting of the execution delay time is based on the dynamic balance principle of avoiding UI jank and wasting CPU resources. Feasibly, the execution delay time can be 30 - 50 milliseconds.

[0024] Furthermore, in order to improve the CPU operation efficiency and quality, as a preferred implementation manner of this embodiment, the execution delay time is dynamically adjusted by an adaptive algorithm. The adaptive algorithm is as follows: when the operation frequency of the basic control within a unit time exceeds the threshold, the delay time is automatically shortened to improve the response speed; when the system CPU load is higher than the set threshold, the delay time is automatically extended to avoid resource competition.

[0025] Specifically, the calculation formula for the execution delay time is:

[0026] where is the initial delay time (30 - 50 ms); is the operation frequency of the basic control within a unit time (times / second), and the number of operations within the most recent 1 second is statistically counted through a sliding window; is the CPU load rate (0 - 1), and the exponentially weighted moving average (EMA) within the past 5 seconds is taken; and is the adjustment coefficient, , , and is dynamically optimized through a machine learning model.

[0027] The calculation logic is that the higher the operation frequency ( the larger), the smaller the exponential term , and the shorter the latency; the higher the CPU load ( the larger), the smaller the exponential term (because ), the longer the latency, and dynamic balance is achieved through non - linear transformation.<s

[0028] Feasibly, the task queue can be polled according to the CPU time slice. Preferably, in order to improve the task response efficiency, in this embodiment, the index value MaxActionIndex is a globally unique increasing integer, and a new index value is automatically incremented by 1 in chronological order each time the basic control is operated; the delay queue is a priority queue, and the tasks in the queue are arranged in descending or ascending order of the index value, so that the expired tasks with lower index values can be preferentially retrieved and processed when the CPU is idle, thereby improving the sequential execution efficiency of "timeout tasks" and avoiding task response omissions.

[0029] Further, in order to ensure the efficient operation of the CPU and accurately determine whether it is idle, as a preferred implementation manner of this embodiment, the judgment mechanism for whether the CPU is idle is: real - time monitoring of the system CPU utilization rate, and when the CPU utilization rate is lower than the preset threshold within consecutive N milliseconds, the task execution process in the delay queue is triggered, where N is a configurable time parameter.

[0030] Specifically, the judgment mechanism is:

[0031] where, is the CPU utilization rate within consecutive N milliseconds; is the preset threshold of the CPU utilization rate, such as 30%; is the time instant of the CPU utilization rate (the value is 0 - 100%).

[0032] The calculation logic is to calculate the average utilization rate within consecutive N milliseconds through a sliding integration window, and when the average value is lower than the threshold, it is determined to be idle. Using an integration window instead of simple mean calculation avoids instantaneous fluctuation interference, and determines the CPU idle state through the accumulation of consecutive time periods, improving stability.

[0033] Further, to avoid repeated ineffective refresh operations, as a preferred implementation manner of this embodiment, the synchronous refresh of the linkage control adopts a differential caching mechanism, and the differential caching mechanism is: only when there is a difference between the latest value of the base control and the cached value, the UI update of the linkage control is triggered.

[0034] Specifically, the differential caching mechanism is:

[0035] Among them, is the latest value of the base control, that is, the real-time value after the user's current input or modification (such as the content of the text box, the selected value of the drop-down box, etc.); is the cached value of the base control, that is, the value stored after the last effective operation (stored in the client memory or cache); is a hash function, using polynomial rolling hash, such as:

[0036] is a large prime number, such as etc.; is the modulus, such as or a custom positive integer.

[0037] Compare the hash values of the new value and the cached value, and trigger a refresh when they are inconsistent ( ).

[0038] The calculation logic is to compare by hash values instead of comparing field by field, reducing the data comparison overhead. Polynomial rolling hash supports incremental updates and improves the efficiency of difference detection.

[0039] Feasibly, the S52 further includes: generating a performance analysis log for the discarded tasks, and the performance analysis log includes: the recorded reasons for discarding and context information.

[0040] Further, to ensure the efficient operation of the CPU, feasibly, this method further includes: based on the performance analysis log, performing a timing analysis on the index value sequence of the discarded tasks, establishing a task discard trend prediction model, and dynamically adjusting the capacity threshold of the delay queue and the CPU idle detection sensitivity based on the prediction model.

[0041] Specifically, the logic of dynamic adjustment is: Calculate the task discard trend prediction value representing the task discard rate trend in the predicted future unit time at time t (the larger the value, the higher the discard risk), and the calculation formula is:

[0042] Among them, is the current latest operation index; is the index value of the i-th discarded task (the nearest n tasks are taken in reverse chronological order); , and are the weight, slope parameter, and bias term obtained through training of the LSTM neural network respectively; is the rectified linear unit, which filters out invalid samples with an index difference less than 0. Since the index value increases monotonically, the difference must be non-negative, and here it serves as a robustness check.

[0043] Learn the index difference distribution of historical discarded tasks through the LSTM network to predict the trend of task discard rate in the future unit time. When the predicted discard rate exceeds the threshold, automatically expand the capacity of the delay queue or reduce the CPU idle detection threshold (such as adjusting from 30% to 25%) to trigger task processing in advance to reduce discard.

[0044] In summary, the timeout task discard optimization method for multi-control linkage delay response in this embodiment, through a three-dimensional technical solution of index identification timing - queue buffer tasks - dynamically discard old tasks - adaptive resource scheduling - intelligent UI refresh - log-driven optimization, breaks through the limitation of traditional lazy loading that only solves UI jankiness, and realizes the full-chain optimization from client operations, server interactions to system resource scheduling.

[0045] In the embodiments provided in the present application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code, or any suitable combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, or other electronic units designed to implement the functions described herein, or a combination thereof. For software implementation, part or all of the processes of the embodiments can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. The computer-readable storage medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium that can be accessed by a computer. The computer-readable storage medium can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM, or other optical disc storage, magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.

[0046] Finally, it should be noted that the above are only the preferred embodiments of the present application and are not used to limit the present application. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A timeout task discarding optimization method for multi-control linkage delayed response, characterized in that, The method includes the following steps: S1 - Set a corresponding latest operation index for each basic control, and update the index value MaxActionIndex of this operation index each time an operation is performed on the basic control; S2 - Store the operation tasks of the basic control into a delay queue, and each task in the delay queue includes the operation content and the current index value MaxActionIndex when it is pushed into the queue; S3 - Set the execution delay time of the tasks in the delay queue; S4 - When the CPU is idle, obtain the expired task M from the delay queue, and extract the index value ActionIndexM of the operation index carried by the expired task M; S5 - Compare ActionIndexM with the largest MaxActionIndex in the current delay queue; S51 - If ActionIndexM is equal to the largest MaxActionIndex, then perform the following operations: S511 - Call the backend API to perform data verification on the content of the basic control; S512 - Notify the linked control to perform synchronous refresh based on the latest basic control value; S52 - If ActionIndexM is less than the largest MaxActionIndex, discard the expired task, and repeat S4 - S5 until the index value ActionIndexm corresponding to an expired task m is equal to the largest MaxActionIndex in the delay queue during this comparison.

2. The timeout task discard optimization method for multi-control linkage delayed response according to claim 1, characterized in that, When S4 is executed, it supports continuously receiving new operations and pushing the tasks corresponding to the new operations into the delay queue.

3. The timeout task discarding optimization method for multi-control linkage delayed response according to claim 1, characterized in that In S3, the setting of the execution delay time is based on the dynamic balance principle of avoiding UI jank and CPU resource waste.

4. The timeout task discarding optimization method for multi-control linkage delayed response according to claim 3, wherein The execution delay time is 30 - 50 milliseconds.

5. The timeout task discarding optimization method for multi-control linkage delay response according to claim 1, characterized in that The index value MaxActionIndex is a globally unique increasing integer, and a new index value is automatically generated by incrementing by 1 in chronological order each time the basic control is operated; the delay queue is a priority queue, and the tasks in the queue are arranged in descending or ascending order of the index value.

6. The timeout task discarding optimization method for multi-control linkage delay response according to claim 3 or 4, characterized in that, The execution delay time is dynamically adjusted by an adaptive algorithm, and the adaptive algorithm is: when the operation frequency of the basic control per unit time exceeds the threshold, the delay time is automatically shortened; when the system CPU load is higher than the set threshold, the delay time is automatically extended.

7. The timeout task discarding optimization method for multi-control linkage delay response according to claim 1, characterized in that The judgment mechanism for whether the CPU is idle is: monitor the system CPU utilization rate in real time, and when the CPU utilization rate is lower than the preset threshold for N consecutive milliseconds, trigger the task execution process in the delay queue, where N is a configurable time parameter.

8. The timeout task discarding optimization method for multi-control linkage delayed response according to claim 1, characterized in that, The synchronous refresh of the linked control adopts a differential caching mechanism, and the differential caching mechanism is: only when there is a difference between the latest value of the basic control and the cached value, trigger the UI update of the linked control.

9. The timeout task discarding optimization method for multi-control linkage delayed response according to claim 1, wherein S52 also includes: generating a performance analysis log for the discarded tasks, and the performance analysis log includes: the recorded reason for discarding and the context information.

10. The timeout task discarding optimization method for multi-control linkage delay response according to claim 9, wherein, The method further includes: performing a time series analysis on the index value sequence of the discarded tasks based on the performance analysis log, establishing a task discard trend prediction model, and dynamically adjusting the capacity threshold of the delay queue and the CPU idle detection sensitivity based on the prediction model.

Citation Information

Patent Citations

  • Page event processing method and device, computer device and storage medium

    CN109634756A

  • Control operation method, mobile terminal and computer readable storage medium

    CN110109723A

  • Information processing device and method

    US20040088273A1