Task processing method, apparatus, device, and medium
By processing batch tasks in batches and using multi-threaded parallel processing, the problem of server-side rate limiting algorithms being unable to handle excessive network traffic caused by a single request was solved, thus achieving stable service under high-concurrency business.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-06-07
- Publication Date
- 2026-06-02
AI Technical Summary
Existing server-side rate limiting algorithms cannot address the issue of excessive traffic at the underlying network layer caused by a single request, leading to network congestion and insufficient system performance in high-concurrency business scenarios.
By processing batch tasks in batches, splitting them into multiple subtasks and adding delay markers, and utilizing a multi-threaded parallel processing mechanism, batch delay scheduling is achieved, alleviating network traffic peaks.
It effectively solves the problems of excessive network traffic and insufficient system performance under high-concurrency business, reduces the risk of network occupancy, and improves the system's external service capabilities.
Smart Images

Figure CN116743874B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of big data and financial technology, and in particular to task processing methods, apparatus, equipment, media and program products. Background Technology
[0002] With the rapid development of computer and internet technologies, users can easily access the internet and submit tasks to servers. Servers can then execute these tasks and provide corresponding services. In high-concurrency business scenarios, common techniques for protecting the system's ability to provide normal external services include circuit breaking, degradation, and rate limiting. Common rate limiting methods primarily include validity verification rate limiting, container rate limiting, and server-side rate limiting.
[0003] In the process of implementing this disclosure, it was found that existing server-side rate limiting methods mainly achieve rate limiting through rate limiting algorithms. However, existing server-side rate limiting algorithms cannot meet the problem of excessive traffic at the underlying network layer caused by a single request. Summary of the Invention
[0004] In view of the above problems, this disclosure provides a task processing method, apparatus, device, medium and program product.
[0005] According to a first aspect of this disclosure, a task processing method is provided, comprising:
[0006] In response to the received batch task processing request, the batch tasks are processed in batches to obtain N initial parent tasks, where N is an integer greater than or equal to 2;
[0007] According to the preset splitting rules, the target parent task determined based on the initial parent task is split into M subtasks, where M is an integer greater than or equal to 2.
[0008] Based on the attributes of each subtask, a delay label is applied to each subtask to obtain a corresponding delay identifier; and
[0009] Based on the delay flag, the subtasks of each target parent task are processed in parallel using multiple threads to obtain processing information for multiple subtasks.
[0010] According to embodiments of this disclosure, the delay identifier includes the delay duration; for each target parent task, the child task includes at least a first child task and a second child task; the thread includes at least a first thread and a second thread;
[0011] Based on the delay flag, the subtasks of each target parent task are processed in parallel using multiple threads to obtain multiple subtask processing information, including:
[0012] The processing time for each subtask is determined based on its delay duration.
[0013] For each target parent task, the following operations are performed repeatedly in parallel:
[0014] While the first subtask is being processed using the first thread, the second subtask is being processed using the second thread, based on the processing time of the second subtask.
[0015] Continue until all subtasks have been processed, obtaining multiple subtask processing information.
[0016] According to embodiments of this disclosure, it further includes:
[0017] For each initial parent task, repeat the following operation:
[0018] Determine the number of servers associated with the initial parent task;
[0019] If the number of servers meets a preset threshold, the initial parent task will be set as the target parent task.
[0020] According to embodiments of this disclosure, in response to a received batch task processing request, the batch tasks are processed in batches to obtain N initial parent tasks, including:
[0021] Based on the received batch task processing request, determine the attributes of the server associated with the batch task;
[0022] Based on the server's attributes, batch tasks are processed in batches to obtain N initial parent tasks.
[0023] According to embodiments of this disclosure, batch tasks are processed in batches based on server attributes to obtain N initial parent tasks, including:
[0024] For batch tasks, tasks with the same server attributes are grouped into the same batch.
[0025] Tasks from the same batch are designated as the initial parent tasks.
[0026] According to embodiments of this disclosure, it further includes:
[0027] The processing information of multiple subtasks of the same target parent task is summarized to obtain the target task processing information.
[0028] According to embodiments of this disclosure, it further includes:
[0029] Store the M subtasks and the delay flag for each subtask into a cache queue.
[0030] A second aspect of this disclosure provides a task processing apparatus, comprising:
[0031] The batch processing module is used to respond to the received batch task processing request, process the batch tasks in batches, and obtain N initial parent tasks, where N is an integer greater than or equal to 2.
[0032] The splitting module is used to split the target parent task determined based on the initial parent task according to the preset splitting rules, to obtain M subtasks, where M is an integer greater than or equal to 2;
[0033] The tagging module is used to tag each subtask with a delay based on its attributes, obtaining a delay identifier for each subtask; and
[0034] The task processing module is used to perform multi-threaded parallel processing on the subtasks of each target parent task based on the delay flag, and obtain multiple subtask processing information.
[0035] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the task processing method described above.
[0036] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the above-described task processing method.
[0037] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described task processing method.
[0038] According to embodiments of this disclosure, batch tasks are processed in batches, and the same batch of tasks is further divided into subtasks. Delay flags are added to the subtasks, and multi-threaded processing is achieved through delayed scheduling of the same batch of subtasks. Parallel processing is achieved for subtasks from different batches. Based on the aforementioned batch-delayed scheduling mechanism for single-request batch tasks, this disclosure can mitigate the risk of a large number of clients performing tasks simultaneously, thus preventing service delivery, and alleviate network congestion caused by a large number of clients accessing the server at the same time. It also reduces the risk of core applications being unable to provide services due to network congestion. This overcomes the problem of excessive network layer traffic caused by a single request, which existing server-side rate limiting algorithms cannot handle, effectively solving the problems of excessive network traffic at the same time and insufficient performance support from various platform systems. Attached Figure Description
[0039] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0040] Figure 1 The illustrations depict application scenarios of task processing methods, apparatuses, devices, media, and program products according to embodiments of the present disclosure.
[0041] Figure 2 A flowchart illustrating a task processing method according to an embodiment of the present disclosure is shown schematically.
[0042] Figure 3 The flowchart illustrates a method for performing multi-threaded parallel processing on the subtasks of each target parent task according to a delay identifier, based on an embodiment of the present disclosure, to obtain processing information for multiple subtasks.
[0043] Figure 4 This schematically illustrates a method flowchart for processing batch tasks in batches to obtain N initial parent tasks in response to a received batch task processing request, according to an embodiment of the present disclosure.
[0044] Figure 5 A flowchart illustrating a task processing method according to another embodiment of the present disclosure is shown schematically;
[0045] Figure 6 A schematic block diagram of a task processing apparatus according to an embodiment of the present disclosure is shown; and
[0046] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing a task processing method according to an embodiment of the present disclosure. Detailed Implementation
[0047] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0048] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0049] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0050] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0051] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.
[0052] In the technical solutions of this disclosure, user authorization or consent is obtained before acquiring or collecting user personal information.
[0053] In high-concurrency business scenarios, common technical methods to protect the system's ability to provide normal external services include circuit breaking, degradation, and rate limiting. Common rate limiting methods mainly include validity verification rate limiting, container rate limiting, and server-side rate limiting.
[0054] In the process of implementing this disclosure, it was found that existing server-side rate limiting methods mainly achieve rate limiting through rate limiting algorithms. However, existing server-side rate limiting algorithms cannot meet the problem of excessive traffic at the underlying network layer caused by a single request.
[0055] With the rapid growth of production server scale, there is a demand in production for a single task to operate on hundreds of thousands of servers across the entire bank. On the one hand, because hundreds of thousands of servers receive messages from upstream at the same time, network traffic will surge instantly, and in severe cases, core application transactions will be affected due to network congestion. On the other hand, at the same time, the platform application system will experience a surge in overall application performance indicators due to simultaneous operations, which will also affect external services.
[0056] Embodiments of this disclosure provide a task processing method, including: responding to a received batch task processing request, processing the batch tasks in batches to obtain N initial parent tasks, where N is an integer greater than or equal to 2; splitting the target parent task determined based on the initial parent tasks according to a preset splitting rule to obtain M subtasks, where M is an integer greater than or equal to 2; marking each subtask with a delay according to its attributes to obtain a delay identifier corresponding to each subtask; and performing multi-threaded parallel processing on the subtasks of each target parent task according to the delay identifier to obtain multiple subtask processing information.
[0057] Figure 1 The illustrations depict application scenarios of task processing methods, apparatuses, devices, media, and program products according to embodiments of the present disclosure.
[0058] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0059] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0060] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0061] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0062] It should be noted that the task processing method provided in this embodiment can generally be executed by server 105. Correspondingly, the task processing device provided in this embodiment can generally be located in server 105. The task processing method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the task processing device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0063] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0064] The following will be based on Figure 1 The described scene, through Figures 2-5 The task processing method of the disclosed embodiments will be described in detail.
[0065] Figure 2 A flowchart illustrating a task processing method according to an embodiment of the present disclosure is shown schematically.
[0066] like Figure 2 As shown, the task processing method 200 of this embodiment includes operations S210 to S240.
[0067] In operation S210, in response to the received batch task processing request, the batch tasks are processed in batches to obtain N initial parent tasks, where N is an integer greater than or equal to 2.
[0068] According to embodiments of this disclosure, a user can send a batch task processing request to the server via a client. Upon receiving the request, the server processes the batch tasks in batches, resulting in different batches of tasks, with tasks from the same batch serving as an initial parent task. A single script to be executed can be considered as one task.
[0069] In operation S220, according to the preset splitting rules, the target parent task determined based on the initial parent task is split into M subtasks, where M is an integer greater than or equal to 2.
[0070] According to embodiments of this disclosure, the preset splitting rules can be determined based on the actual task. Target parent tasks can be selected from the initial parent tasks.
[0071] For example, if initial parent task 1 needs to operate 5000 servers, initial parent task 2 needs to operate 100 servers, and initial parent task 3 needs to operate 200 servers, then initial parent task 1 can be selected as the target parent task. According to the preset splitting rules, initial parent task 1 is split into subtask 1, subtask 2, ..., subtask M.
[0072] In operation S230, each subtask is marked with a delay based on its attributes, thus obtaining the delay identifier corresponding to each subtask.
[0073] According to embodiments of this disclosure, the attributes of subtasks can be determined based on the actual task. Subtasks under different target parent tasks can be tagged with delays to facilitate delayed scheduling of subtasks.
[0074] For example, the initial parent task 1 can be split into subtasks 1, 2, ..., M. Subtasks 2...M can be marked with delays. After subtask 1 is called, other subtasks are called based on the delay markers.
[0075] During operation S240, based on the delay flag, the subtasks of each target parent task are processed in parallel using multiple threads to obtain processing information for multiple subtasks.
[0076] According to embodiments of this disclosure, subtasks of the same target parent task can be processed using multi-threading based on delay flags. Subtasks of different target parent tasks can be processed independently and in parallel.
[0077] For example, target parent task 1 can be split into subtask 1, subtask 2, and subtask 3. Target parent task 2 can be split into subtask 4 and subtask 5. The delay indicator can be the delay duration. The delay duration for subtask 1 can be 0 seconds, for subtask 2 it can be 6 seconds, and for subtask 3 it can be 20 seconds. The delay duration for subtask 4 can be 0 seconds, and for subtask 5 it can be 10 seconds, and so on. At a certain moment, thread 1 can start executing subtask 1, and simultaneously thread 4 can start executing subtask 4. After 6 seconds, thread 2 can start executing subtask 2, after 10 seconds, thread 5 can start executing subtask 5, and after 20 seconds, thread 3 can start executing subtask 3.
[0078] According to embodiments of this disclosure, batch tasks are processed in batches, and the same batch of tasks is further divided into subtasks. Delay flags are added to the subtasks, and multi-threaded processing is achieved through delayed scheduling of the same batch of subtasks. Parallel processing is achieved for subtasks from different batches. Based on the aforementioned batch-delayed scheduling mechanism for single-request batch tasks, this disclosure can mitigate the risk of a large number of clients performing tasks simultaneously, thus preventing service delivery, and alleviate network congestion caused by a large number of clients accessing the server at the same time. It also reduces the risk of core applications being unable to provide services due to network congestion. This overcomes the problem of excessive network layer traffic caused by a single request, which existing server-side rate limiting algorithms cannot handle, effectively solving the problems of excessive network traffic at the same time and insufficient performance support from various platform systems.
[0079] Figure 3 The flowchart illustrates a method for performing multi-threaded parallel processing on the subtasks of each target parent task according to a delay identifier, based on an embodiment of the present disclosure, to obtain processing information for multiple subtasks.
[0080] like Figure 3 As shown, the method 340 of this embodiment, which performs multi-threaded parallel processing on the subtasks of each target parent task according to the delay identifier to obtain multiple subtask processing information, may include operations S341 to S343.
[0081] It should be noted that the delay indicator can include the delay duration. For each target parent task, the child tasks can include at least a first child task and a second child task. The threads can include at least a first thread and a second thread.
[0082] In operation S341, the processing time of each subtask is determined based on the delay duration of each subtask.
[0083] When operating S342, while processing the first subtask using the first thread, the second thread is started to process the second subtask based on the processing time of the second subtask.
[0084] According to an embodiment of this disclosure, the above operation S342 is performed repeatedly in parallel for each target parent task.
[0085] Operate S343 until all subtasks are processed, and obtain multiple subtask processing information.
[0086] According to embodiments of this disclosure, for subtasks of the same target parent task, processing can be delayed by a certain amount of time based on the processing time of the target parent task.
[0087] For example, target parent task 3 can be split into subtasks 6, 7, and 8. If the processing time of target parent task 3 is time t, then subtasks 6, 7, and 8 of target parent task 3 will each begin processing after a delay of a specified duration from time t.
[0088] According to embodiments of this disclosure, in order to avoid the impact on subsequent independent tasks due to the long delay time of the previous task and the long processing time of the subtasks, the subtasks of different parent tasks are processed independently in parallel.
[0089] According to the embodiments of this disclosure, the processing time of each subtask is determined based on the delay duration of each subtask; multi-threaded parallel processing is performed based on the processing time of each subtask, which alleviates network congestion caused by a large number of clients accessing the server at the same time, reduces the risk of core applications being unable to provide external services due to network occupation, and overcomes the problem that existing server-side rate limiting algorithms cannot meet the problem of excessive traffic in the basic network layer caused by a single request.
[0090] According to another embodiment of this disclosure, each subtask can also be marked with a delay based on a user-defined delay duration to obtain a delay identifier corresponding to each subtask.
[0091] Figure 4 The flowchart illustrates a method for processing batch tasks in batches to obtain N initial parent tasks in response to a received batch task processing request, according to an embodiment of the present disclosure.
[0092] like Figure 4 As shown, the method 410 of this embodiment, which processes batch tasks in response to a received batch task processing request to obtain N initial parent tasks, includes operations S411 to S412.
[0093] In operation S411, the attributes of the server associated with the batch task are determined based on the received batch task processing request.
[0094] When operating S412, batch tasks are processed in batches according to the server's attributes, resulting in N initial parent tasks.
[0095] According to embodiments of this disclosure, the attributes of the server may include the organization to which the server belongs. The batch task can be processed in batches based on the organization to which the server associated with the batch task belongs, resulting in N batches of tasks, i.e., N initial parent tasks.
[0096] According to embodiments of this disclosure, the server's attributes may further include the server's address. The batch task can be processed in batches based on the address of the server associated with it, resulting in N batches of tasks, i.e., N initial parent tasks.
[0097] According to embodiments of this disclosure, the attributes of the server may include the server's address and the organization to which the server belongs. The batch task can be processed in batches based on the address of the server associated with it and the organization to which the server belongs, resulting in N batches of tasks, i.e., N initial parent tasks.
[0098] According to the embodiments of this disclosure, by determining the attributes of the server associated with the batch task, the batch task can be processed in batches to obtain multiple batches of tasks. This is beneficial for subsequent integration with delay identifiers to realize a batch delay scheduling mechanism for single-request batch task processing, jointly solving the problems of excessive network traffic at the same time point and insufficient performance support of various platform systems. It also solves the problem of frequent task failures encountered by operators when performing batch operations in production, improves the success rate of automated operation and maintenance tasks within the industry, and provides technical support for the transformation of production operation and maintenance.
[0099] According to embodiments of this disclosure, batch processing of batch tasks is performed based on server attributes to obtain N initial parent tasks, which may include:
[0100] For batch tasks, tasks with the same server attributes are grouped into the same batch; the tasks in the same batch are designated as the initial parent task.
[0101] According to embodiments of this disclosure, the attributes of a server may include the server's address and / or the organization to which the server belongs.
[0102] According to embodiments of this disclosure, tasks with the same server address and / or the same organization to which the server belongs can be grouped into the same batch of tasks.
[0103] For example, batch tasks can include Task 1, Task 2, Task 3, Task 4, Task 5, etc. If Task 1 and Task 2 operate on servers belonging to the same organization, then Task 1 and Task 2 can be grouped into the same batch of tasks; that is, the initial parent task A includes Task 1 and Task 2. If Task 3 and Task 5 operate on servers with the same address, then Task 3 and Task 5 can be grouped into the same batch of tasks; that is, the initial parent task B includes Task 3 and Task 5. The initial parent task C includes Task 4.
[0104] According to the embodiments of this disclosure, tasks with the same attributes on the server are divided into the same batch of tasks as the initial parent task, which realizes the batch processing of batch tasks. After batch processing, the tasks can be further divided into multiple sub-tasks, which facilitates the multi-threaded parallel processing of tasks.
[0105] According to another embodiment of this disclosure, batch tasks can also be processed in batches according to a user-defined batching strategy.
[0106] Figure 5 A flowchart illustrating a task processing method according to another embodiment of the present disclosure is shown schematically.
[0107] like Figure 5 As shown, the task processing method 500 of this embodiment may include operations S510 to S520 in addition to the operations S210 to S240 described above.
[0108] For each initial parent task, repeat the following operation:
[0109] In operation S510, determine the number of servers associated with the initial parent task.
[0110] According to embodiments of this disclosure, the number of servers associated with the initial parent task can be determined based on the number of servers required to perform the initial parent task.
[0111] When operating S520, if the number of servers meets the preset threshold, the initial parent task is determined as the target parent task.
[0112] According to embodiments of this disclosure, the preset threshold can be determined based on actual business scenarios, such as the need for rate limiting or network congestion.
[0113] For example, for initial parent tasks A, B, and C, we can determine whether the number of servers required to execute initial parent tasks A, B, and C meets a preset threshold. If the preset threshold is met, they can be identified as target parent tasks, further broken down into subtasks, and processed according to the delay flag. If the preset threshold is not met, they can be identified as non-target parent tasks and processed according to the processing time.
[0114] According to the embodiments of this disclosure, by determining the initial parent task whose number of servers associated with the initial parent task meets a preset threshold as the target parent task, and then splitting the sub-tasks and delaying the tagging, a single-request batch task processing mechanism with batch delay scheduling is realized. This effectively alleviates the need for a single task to operate on hundreds of thousands of servers across the entire bank, which can cause a sudden surge in network traffic and even affect core application transactions due to network congestion.
[0115] According to embodiments of this disclosure, the task processing method may further include:
[0116] The processing information of multiple subtasks of the same target parent task is summarized to obtain the target task processing information.
[0117] According to embodiments of this disclosure, task processing information can be queried based on the original task. The original task is the parent task; the Redis cache database is queried based on the parent task information to obtain the sub-task information corresponding to the parent task. Then, the sub-task processing information is retrieved sequentially and summarized for unified return to the user.
[0118] According to embodiments of this disclosure, by aggregating the processing information of multiple subtasks of the same target parent task, target task processing information can be obtained. This target task processing information can then be uniformly returned to the user, eliminating the need for the user to focus on the subtask processing information.
[0119] According to embodiments of this disclosure, the task processing method may further include:
[0120] Store the M subtasks and the delay flag for each subtask into a cache queue.
[0121] According to embodiments of this disclosure, subtasks and their corresponding delay flags are temporarily stored in a cache queue, awaiting further processing.
[0122] According to embodiments of this disclosure, the relationship between the target parent task and the child task can also be stored in conjunction with a Redis cache database, providing a reference for subsequent querying of child task result information based on the target parent task.
[0123] According to embodiments of this disclosure, storing subtasks and their corresponding delay flags in a cache queue facilitates delay scheduling based on the delay flags.
[0124] It should be noted that the above task processing methods can be built on an operations and maintenance (O&M) infrastructure service platform. This platform can provide operators with an automated method for batch operations on production servers.
[0125] According to embodiments of this disclosure, the task processing method can be applied to scenarios where rate limiting is performed at the network infrastructure layer on the server side. By automatically batching and delaying tasks on the server side, the risk of a large number of clients performing tasks simultaneously, thus preventing external services, is mitigated. This also alleviates network congestion caused by a large number of clients accessing the server at the same time, reducing the risk of core applications being unable to provide external services due to network occupancy. Furthermore, it effectively solves the problem of frequent task failures encountered by operators when performing batch operations in production, effectively improving the success rate of automated operation and maintenance tasks, and providing technical support for the transformation of production operation and maintenance.
[0126] Based on the above task processing method, this disclosure also provides a task processing apparatus. The following will be combined with... Figure 6 The device is described in detail.
[0127] Figure 6A schematic block diagram of a task processing apparatus according to an embodiment of the present disclosure is shown.
[0128] like Figure 6 As shown, the task processing device 600 of this embodiment includes a batch processing module 610, a split processing module 620, a marking processing module 630, and a task processing module 640.
[0129] The batch processing module 610 is used to respond to the received batch task processing request, and to process the batch tasks in batches to obtain N initial parent tasks, where N is an integer greater than or equal to 2. In one embodiment, the batch processing module 610 can be used to execute the operation S210 described above, which will not be repeated here.
[0130] The splitting processing module 620 is used to split the target parent task determined based on the initial parent task according to a preset splitting rule, resulting in M subtasks, where M is an integer greater than or equal to 2. In one embodiment, the splitting processing module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0131] The tagging processing module 630 is used to tag each subtask with a delay based on its attributes, thereby obtaining a delay identifier for each subtask. In one embodiment, the tagging processing module 630 can be used to perform the operation S230 described above, which will not be repeated here.
[0132] The task processing module 640 is used to perform multi-threaded parallel processing on the subtasks of each target parent task according to the delay flag, thereby obtaining multiple subtask processing information. In one embodiment, the task processing module 640 can be used to execute the operation S240 described above, which will not be repeated here.
[0133] According to embodiments of this disclosure, the task processing module 640 may include a first determining unit, a first processing unit, and a second processing unit. The delay identifier may include a delay duration. For each target parent task, the subtasks may include at least a first subtask and a second subtask. The threads may include at least a first thread and a second thread.
[0134] The first determining unit is used to determine the processing time of each subtask based on the delay duration of each subtask.
[0135] The first processing unit is used to start processing the second subtask using the second thread while processing the first subtask using the first thread, based on the processing time of the second subtask.
[0136] The second processing unit is used to obtain multiple subtask processing information until all subtasks have been processed.
[0137] According to embodiments of this disclosure, the task processing apparatus 600 may further include a quantity determination module and a target parent task determination module.
[0138] The quantity determination module is used to determine the number of servers associated with the initial parent task.
[0139] The target parent task determination module is used to determine the initial parent task as the target parent task when the number of servers meets a preset threshold.
[0140] According to embodiments of this disclosure, the batch processing module 610 may include a second determining unit and a third processing unit.
[0141] The second determining unit is used to determine the attributes of the server associated with the batch task based on the received batch task processing request.
[0142] The third processing unit is used to process batch tasks in batches according to the attributes of the server, and obtain N initial parent tasks.
[0143] According to embodiments of this disclosure, the task processing apparatus 600 may further include a summarizing module.
[0144] The aggregation module is used to aggregate the processing information of multiple subtasks of the same target parent task to obtain the target task processing information.
[0145] According to embodiments of this disclosure, the task processing apparatus 600 may further include a storage module.
[0146] The storage module is used to store M subtasks and the delay flags corresponding to each subtask into the cache queue.
[0147] According to embodiments of this disclosure, any plurality of modules among the batch processing module 610, splitting processing module 620, marking processing module 630, and task processing module 640 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules can be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the batch processing module 610, splitting processing module 620, marking processing module 630, and task processing module 640 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the batch processing module 610, the splitting processing module 620, the marking processing module 630, and the task processing module 640 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0148] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing a task processing method according to an embodiment of the present disclosure.
[0149] like Figure 7 As shown, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage portion 708 into a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0150] RAM 703 stores various programs and data required for the operation of electronic device 700. Processor 701, ROM 702, and RAM 703 are interconnected via bus 704. Processor 701 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0151] According to embodiments of this disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to a bus 704. The electronic device 700 may also include one or more of the following components connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0152] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0153] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 702 and / or RAM 703 and / or one or more memories other than ROM 702 and RAM 703 described above.
[0154] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this disclosure.
[0155] When the computer program is executed by the processor 701, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0156] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 709, and / or installed from a removable medium 711. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0157] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0158] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0159] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0160] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0161] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A task processing method, comprising: In response to receiving batch task processing requests sent by the client at the same time, the batch tasks are processed in batches to obtain N initial parent tasks, where N is an integer greater than or equal to 2, and the batches of the N initial parent tasks are different. For each of the initial parent tasks, repeat the following operations: Determine the number of servers associated with the initial parent task; If the number of servers meets a preset threshold, the initial parent task is determined as the target parent task. The preset threshold is determined based on the actual business scenario, such as the need for rate limiting or network congestion. According to the preset splitting rules, the target parent task determined based on the initial parent task is split into M subtasks, where M is an integer greater than or equal to 2. Based on the attributes of the subtasks, each subtask is marked with a delay to obtain a delay identifier corresponding to each subtask; and Based on the delay identifier, delayed scheduling is performed on the same batch of subtasks, and multi-threaded parallel processing is performed on different batches of subtasks to obtain processing information for multiple subtasks.
2. The method according to claim 1, wherein the delay identifier includes a delay duration; for each target parent task, the subtask includes at least a first subtask and a second subtask; and the thread includes at least a first thread and a second thread. in, The method involves using the delay identifier to perform multi-threaded processing on the same batch of subtasks with delay scheduling, and multi-threaded parallel processing on different batches of subtasks to obtain multiple subtask processing information, including: The processing time for each subtask is determined based on the delay duration of each subtask. For each of the target parent tasks, the following operations are performed repeatedly in parallel: While the first thread is processing the first subtask, the second thread is started to process the second subtask according to the processing time of the second subtask. The process continues until all the subtasks have been processed, resulting in multiple subtask processing information.
3. The method according to claim 1, wherein, In response to the received batch task processing request, the batch tasks are processed in batches to obtain N initial parent tasks, including: Based on the received batch task processing request, determine the attributes of the server associated with the batch task; Based on the attributes of the server, the batch tasks are processed in batches to obtain N initial parent tasks.
4. The method according to claim 3, wherein, The step of processing the batch tasks in batches according to the attributes of the server to obtain N initial parent tasks includes: For the batch tasks, tasks with the same attributes on the server are grouped into the same batch. The tasks in the same batch are identified as the initial parent tasks.
5. The method according to claim 1, further comprising: The processing information of multiple subtasks of the same target parent task is summarized to obtain the target task processing information.
6. The method according to any one of claims 1 to 5, further comprising: Store the M subtasks and the delay identifier corresponding to each subtask into a cache queue.
7. A task processing apparatus, comprising: The batch processing module is used to respond to batch task processing requests sent by the client within the same time period, process the batch tasks in batches, and obtain N initial parent tasks, where N is an integer greater than or equal to 2, and the batches of the N initial parent tasks are different. The quantity determination module is used to determine the number of servers associated with the initial parent task; The target parent task determination module is used to determine the initial parent task as the target parent task when the number of servers meets a preset threshold. The preset threshold is determined based on the actual business scenario, such as the need for rate limiting or network congestion. The splitting processing module is used to split the target parent task determined according to the initial parent task according to the preset splitting rules to obtain M subtasks, where M is an integer greater than or equal to 2; A tagging processing module is used to perform delay tagging on each of the subtasks according to their attributes, thereby obtaining a delay identifier corresponding to each subtask; and The task processing module is used to perform delayed scheduling processing of the same batch of subtasks according to the delay identifier, and to perform multi-threaded parallel processing of different batches of subtasks to obtain multiple subtask processing information.
8. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 6.