Batch task processing optimization method and system
The optimization method and system automatically adjust backend server concurrency using a proxy model to optimize resource utilization in batch task processing, addressing inefficiencies and environmental changes.
Patent Information
- Application Number
- CN202310672429.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2024-12-17
AI Technical Summary
Existing batch task processing systems face inefficiencies due to manual determination of optimal processing capacity, leading to resource waste or overload, and require manual recalibration when environments change.
An optimization method and system that automatically adjusts backend server concurrency based on real-time processing metrics, using a proxy model to evaluate and adapt to new environments without manual intervention.
Optimizes resource utilization by dynamically adjusting task concurrency, ensuring efficient processing without manual adjustments, even when environmental conditions change.
Smart Images

Figure CN119149180A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an optimization method and system for batch task processing. Background Art
[0002] Currently, the task queue stores pending tasks, and the backend server pulls one or a batch of requests from the task queue. When the backend server processes the request, it saves the processed result.
[0003] The above process has the following problems: 1) When the number of requests pulled by the backend server is too small, the backend server load will be low, resulting in a waste of resources; when the number of requests pulled by the backend server is too large, the backend server load will be too high, resulting in memory exhaustion. 2) The optimal processing capacity is determined manually, but the manual determination method is only applicable to the current environment. If the current environment changes, a new optimal processing capacity needs to be determined again through experiments. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide an optimization method and system for batch task processing, which automatically adjusts and adapts to new environments through an agent model, thereby optimizing resource utilization without the need for manual adjustment.
[0005] In a first aspect, an embodiment of the present invention provides an optimization method for batch task processing, which is applied to a proxy model. The method includes:
[0006] Pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and calculate the average time consumption of each batch of request information, where N is greater than 2;
[0007] The amount of data to be sent in each batch of request information is used as the task concurrency amount;
[0008] Counting the number of request messages successfully processed within a preset time interval, and taking the number of request messages successfully processed as the total processing amount per unit interval;
[0009] The concurrency of the backend server is evaluated according to the total processing volume per unit interval, the task concurrency and the average time consumption.
[0010] Furthermore, the method further comprises:
[0011] After receiving the first processing result corresponding to the first batch of request information sent by the back-end server, sending the second batch of request information pulled from the task queue to the back-end server;
[0012] After receiving the second processing result corresponding to the second batch of request information sent by the backend server, sending the Nth batch of request information pulled from the task queue to the backend server;
[0013] Receive the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
[0014] Further, the concurrency of the backend server is evaluated according to the total processing volume per unit interval, the task concurrency and the average time consumption, including:
[0015] When the increase in the total processing volume per unit interval is greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased;
[0016] When the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server;
[0017] When the reduction in the total processing volume per unit interval is greater than a first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
[0018] Furthermore, the data volume of each batch of request information increases or decreases successively.
[0019] In a second aspect, an embodiment of the present invention provides an optimization system for batch task processing, which is applied to an agent model, and the system includes:
[0020] A pulling module is used to pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and calculate the average time consumption of each batch of request information, where N is greater than 2;
[0021] A task concurrency acquisition module, used to take the amount of data to be sent in each batch of request information as the task concurrency;
[0022] A statistics module, used to count the number of request messages successfully processed within a preset time interval, and use the number of request messages successfully processed as the total processing amount per unit interval;
[0023] An evaluation module is used to evaluate the concurrency of the backend server based on the total processing volume per unit interval, the task concurrency and the average time consumption.
[0024] Furthermore, the system also includes:
[0025] A first processing result receiving module is used to send the second batch of request information pulled from the task queue to the back-end server after receiving the first processing result corresponding to the first batch of request information sent by the back-end server;
[0026] A second processing result receiving module is used for sending the Nth batch of request information pulled from the task queue to the backend server after receiving the second processing result corresponding to the second batch of request information sent by the backend server;
[0027] The Nth processing result receiving module is used to receive the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
[0028] Furthermore, the evaluation module is specifically used for:
[0029] When the increase in the total processing volume per unit interval is greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased;
[0030] When the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server;
[0031] When the reduction in the total processing volume per unit interval is greater than a first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
[0032] Furthermore, the data volume of each batch of request information increases or decreases successively.
[0033] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described above when executing the computer program.
[0034] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the method as described above.
[0035] The embodiment of the present invention provides an optimization method and system for batch task processing, which is applied to a proxy model, including: pulling the first batch of request information from a task queue, sending the first batch of request information to a back-end server, pulling N batches of request information in sequence, and counting the average time consumption of each batch of request information, where N is greater than 2; using the amount of data to be sent in each batch of request information as the task concurrency; counting the number of request information successfully processed within a preset time interval, and using the number of request information successfully processed as the total processing volume per unit interval; evaluating the concurrency of the back-end server based on the total processing volume per unit interval, the task concurrency and the average time consumption; automatically adjusting and adapting to the new environment through the proxy model, thereby optimizing resource utilization without the need for manual adjustment.
[0036] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flow chart of a method for optimizing batch task processing provided in Embodiment 1 of the present invention;
[0040] Figure 2 A flowchart of step S104 in the batch task processing optimization method provided in the first embodiment of the present invention;
[0041] Figure 3 A schematic diagram of an optimization system for batch task processing provided in Embodiment 2 of the present invention.
[0042] icon:
[0043] 1-Pull module; 2-Task concurrency acquisition module; 3-Statistics module; 4-Evaluation module. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Currently, the task queue stores pending tasks, and the backend server pulls one or a batch of requests from the task queue. When the backend server processes the request, it saves the processed result.
[0046] The above processing has the following problems: 1) When the number of requests pulled by the backend server is too small, the backend server load will be low, resulting in a waste of resources; when the number of requests pulled by the backend server is too large, the backend server load will be too high, resulting in memory exhaustion. 2) The optimal processing capacity is determined manually, and the manual determination method is only applicable to the current environment. If the current environment changes, it is necessary to re-determine the new optimal processing capacity through experiments. This application optimizes system resource utilization through a proxy model without changing the existing backend server.
[0047] To facilitate understanding of this embodiment, the embodiment of the present invention is described in detail below.
[0048] Embodiment 1:
[0049] Figure 1 This is a flow chart of an optimization method for batch task processing provided in Example 1 of the present invention.
[0050] Reference Figure 1 , applied to the proxy model, the method comprises the following steps:
[0051] Step S101, pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and count the average time consumed by each batch of request information, where N is greater than 2;
[0052] Step S102, taking the amount of data to be sent in each batch of request information as the task concurrency amount;
[0053] Here, the task queue is stored in a system provided by an external third party for the purpose of decoupling.
[0054] Specifically, after the first batch of request information is pulled from the task queue and sent to the back-end server, the second batch of request information is pulled from the task queue but not sent. The second batch of request information may be 2 pieces of data. When the first processing results corresponding to the first batch of request information are returned from the back-end server, the average time consumed for each batch of request information is counted, and the second batch of request information is sent to the back-end server, and so on.
[0055] When the proxy model sends the first batch of request information to the backend server, it takes 1 second, and the average time is 1 second;
[0056] When the proxy model sends the second batch of request information to the backend server, it rounds up to (1*105%) = 2 pieces of data, which takes 1 second, and the average time is 1 second; ...
[0057] When the proxy model sends the Nth batch of request information to the backend server, it rounds up to ((the number of n-1 batches)*105%)=600 pieces of data, which takes 1.6 seconds, and the average time is 1.6 seconds.
[0058] Step S103, counting the number of request messages that are successfully processed within a preset time interval, and taking the number of request messages that are successfully processed as the total processing amount per unit interval;
[0059] Step S104, evaluating the concurrency of the backend server according to the total processing volume per unit interval, the concurrency of tasks and the average time consumption.
[0060] Specifically, since the amount of data to be sent in each batch is increasing, but the concurrency of the backend server is limited and cannot be increased indefinitely.
[0061] For example, when the proxy model sends the 600th batch of 600 data to the backend server, it takes 1.6 seconds, an average of 1.6 seconds, and 3750 data are processed within the preset time interval (10 seconds); ...
[0062] When the proxy model sent the 700th batch of 700 data to the backend server, it took 2.3 seconds, an average of 2.3 seconds, and 3751 data were processed within the preset time interval (10 seconds). At this time, it was found that the processing volume of the backend server did not change much within 10 seconds, indicating that the maximum load of the backend server had been exceeded;
[0063] When the proxy model sends the 701th data to the backend server, it rounds up to (700*95%)=665 data, takes 2.1 seconds, and takes an average of 2.1 seconds. 3750 data are processed within the preset time interval (10 seconds).
[0064] Further, see Figure 2 , step S104 includes the following steps:
[0065] Step S201, when the increase in the total processing volume per unit interval is greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased;
[0066] Step S202, when the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server;
[0067] Step S203: When the reduction in the total processing volume per unit interval is greater than the first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
[0068] Specifically, the first preset data volume threshold may be 5%. When the increase in the total processing volume per unit interval is greater than 5%, it indicates that the backend server has not reached the maximum load, and the task concurrency may be increased, that is, the number of concurrently sent requests may be increased;
[0069] When the total processing volume per unit interval fluctuates within plus or minus 5%, the increase in average time consumption is greater than 5%, indicating that the backend server has reached its maximum load. The concurrent task volume is taken as the maximum load of the backend server.
[0070] When the reduction in the total processing volume per unit interval is greater than 5%, it indicates that changes have occurred in the backend server and its maximum load (ie, processing limit) has been exceeded, and the number of concurrently sent requests should be reduced.
[0071] The adaptive algorithm of the present application can make full use of existing resources without manual adjustment. When the backend server changes, such as adding or reducing resources, the backend server can automatically adjust and adapt to the new environment.
[0072] Furthermore, the method further comprises the following steps:
[0073] Step S301, after receiving the first processing result corresponding to the first batch of request information sent by the backend server, the second batch of request information pulled from the task queue is sent to the backend server;
[0074] Step S302, after receiving the second processing result corresponding to the second batch of request information sent by the backend server, sending the Nth batch of request information pulled from the task queue to the backend server;
[0075] Step S303: receiving the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
[0076] Furthermore, the data volume of each batch of request information increases or decreases successively.
[0077] An embodiment of the present invention provides an optimization method for batch task processing, which is applied to a proxy model, including: pulling the first batch of request information from a task queue, sending the first batch of request information to a back-end server, pulling N batches of request information in sequence, and counting the average time consumption of each batch of request information, where N is greater than 2; using the amount of data to be sent in each batch of request information as the task concurrency; counting the number of request information successfully processed within a preset time interval, and using the number of request information successfully processed as the total processing volume per unit interval; evaluating the concurrency of the back-end server based on the total processing volume per unit interval, the task concurrency and the average time consumption; automatically adjusting and adapting to the new environment through the proxy model, thereby optimizing resource utilization without the need for manual adjustment.
[0078] Embodiment 2:
[0079] Figure 3 A schematic diagram of an optimization system for batch task processing provided in Embodiment 2 of the present invention.
[0080] Reference Figure 3 , applied to the proxy model, the system includes:
[0081] Pull module 1 is used to pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and calculate the average time consumption of each batch of request information, where N is greater than 2;
[0082] Task concurrency acquisition module 2, used to take the amount of data to be sent in each batch of request information as the task concurrency;
[0083] A statistics module 3 is used to count the number of request information successfully processed within a preset time interval, and use the number of request information successfully processed as the total processing amount per unit interval;
[0084] Evaluation module 4 is used to evaluate the concurrency of the backend server based on the total processing volume per unit interval, the task concurrency and the average time consumption.
[0085] Furthermore, the system also includes:
[0086] A first processing result receiving module (not shown) is used to receive the first processing results corresponding to the first batch of request information sent by the backend server, and then send the second batch of request information pulled from the task queue to the backend server;
[0087] A second processing result receiving module (not shown) is used to receive the second processing result corresponding to the second batch of request information sent by the backend server, and then send the Nth batch of request information pulled from the task queue to the backend server;
[0088] The Nth processing result receiving module (not shown) is used to receive the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
[0089] Furthermore, the evaluation module 4 is specifically used for:
[0090] When the total processing volume per unit interval increases to a value greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased;
[0091] When the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server;
[0092] When the total processing volume per unit interval is reduced to be greater than the first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
[0093] Furthermore, the data volume of each batch of request information increases or decreases successively.
[0094] An embodiment of the present invention provides an optimization system for batch task processing, which is applied to a proxy model, including: pulling the first batch of request information from a task queue, sending the first batch of request information to a back-end server, pulling N batches of request information in sequence, and counting the average time consumption of each batch of request information, where N is greater than 2; using the amount of data to be sent in each batch of request information as the task concurrency; counting the number of request information successfully processed within a preset time interval, and using the number of request information successfully processed as the total processing volume per unit interval; evaluating the concurrency of the back-end server based on the total processing volume per unit interval, the task concurrency and the average time consumption; automatically adjusting and adapting to the new environment through the proxy model, thereby optimizing resource utilization without the need for manual adjustment.
[0095] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the batch task processing optimization method provided in the above embodiment are implemented.
[0096] An embodiment of the present invention further provides a computer-readable medium having a non-volatile program code executable by a processor, wherein a computer program is stored on the computer-readable medium, and when the computer program is executed by the processor, the steps of the batch task processing optimization method of the above embodiment are executed.
[0097] The computer program product provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment and will not be repeated here.
[0098] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0099] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0100] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0101] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0102] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for optimizing batch task processing, characterized in that: Applied to a proxy model, the method comprises: Pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and calculate the average time consumption of each batch of request information, where N is greater than 2; The amount of data to be sent in each batch of request information is used as the task concurrency amount; Counting the number of request messages successfully processed within a preset time interval, and taking the number of request messages successfully processed as the total processing amount per unit interval; The concurrency of the backend server is evaluated according to the total processing volume per unit interval, the task concurrency and the average time consumption.
2. The optimization method for batch task processing according to claim 1, characterized in that: The method further comprises: After receiving the first processing result corresponding to the first batch of request information sent by the back-end server, sending the second batch of request information pulled from the task queue to the back-end server; After receiving the second processing result corresponding to the second batch of request information sent by the backend server, sending the Nth batch of request information pulled from the task queue to the backend server; Receive the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
3. The optimization method for batch task processing according to claim 1, characterized in that: Evaluating the concurrency of the backend server according to the total processing volume per unit interval, the task concurrency, and the average time consumption includes: When the increase in the total processing volume per unit interval is greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased; When the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server; When the reduction in the total processing volume per unit interval is greater than a first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
4. The optimization method for batch task processing according to claim 1, characterized in that: The data volume of each batch of request information increases or decreases successively.
5. A batch task processing optimization system, characterized in that: Applied to the proxy model, the system comprises: A pulling module is used to pull the first batch of request information from the task queue, send the first batch of request information to the backend server, pull N batches of request information in sequence, and calculate the average time consumption of each batch of request information, where N is greater than 2; A task concurrency acquisition module, used to take the amount of data to be sent in each batch of request information as the task concurrency; A statistics module, used to count the number of request messages successfully processed within a preset time interval, and use the number of request messages successfully processed as the total processing amount per unit interval; An evaluation module is used to evaluate the concurrency of the backend server based on the total processing volume per unit interval, the task concurrency and the average time consumption.
6. The optimization system for batch task processing according to claim 5, characterized in that: The system further comprises: A first processing result receiving module is used to send the second batch of request information pulled from the task queue to the back-end server after receiving the first processing result corresponding to the first batch of request information sent by the back-end server; A second processing result receiving module is used for sending the Nth batch of request information pulled from the task queue to the backend server after receiving the second processing result corresponding to the second batch of request information sent by the backend server; The Nth processing result receiving module is used to receive the Nth processing result corresponding to the Nth batch of request information sent by the backend server.
7. The optimization system for batch task processing according to claim 5, characterized in that: The evaluation module is specifically used for: When the increase in the total processing volume per unit interval is greater than the first preset data volume threshold, the backend server has not reached the maximum load, and the task concurrency is increased; When the total processing volume per unit interval fluctuates within the positive and negative range of the first preset data volume threshold, and the increase in the average time consumption is greater than the first preset time threshold, the backend server reaches the maximum load, and the task concurrency is used as the concurrency of the backend server; When the reduction in the total processing volume per unit interval is greater than a first preset data volume threshold, the maximum load of the backend server is exceeded, and the task concurrency is reduced.
8. The optimization system for batch task processing according to claim 5, characterized in that: The data volume of each batch of request information increases or decreases successively.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
10. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1 to 4.
