Concurrent processing method, concurrency control system, electronic equipment and storage medium

Dynamically adjusting concurrent requests through the intelligent concurrent scheduler and resource monitoring module solves the problem of self-handling of concurrency details in asynchronous network request processing in the existing technology, achieving efficient resource management and improving user experience.

CN118819825APending Publication Date: 2024-10-22NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410796062.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

When existing technology handles asynchronous network requests, developers need to handle concurrency details by themselves, resulting in heavy development workload, lack of flexibility, insufficient resource management, limited error handling, poor scalability, performance bottlenecks and poor user experience.

Method used

Provide a concurrency processing method and concurrency control system. Through the intelligent concurrent scheduler and resource monitoring module, real-time monitoring of the resource usage of the front-end application system can dynamically adjust the number of concurrent requests to achieve comprehensive error handling, flexible request management and performance. Optimized to support asynchronous task queue, request priority and batch processing.

Benefits of technology

It improves resource utilization and response speed, achieves efficient management of a large number of asynchronous network requests, reduces developers' access costs, and improves user experience and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819825A_ABST
    Figure CN118819825A_ABST
Patent Text Reader

Abstract

The invention provides a concurrent processing method, a concurrent control system, an electronic device and a storage medium wherein the method comprises: acquiring resource usage information of a front-end application system, and determining whether a concurrent adjustment condition is satisfied based on the resource usage information, the resource usage information being used for indicating a currently occupied resource; when the concurrency adjustment condition is met, a concurrency adjustment request is generated, and the resource use information is carried in the concurrency adjustment request; and according to the resource use information, adjusting the concurrent number of the asynchronous network requests to be concurrently processed in the front-end application system, and executing the target asynchronous network requests with the adjusted concurrent number in parallel. According to the method, the resource use condition of the front-end application system is monitored in real time, and the number of concurrent requests which can be allowed to be processed at the same time by the front-end application system is dynamically calculated and adjusted, so that the resource utilization rate and the response speed are improved, and efficient management of a large number of asynchronous network requests is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a concurrent processing method, a concurrent control system, an electronic device and a storage medium. Background Art

[0002] With the development of Internet technology, front-end application systems are becoming more complex, and the amount of data to be processed and the frequency of user interactions are increasing. Especially in application scenarios that require real-time data updates, user behavior responses, and multi-user collaboration, front-end application systems need to efficiently process a large number of asynchronous network requests.

[0003] Currently, existing methods for processing a large number of asynchronous network requests usually include callback functions, asynchronous programming methods, concurrency libraries, server-side paging technology, etc. Although the above methods can realize asynchronous network request processing, they all require developers to handle concurrency details by themselves, which increases the development workload. Summary of the invention

[0004] The purpose of this application is to provide a concurrent processing method, a concurrent control system, an electronic device and a storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem in the prior art that developers need to handle the concurrency details themselves when processing asynchronous network requests, resulting in a large amount of development work.

[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, an embodiment of the present application provides a concurrent processing method, the method comprising:

[0007] Obtain resource usage information of the front-end application system, and determine whether a concurrency adjustment condition is met based on the resource usage information, wherein the resource usage information is used to indicate currently occupied resources;

[0008] When the concurrency adjustment condition is met, generating a concurrency adjustment request, wherein the concurrency adjustment request carries the resource usage information;

[0009] According to the resource usage information, the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system is adjusted, and the adjusted concurrent number of target asynchronous network requests is executed in parallel.

[0010] In a second aspect, an embodiment of the present application provides a concurrency control system, the concurrency control system comprising an intelligent concurrency scheduler and a resource monitoring module;

[0011] The resource monitoring module is used to obtain resource usage information of the front-end application system and determine whether the concurrency adjustment condition is met based on the resource usage information, wherein the resource usage information is used to indicate currently occupied resources;

[0012] The resource monitoring module is further configured to generate a concurrency adjustment request when the concurrency adjustment condition is met, wherein the concurrency adjustment request carries the resource usage information;

[0013] The intelligent concurrent scheduler is used to adjust the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and to execute the adjusted concurrent number of target asynchronous network requests in parallel.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the concurrent processing method as described in any one of the first aspects above.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the concurrent processing method as described in any one of the first aspects above are executed.

[0016] According to the concurrent processing method, concurrent control system, electronic device and storage medium of the embodiment of the present application, it is determined whether the concurrent adjustment condition is met based on the currently occupied resource usage information in the front-end application system, and when the concurrent adjustment condition is met, a concurrent adjustment request is generated, and then the concurrent number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted according to the resource usage information, and the target asynchronous network request with the adjusted concurrent number is executed in parallel. According to the embodiment of the present application, there is no need for the developer to handle the concurrency details by himself. By real-time monitoring of the resource usage of the front-end application system, resource bottlenecks can be discovered and responded to more promptly than traditional periodic or passive monitoring, and the number of concurrent requests that the front-end application system can allow to be processed simultaneously is dynamically calculated and adjusted according to the resource usage of the front-end application system, which not only improves resource utilization and response speed, but also realizes efficient management of a large number of asynchronous network requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1A schematic diagram of a concurrent processing method provided in an embodiment of the present application is shown;

[0019] Figure 2 A schematic diagram of a flow chart of a method for adjusting the number of concurrent asynchronous network requests provided in an embodiment of the present application is shown;

[0020] Figure 3 A schematic diagram of a process for executing a method for executing asynchronous network requests in parallel provided by an embodiment of the present application is shown;

[0021] Figure 4 A schematic diagram of a process flow of an asynchronous task processing method provided by an embodiment of the present application is shown;

[0022] Figure 5 A schematic diagram of the structure of a concurrent control system provided by an embodiment of the present application is shown;

[0023] Figure 6 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0024] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0025] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0026] In order to enable those skilled in the art to use the content of this application, the following implementation is provided in conjunction with a specific application scenario "concurrent processing of asynchronous network requests". For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is mainly described around the concurrent processing method, it should be understood that this is only an exemplary embodiment.

[0027] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0028] Existing front-end concurrency control solutions mainly rely on JavaScript's asynchronous programming features, such as callback functions, nested Promises chains, etc. However, existing solutions have the following disadvantages when processing asynchronous requests:

[0029] Lack of flexibility: Traditional concurrency control methods are usually based on static concurrency limits and cannot dynamically adjust the number of concurrent requests based on real-time system resources and network conditions.

[0030] Insufficient resource management: Under high concurrent requests, existing solutions often lack effective resource monitoring and management mechanisms, which can easily lead to problems such as memory leaks and excessive CPU usage.

[0031] Limited error handling: Many existing solutions lack comprehensive error detection and retry mechanisms. Once a request fails, it is difficult to automatically recover from the error, which affects the user experience.

[0032] Poor scalability: As business logic becomes more complex, existing solutions often find it difficult to adapt to new business needs, such as dynamically adjusting request priorities, supporting the cancellation and suspension of specific requests, etc.

[0033] Performance bottleneck: When processing a large number of concurrent requests, the existing solution may become a performance bottleneck, especially when a large number of Document Object Model (DOM) operations or complex calculations are involved.

[0034] Code complexity: Using callback functions or nested Promise chains to manage concurrent requests makes the code difficult to read and maintain, increasing the difficulty of development and debugging.

[0035] Poor user experience: In the case of request failure or timeout, existing solutions often do not provide a good user feedback mechanism, causing users to be confused about the application status.

[0036] For front-end application systems, there is an urgent need for a solution that can dynamically adjust the number of concurrent requests, intelligently allocate system resources, effectively handle request failures and retries, and adapt to different network conditions and business needs. This solution should be able to fully utilize the parallel processing capabilities of modern JavaScript engines while providing flexible interfaces to adapt to changing business logic. In addition, it should be able to seamlessly integrate with existing front-end frameworks and libraries to minimize the access cost for developers.

[0037] In response to the above situation, the embodiments of the present application provide a front-end application system with an efficient, stable and easy-to-use concurrent processing solution for asynchronous network requests through intelligent concurrency control, comprehensive error handling, flexible request management, performance optimization and good compatibility. It aims to solve the performance bottlenecks and resource management problems faced by front-end applications when processing a large number of asynchronous network requests. Its core content is the ability to dynamically adjust the number of concurrent requests, optimize resource allocation, and provide comprehensive request lifecycle management.

[0038] In the embodiment of the present application, multiple functional modules are implemented in the electronic device to realize concurrent processing of asynchronous network requests, wherein the modules and concepts involved are briefly introduced first:

[0039] Intelligent concurrent scheduler: It is used to evaluate the resource usage of the front-end application system monitored by the resource monitoring module in real time, such as CPU usage, memory usage, network bandwidth, network status (such as latency, packet loss rate, etc.), and dynamically adjust the number of asynchronous network requests that can be performed simultaneously based on resource usage. The intelligent concurrent scheduler will use machine learning algorithms to self-optimize based on historical data and real-time feedback to achieve the optimal concurrency control strategy.

[0040] Resource monitoring module: This module will monitor the resource usage of the front-end application system in real time, including but not limited to CPU, memory, disk I / O and network status. By setting corresponding thresholds, the resource monitoring module can make judgments based on resource usage and thresholds. When resource usage approaches or exceeds the threshold, it will promptly notify the intelligent concurrent scheduler to adjust the number of concurrent asynchronous network requests that can be performed simultaneously, thereby avoiding system crashes or performance degradation caused by resource exhaustion.

[0041] Error handling and retry mechanism: Implement a comprehensive error handling module that identifies the reasons for asynchronous network request failures, such as network errors, server errors, timeouts, etc., and implements different retry strategies based on the above failure reasons. In addition, the error handling module will support exception capture, allowing developers to customize the processing logic for different types of errors to improve the robustness of the system.

[0042] Request priority: Allows you to set different priorities for different asynchronous network requests based on business logic and user experience requirements. For example, a user's critical operation request can be given a higher priority, while some non-critical background synchronization tasks can be set at a lower priority, to ensure that high-priority requests are processed first if resources permit.

[0043] Asynchronous task queue: The asynchronous task queue can not only store pending asynchronous network requests, but also manage the execution status of asynchronous network requests, such as pause, resume, or cancel. In addition, the asynchronous task queue can also support the sorting and dependency management of asynchronous tasks to ensure that each asynchronous network request is executed in order according to the established priority and dependency relationship.

[0044] Performance optimization: Reduce the overhead of task scheduling and execution by optimizing algorithms. For example, reduce the number of network communications by batch processing similar asynchronous network requests, or optimize CPU and memory usage by merging and splitting tasks.

[0045] Figure 1 The flowchart of a concurrent processing method provided by an embodiment of the present application is shown. The execution subject of the method may be an electronic device, such as a computer, a processor, etc. The above modules may be integrated into the electronic device, which is not limited here. Figure 1 As shown, the method comprises the following steps:

[0046] S101. Obtain resource usage information of a front-end application system, and determine whether a concurrency adjustment condition is met based on the resource usage information, where the resource usage information is used to indicate currently occupied resources.

[0047] Optionally, the resource usage information includes one or more of the following: processor usage, memory information, disk input / output operation rate, and network status information.

[0048] Exemplarily, the resource usage information of the front-end application system is monitored in real time by a resource monitoring module integrated in the front-end application system, and the obtained resource usage information is compared with a preset resource usage threshold to determine whether the concurrent number of asynchronous network requests executed simultaneously by the front-end application system needs to be adjusted. For example, if the CPU usage rate is continuously higher than a preset ratio, such as 80%, or the response time exceeds the expected threshold, this may indicate that the current concurrent number is too high and needs to be adjusted down. On the contrary, if the resource usage is low and the request processing is fast, it means that the concurrent number of asynchronous network requests can be increased.

[0049] S102: When the concurrency adjustment condition is met, a concurrency adjustment request is generated, and the concurrency adjustment request carries resource usage information.

[0050] Optionally, once the resource monitoring module determines that the number of concurrent requests needs to be adjusted, it generates a concurrency adjustment request and sends the concurrency adjustment request to an intelligent concurrency scheduler integrated in the front-end application system. The concurrency adjustment request carries resource usage information. After receiving the concurrency adjustment request, the intelligent concurrency scheduler can adjust the concurrency number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information.

[0051] S103: adjusting the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and executing the adjusted concurrent number of target asynchronous network requests in parallel.

[0052] Optionally, the intelligent concurrent scheduler determines a new concurrency number based on the resource usage information carried in the concurrency adjustment request. Specifically, if the system resources are tight, the concurrency number is reduced to reduce the system burden, and if the system resources are sufficient, the concurrency number is increased to improve the processing capacity.

[0053] Optionally, after adjusting the number of concurrent requests, the front-end application system will schedule pending asynchronous network requests according to the adjusted concurrent limit. In other words, the front-end application system will manage and execute asynchronous network requests more effectively, ensuring that the system will not be overwhelmed by too many asynchronous network requests, while also making full use of the available resources of the front-end application system, thereby improving the response speed perceived by users.

[0054] Based on this, according to the concurrent processing method provided in the embodiment of the present application, based on the currently occupied resource usage information in the front-end application system, it is determined whether the concurrency adjustment conditions are met, and when the concurrency adjustment conditions are met, a concurrency adjustment request is generated, and then according to the resource usage information, the concurrent number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted, and the target asynchronous network request with the adjusted concurrent number is executed in parallel. According to the embodiment of the present application, there is no need for developers to handle the concurrency details by themselves. By real-time monitoring of the resource usage of the front-end application system, resource bottlenecks can be discovered and responded to more promptly than traditional periodic or passive monitoring, and the number of concurrent requests that the front-end application system can allow to be processed simultaneously is dynamically calculated and adjusted according to the resource usage of the front-end application system, which not only improves resource utilization and response speed, but also realizes efficient management of a large number of asynchronous network requests.

[0055] As a possible implementation, the above step S101 determines whether the concurrency adjustment condition is met based on the resource usage information, including:

[0056] The resource usage information is compared with a preset resource usage threshold to obtain a comparison result; based on the comparison result, it is determined whether the concurrent adjustment condition is met.

[0057] Optionally, the resource usage information reflects the actual current resource consumption of the front-end application system, and the preset resource usage threshold reflects a series of standard values ​​set according to system performance best practices or historical operation data, which are used to distinguish between normal, warning and dangerous states of system operation.

[0058] Exemplarily, the resource usage monitored in real time is compared with the preset resource usage threshold, and based on the comparison result, it is determined whether the current number of concurrent processing needs to be adjusted. Specifically, if the resource usage does not exceed the resource usage threshold, it indicates that the front-end application system has surplus resources, and you can consider increasing the number of concurrencies to improve processing power and response speed, so as to better serve more user requests. If the resource usage is close to or reaches the resource usage threshold, it indicates that the front-end application system is saturated, and continuing to increase the number of concurrencies may cause system performance to degrade or become unstable. At this time, you may need to reduce the number of concurrencies to reduce resource competition and ensure stable operation of the system. If the resource usage exceeds the resource usage threshold, you may need to take immediate measures to significantly reduce the number of concurrencies to avoid system crashes or serious performance problems.

[0059] Based on this, the resource usage information and the preset resource usage threshold are used to determine whether the front-end application system meets the concurrency adjustment conditions, ensuring that the front-end application system can adaptively adjust its processing capacity to cope with different load conditions. This not only avoids resource waste, but also prevents the degradation of service quality caused by excessive resource consumption.

[0060] Figure 2 The flowchart of a method for adjusting the number of concurrent asynchronous network requests provided by an embodiment of the present application is shown. Figure 2 As shown, the above step S103 adjusts the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and executes the adjusted concurrent number of target asynchronous network requests in parallel, specifically including the following steps:

[0061] S201. Obtain the initial concurrent number and preset concurrent adjustment time of the front-end application system.

[0062] For example, the front-end application system will set an initial concurrency number during startup or a specific configuration phase, that is, the maximum number of asynchronous network requests that the front-end application system allows to be processed simultaneously. At the same time, a concurrency adjustment time interval will be pre-set, such as every minute, every five minutes, etc., for regular evaluation and adjustment of the concurrency number.

[0063] S202: Determine the target concurrent number based on the preset computing strategy and resource usage information.

[0064] For example, the resource monitoring module monitors the resource usage of the front-end application system and the processing efficiency of asynchronous network requests. The intelligent concurrent scheduler combines these real-time data with preset calculation strategies, such as calculation functions, load-based dynamic adjustment, response time optimization algorithms, etc., to calculate a new target concurrency number that is more suitable for the current system load. Among them, the preset calculation strategy aims to balance the request processing speed and system resource consumption to ensure stable and efficient operation of the system.

[0065] S203: According to the preset concurrency adjustment time, the concurrency number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted from the initial concurrency number to the target concurrency number, and the target asynchronous network requests of the target concurrency number are executed in parallel.

[0066] For example, when the preset concurrency adjustment time is reached, the intelligent concurrent scheduler will update the current concurrency number in the front-end application system to the target concurrency number. If the target concurrency number is greater than the initial concurrency number, it means that the front-end application system is capable of handling more concurrent requests, which can improve the user experience. On the contrary, if the concurrency number needs to be reduced, it may be to avoid resource overload and ensure system stability.

[0067] Furthermore, after adjusting the number of concurrent requests, the front-end application system will process asynchronous network requests in parallel according to the new concurrency limit. That is, at any given time point, the front-end application system will control exactly the target number of concurrent asynchronous network requests to execute simultaneously, and the remaining requests may be queued or arranged for execution according to priority.

[0068] Based on this, the processing efficiency of asynchronous requests is automatically optimized according to the real-time system status to avoid resource waste or excessive consumption, thereby improving the overall performance and user experience of the front-end application system.

[0069] Figure 3 The flowchart of a method for executing asynchronous network requests in parallel provided by an embodiment of the present application is shown. Figure 3 As shown, the above steps execute the adjusted concurrent number of target asynchronous network requests in parallel, specifically including the following steps:

[0070] S301. Determine the priority of each asynchronous network request according to the service attributes corresponding to each asynchronous network request to be processed concurrently in the front-end application system.

[0071] For example, each asynchronous network request is associated with a specific business scenario, and each asynchronous network request is given a different priority based on its criticality to user experience, business process smoothness, or data timeliness. For example, a request to submit an order may have a higher priority than a request to load a non-core image.

[0072] S302: According to the priority of each asynchronous network request, select a target asynchronous network request corresponding to the adjusted concurrent number from the multiple asynchronous network requests to be concurrently processed by the front-end application system, and concurrently execute the target asynchronous network request.

[0073] For example, when there are multiple asynchronous network requests waiting to be processed, they will be sorted according to their priorities, and the asynchronous network requests with higher priorities will be given priority for execution. Furthermore, according to the adjusted concurrency limit, that is, the maximum number of asynchronous network requests that the front-end application system can process simultaneously, the top request in the priority-sorted asynchronous network request list is selected until the upper limit of the concurrency is reached.

[0074] For example, once the target asynchronous network requests are determined, these requests will be initiated simultaneously according to the concurrency principle. That is, although the front-end application system may receive multiple asynchronous network requests at the same time, the actual execution will be controlled within a reasonable degree of parallelism to avoid excessive system burden or network congestion caused by too many requests, while also processing high-priority tasks as quickly as possible to improve user experience and system response speed.

[0075] Based on this, by giving priority to key business requests and combining the concurrent processing capabilities of the front-end application system, efficient scheduling and execution of asynchronous network requests can be achieved, thereby maximizing business needs and user experience while ensuring the stability of the front-end application system.

[0076] As a possible implementation, the method further includes: if responding to the target asynchronous network request fails, obtaining a request failure factor; and determining a retry strategy based on the request failure factor.

[0077] Optionally, request failure factors include but are not limited to network problems, server problems, client problems, etc., among which network problems include network connection interruption, excessive latency, etc., server problems include server overload, service unavailable, logical errors, etc., and client problems include request timeout, parameter errors, etc.

[0078] For example, different factors lead to different retry strategies for request failures. Request failures caused by network problems are often temporary, and retries are likely to succeed, so retry strategies can include setting the number of retries, retry intervals, etc. For request failures caused by server problems, such as requests that are explicitly rejected by the server, automatic response may be ineffective, so the retry strategy should record detailed error logs, and may require developers to intervene to analyze the root cause of the problem, notify users or take remedial measures if necessary. For request failures caused by client problems, such as request timeouts, it is necessary to analyze whether the specific scenario of the timeout is due to factors such as slow requests or network delays, and then decide whether to retry, and whether it is necessary to adjust the system configuration or optimize the code logic.

[0079] Optionally, the above steps determine the retry strategy according to the request failure factor, including: determining the error handling logic corresponding to the request failure factor according to the attribute information of the request failure factor; and determining the retry strategy according to the error handling logic.

[0080] Exemplarily, the attribute information includes the type and source of the request failure factor. When a request is not completed, it is necessary to collect and analyze the specific factors that caused the failure, and the attribute information of the request failure factor mainly includes two aspects: type and source. Among them, the type indicates the root cause of the request failure, such as network error, server error, client error, logical error, etc., and the source indicates the mitigation of the error, aiming to locate the problem, whether it is a client problem, network transmission problem, server-side processing problem, etc.

[0081] Exemplarily, different error handling logics are determined based on the attribute information of the request failure factor. For example, for network-related errors, the error handling logic is to record logs and try to reconnect automatically. When encountering server errors, it may be necessary to record detailed logs and notify the administrator to check the server status. For client errors, such as parameter errors, the error code and error information may be directly returned to the front end to prompt the user to correct the input. Specifically, for temporary connection problems caused by network fluctuations, automatic retries can be implemented, and for requests explicitly rejected by the server, the developer may need to intervene to record error logs or users.

[0082] Exemplarily, the retry strategy needs to be personalized according to the error type and business requirements, for example, the number of retries, retry interval, backoff strategy, conditional retries, etc. can be considered.

[0083] Based on this, through effective error handling and retry mechanisms, not only can request failure information be provided, but it can also better resist external environmental changes or internal failures, ensuring the continuity and reliability of request services.

[0084] As a possible implementation manner, after the above steps execute the adjusted concurrent number of target asynchronous network requests in parallel, the method further includes:

[0085] If the number of asynchronous network requests to be processed concurrently in the front-end application system is greater than the adjusted concurrent number, at least one remaining asynchronous network request is added to the asynchronous task queue; wherein the remaining asynchronous network requests are asynchronous network requests other than the target asynchronous network request among the asynchronous network requests to be processed concurrently by the front-end application system.

[0086] For example, when the front-end application system detects that the amount of asynchronous requests to be processed exceeds the preset concurrent processing capacity, it will automatically put the excess requests into the asynchronous task queue and wait for system resources to be released before executing them in sequence.

[0087] Figure 4 The following is a flow chart of an asynchronous task processing method provided by an embodiment of the present application. Figure 4 As shown, the above steps add at least one remaining asynchronous network request to the asynchronous task queue, and specifically include the following steps:

[0088] S401: Obtain the dependency and priority of each remaining asynchronous network request.

[0089] Optionally, dependencies are used to ensure the correct execution logic of the request tasks, and priorities are used to decide which request tasks should be executed earlier.

[0090] For example, for the remaining asynchronous network requests that have not yet been executed or completed, it is necessary to clarify the dependencies and priorities between the asynchronous network requests, where the dependencies reflect that some requests must be executed only after other requests are completed, and the priorities reflect the importance and urgency of the requests.

[0091] S402: Determine the execution order of the remaining asynchronous network requests according to the dependency relationship and priority of the remaining asynchronous network requests.

[0092] Exemplarily, based on the dependencies and priorities of the remaining asynchronous network requests, ensure that the remaining asynchronous network requests with high priorities are placed in front, and at the same time, consider the dependencies between the remaining asynchronous network requests to ensure that the remaining asynchronous network requests without dependencies or whose dependencies have been completed are executed first, so as to determine the execution order of the remaining asynchronous network requests.

[0093] It should be noted that the execution order of the remaining asynchronous network requests is the key to ensuring efficient execution of the requests, avoiding request blocking or errors caused by improper dependency handling.

[0094] S403: Based on the asynchronous task queue, execute the remaining asynchronous network requests in the execution order.

[0095] Exemplarily, the asynchronous task queue is used as a middleware for storing and managing asynchronous network requests, and schedules and executes the remaining asynchronous network requests according to the determined execution order of the remaining asynchronous network requests. The advantage of the asynchronous task queue is that it can process requests asynchronously, that is, while waiting for a request response, it can continue to process the next task in the asynchronous task queue, thereby maximizing the use of resources and avoiding waiting time.

[0096] Based on this, the asynchronous task queue is used to determine the execution order according to the dependencies and priorities between asynchronous network requests, and then all remaining asynchronous network requests are processed efficiently and orderly according to the execution order of each remaining asynchronous network request, ensuring data consistency while optimizing response time and overall throughput.

[0097] Optionally, the above step of adding at least one remaining asynchronous network request to the asynchronous task queue includes: adjusting the execution status of each remaining asynchronous network request based on the asynchronous task queue.

[0098] Exemplarily, the asynchronous task queue is not only responsible for storing the asynchronous network requests to be processed, but also responsible for managing the execution status of the asynchronous network requests. When the asynchronous task queue receives asynchronous network requests from different parts, each asynchronous network request is temporarily stored until it is scheduled for execution.

[0099] Exemplarily, the execution status includes pause, resume and cancel. Among them, pause means temporarily stopping the execution of each request task in the asynchronous task queue under certain conditions such as system resource shortage and user pause operation, and resuming execution after the conditions are met. Resume corresponds to the pause operation, that is, continue to execute the request task in the asynchronous task queue at an appropriate time to ensure the continuity and integrity of the request task. Cancel means canceling the request task that is no longer needed or has expired, so as to save resources and avoid useless calculations.

[0100] Based on this, the execution strategy of the request task is dynamically adjusted according to the actual operation conditions such as network status, system load, and user interaction. For example, when the network is unstable, the network request is suspended to avoid resource waste and errors, and when the user is active, the tasks closely related to user interaction are prioritized to improve the sense of immediate feedback. Based on the asynchronous task queue, the life cycle of asynchronous operations is finely controlled, which helps to reduce network delays, ensure the front-end application system process runs efficiently and responds quickly, and thus improve the overall user experience and application performance.

[0101] As a possible implementation manner, the method further includes: for the multiple asynchronous network requests monitored, based on the request attributes of each asynchronous network request, bundling the asynchronous network requests with the same request attributes.

[0102] Optionally, bundling processing refers to integrating asynchronous network requests with the same request attributes into a batch job, that is, a batch processing mechanism. The request attributes include similar processing logic, data involving the same type, etc. Since different asynchronous network requests may involve the same type of data or follow similar processing logic, such as loading multiple images at one time, obtaining a group of user information, etc., in order to optimize multiple asynchronous network requests, asynchronous network requests with the same request attributes can be bundled and merged instead of processing each asynchronous network request separately.

[0103] For example, bundling multiple asynchronous network requests with the same request attributes into a large request reduces the number of network transmissions compared to processing each request in sequence. Since each request is accompanied by a certain amount of request overhead such as network delay, the cumulative overhead of each request significantly affects the response speed of the application. Reducing the number of requests through batch processing also reduces the request overhead. In addition, since the initialization cost of processing requests is reduced, processing a single large request is more efficient than processing multiple small requests. Therefore, bundling processing can not only make resource allocation more centralized and reduce the pressure of concurrent processing of the front-end application system, but also effectively reduce the overall load of the server.

[0104] Based on this, bundling processing is a very practical performance optimization strategy. By implementing a batch processing mechanism, it can significantly improve the data transmission efficiency of the front-end application system, reduce network latency, and optimize server resource utilization.

[0105] As a possible implementation manner, the method further includes: if the request task corresponding to the asynchronous network request belongs to a preset type of task, dividing the request task into a plurality of subtasks, and executing each subtask at a different time node.

[0106] Optionally, the preset type of task includes: a computationally intensive task. The characteristic of a computationally intensive task is that a large amount of processor calculation is required, and more time is spent on calculation in the CPU than waiting for external input / output operations. In order to better schedule and manage computationally intensive tasks, this type of request task can be decomposed into multiple smaller, independent subtasks, and since smaller subtasks are easier to allocate and execute, the parallelism of the request task can also be increased.

[0107] For example, after the request task is divided into multiple subtasks, not all subtasks are executed immediately. Instead, the execution time of each subtask is intelligently arranged based on information such as the current load of the front-end application system and resource availability, ensuring that each subtask is started when the system is idle or resources are sufficient, thereby avoiding resource competition caused by executing a large number of tasks at the same time.

[0108] It should be noted that based on the above-mentioned task decomposition strategy, a single task can avoid causing a surge in CPU usage, making the CPU load more uniform and predictable. This not only helps to maintain the overall stability of the front-end application system, but also reduces the risk of overheating, slow response and even crashes caused by long-term full-load operation of the CPU.

[0109] Based on this, since the system response speed depends largely on the availability of the CPU, if the CPU is continuously occupied, the resources for processing foreground tasks such as user interface updates and input responses will be reduced, causing users to feel that the system is slow or stuck. By dispersing task execution, it ensures that even while executing computationally intensive tasks, the system still has enough resources to respond to user interactions and other background services, thereby not only improving system efficiency and responsiveness, but also keeping system processes running.

[0110] In summary, compared with traditional concurrent processing solutions, this application has the following advantages:

[0111] Dynamically adjust the number of concurrent requests: Traditional solutions usually use a fixed number of concurrent requests, while the intelligent concurrent scheduler of this solution can dynamically adjust the number of concurrent requests based on real-time system resources and network conditions, thereby improving resource utilization and response speed.

[0112] Real-time resource monitoring: The resource monitoring module provides real-time monitoring of CPU, memory, disk I / O, and network status. Compared with traditional periodic or passive monitoring, it can detect and respond to resource bottlenecks more promptly.

[0113] Comprehensive error handling: The error handling and retry mechanism can identify multiple error causes and execute corresponding retry strategies. Compared with traditional solutions, it greatly reduces request failures caused by improper error handling.

[0114] Flexible request priority management: The request priority system allows developers to assign different priorities to requests based on business logic, so that key requests can be processed first and the user experience is optimized.

[0115] Efficient task queue management: Asynchronous task queues not only store and manage tasks, but also support task suspension, resumption, and cancellation, as well as dependency management, providing more sophisticated task control capabilities.

[0116] Performance optimization: By batch processing requests and task merging and splitting, the number of network communications and CPU usage peaks are reduced, which more effectively optimizes system performance compared to traditional solutions.

[0117] Easy to integrate and use: This solution is designed with compatibility with the existing front-end ecosystem in mind and can be seamlessly integrated into various front-end projects, reducing the access cost for developers.

[0118] Scalability: The solution is designed with an emphasis on scalability, allowing developers to add new features such as logging and performance analysis as needed without making large-scale changes to the existing architecture.

[0119] Security: Security is fully considered when designing the concurrency control framework, such as preventing malicious requests from causing service denial attacks and ensuring the legitimacy and security of requests.

[0120] The embodiment of the present application provides an efficient, flexible, safe and easy-to-maintain asynchronous network request processing mechanism through intelligent, automated and refined management, which can significantly improve the performance and user experience of the front-end application system. Specifically, by building an intelligent concurrent scheduler, including resource monitoring module, error handling and retry mechanism, request priority system, asynchronous task queue and performance optimization functions, efficient management of a large number of asynchronous network requests is achieved. Among them, the intelligent concurrent scheduler dynamically adjusts the number of concurrency, the resource monitoring module guarantees system stability, the error handling and retry mechanism enhances the robustness of the system, the request priority system allows developers to set the priority of different requests according to business needs, and ensures the rapid response of key tasks. The asynchronous task queue provides task state management, pause, resume and cancel operations, as well as task sorting and dependency management functions, and the performance optimization strategy further reduces the overhead in the scheduling and execution process by batch processing requests and task merging and segmentation, and optimizes CPU and memory usage. Overall, the embodiment of the present application provides a comprehensive, flexible and high-performance asynchronous request processing framework for front-end applications.

[0121] Based on the same inventive concept, a concurrent control system corresponding to the concurrent processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the concurrent control system in the embodiment of the present application is similar to the above-mentioned concurrent processing method in the embodiment of the present application, the implementation of the device concurrent control system can refer to the implementation of the concurrent processing method, and the repeated parts will not be repeated.

[0122] Figure 5 The structure diagram of a concurrent control system provided by an embodiment of the present application is shown. The control system can be integrated into one or more electronic devices. Figure 5 As shown, the concurrency control system 500 provided in the embodiment of the present application includes: a resource monitoring module 501 and an intelligent concurrency scheduler 502, wherein:

[0123] The resource monitoring module 501 is used to obtain resource usage information of the front-end application system, and determine whether the concurrency adjustment condition is met based on the resource usage information, where the resource usage information is used to indicate the currently occupied resources; when the concurrency adjustment condition is met, a concurrency adjustment request is generated, and the concurrency adjustment request carries the resource usage information;

[0124] The intelligent concurrent scheduler 502 is used to adjust the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and to execute the adjusted concurrent number of target asynchronous network requests in parallel.

[0125] Based on this, according to the concurrency control system of the embodiment of the present application, based on the currently occupied resource usage information in the front-end application system, it is determined whether the concurrency adjustment conditions are met, and when the concurrency adjustment conditions are met, a concurrency adjustment request is generated, and then according to the resource usage information, the concurrency number of asynchronous network requests to be processed concurrently in the front-end application system is adjusted, and the target asynchronous network request with the adjusted concurrency number is executed in parallel. According to the embodiment of the present application, there is no need for developers to handle the concurrency details by themselves. By real-time monitoring of the resource usage of the front-end application system, resource bottlenecks can be discovered and responded to more promptly than traditional periodic or passive monitoring, and the number of concurrent requests that the front-end application system can allow to be processed simultaneously is dynamically calculated and adjusted according to the resource usage of the front-end application system, which not only improves resource utilization and response speed, but also realizes efficient management of a large number of asynchronous network requests.

[0126] In a possible implementation manner, the resource monitoring module 501 is specifically used for:

[0127] Comparing the resource usage information with a preset resource usage threshold to obtain a comparison result;

[0128] Based on the comparison results, determine whether the concurrent adjustment conditions are met.

[0129] In a possible implementation manner, the intelligent concurrent scheduler 502 is specifically used for:

[0130] Get the initial concurrent number and preset concurrent adjustment time of the front-end application system;

[0131] Determine the target concurrency based on the preset computing strategy and resource usage information, where the resource usage information includes one or more of the following: processor usage, memory information, disk input / output operation rate, and network status information;

[0132] According to the preset concurrency adjustment time, the concurrency number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted from the initial concurrency number to the target concurrency number, and the target asynchronous network requests of the target concurrency number are executed in parallel.

[0133] In a possible implementation manner, the intelligent concurrent scheduler 502 is specifically used for:

[0134] Determine the priority of each asynchronous network request according to the business attributes corresponding to each asynchronous network request to be processed concurrently in the front-end application system;

[0135] According to the priority of each asynchronous network request, a target asynchronous network request corresponding to the adjusted concurrent number is screened out from multiple asynchronous network requests to be concurrently processed by the front-end application system, and the target asynchronous network request is concurrently executed.

[0136] In a possible implementation manner, the concurrent control system 500 further includes an error handling module, which is specifically used to:

[0137] If the response to the target asynchronous network request fails, the request failure factor is obtained;

[0138] Determine the retry strategy based on the request failure factors.

[0139] In a possible implementation manner, the error handling module is further used to:

[0140] Determine the error handling logic corresponding to the request failure factor according to the attribute information of the request failure factor, where the attribute information includes the type and source of the request failure factor;

[0141] Determine the retry strategy based on the error handling logic.

[0142] In a possible implementation manner, the concurrent control system 500 further includes an asynchronous queue processing module, which is specifically used to:

[0143] If the number of asynchronous network requests to be processed concurrently in the front-end application system is greater than the adjusted concurrent number, at least one remaining asynchronous network request is added to the asynchronous task queue;

[0144] The remaining asynchronous network requests are asynchronous network requests other than the target asynchronous network request among the asynchronous network requests to be processed concurrently by the front-end application system.

[0145] In a possible implementation manner, the asynchronous queue processing module is further used to:

[0146] Get the dependencies and priorities of each remaining asynchronous network request;

[0147] Determine the execution order of the remaining asynchronous network requests according to the dependency and priority of the remaining asynchronous network requests;

[0148] Based on the asynchronous task queue, execute the remaining asynchronous network requests in the order of execution.

[0149] In a possible implementation manner, the asynchronous queue processing module is further used to:

[0150] Based on the asynchronous task queue, adjust the execution status of each remaining asynchronous network request, which includes pause, resume, and cancel.

[0151] In a possible implementation manner, the concurrent control system 500 further includes a performance optimization module, which is specifically used to:

[0152] For multiple monitored asynchronous network requests, based on the request attributes of each asynchronous network request, the asynchronous network requests with the same request attributes are bundled for processing.

[0153] In a possible implementation manner, the above performance optimization module is further used to:

[0154] If the request task corresponding to the asynchronous network request belongs to a preset type task, the request task is divided into a plurality of subtasks, wherein the preset type tasks include: a computationally intensive task;

[0155] Execute each subtask according to different time nodes.

[0156] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0157] The present application embodiment also provides an electronic device 600, such as Figure 6 As shown, it is a schematic diagram of the structure of an electronic device 600 provided in an embodiment of the present application, including: a processor 601, a memory 602, and optionally, a bus 603. The memory 602 stores machine-readable instructions executable by the processor 601. When the electronic device 600 is running, the processor 601 communicates with the memory 602 through the bus 603. When the machine-readable instructions are executed by the processor 601, the following processing is performed:

[0158] Obtain resource usage information of the front-end application system, and determine whether the concurrency adjustment condition is met based on the resource usage information, where the resource usage information is used to indicate currently occupied resources;

[0159] When the concurrency adjustment condition is met, a concurrency adjustment request is generated, and the concurrency adjustment request carries resource usage information;

[0160] According to the resource usage information, the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system is adjusted, and the target asynchronous network requests with the adjusted concurrent number are executed in parallel.

[0161] In a possible implementation manner, when the processor 601 executes an instruction for determining whether a concurrency adjustment condition is satisfied based on resource usage information, the processor 601 is specifically configured to:

[0162] Comparing the resource usage information with a preset resource usage threshold to obtain a comparison result;

[0163] Based on the comparison results, determine whether the concurrent adjustment conditions are met.

[0164] In a possible implementation manner, when the processor 601 executes an instruction to adjust the concurrent number of asynchronous network requests to be concurrently processed in the front-end application system according to the resource usage information, and to execute in parallel the adjusted concurrent number of target asynchronous network requests, it is specifically used to:

[0165] Get the initial concurrent number and preset concurrent adjustment time of the front-end application system;

[0166] Determine the target concurrency based on the preset computing strategy and resource usage information, where the resource usage information includes one or more of the following: processor usage, memory information, disk input / output operation rate, and network status information;

[0167] According to the preset concurrency adjustment time, the concurrency number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted from the initial concurrency number to the target concurrency number, and the target asynchronous network requests of the target concurrency number are executed in parallel.

[0168] In a possible implementation manner, when the processor 601 executes the instruction to execute in parallel the adjusted concurrent number of target asynchronous network requests, it is specifically configured to:

[0169] Determine the priority of each asynchronous network request according to the business attributes corresponding to each asynchronous network request to be processed concurrently in the front-end application system;

[0170] According to the priority of each asynchronous network request, a target asynchronous network request corresponding to the adjusted concurrent number is screened out from multiple asynchronous network requests to be concurrently processed by the front-end application system, and the target asynchronous network request is concurrently executed.

[0171] In a possible implementation manner, the processor 601 is further configured to:

[0172] If the response to the target asynchronous network request fails, the request failure factor is obtained;

[0173] Determine the retry strategy based on the request failure factors.

[0174] In a possible implementation manner, when the processor 601 executes the instruction for determining a retry strategy according to a request failure factor, it is specifically configured to:

[0175] Determine the error handling logic corresponding to the request failure factor according to the attribute information of the request failure factor, where the attribute information includes the type and source of the request failure factor;

[0176] Determine the retry strategy based on the error handling logic.

[0177] In a possible implementation manner, after executing the instruction to execute in parallel the adjusted concurrent number of target asynchronous network requests, the processor 601 is further configured to:

[0178] If the number of asynchronous network requests to be processed concurrently in the front-end application system is greater than the adjusted concurrent number, at least one remaining asynchronous network request is added to the asynchronous task queue;

[0179] The remaining asynchronous network requests are asynchronous network requests other than the target asynchronous network request among the asynchronous network requests to be processed concurrently by the front-end application system.

[0180] In a possible implementation manner, when the processor 601 executes the instruction to add at least one remaining asynchronous network request to the asynchronous task queue, it is specifically configured to:

[0181] Get the dependencies and priorities of each remaining asynchronous network request;

[0182] Determine the execution order of the remaining asynchronous network requests according to the dependency and priority of the remaining asynchronous network requests;

[0183] Based on the asynchronous task queue, execute the remaining asynchronous network requests in the order of execution.

[0184] In a possible implementation manner, when the processor 601 executes the instruction to add at least one remaining asynchronous network request to the asynchronous task queue, it is specifically configured to:

[0185] Based on the asynchronous task queue, adjust the execution status of each remaining asynchronous network request, which includes pause, resume, and cancel.

[0186] In a possible implementation manner, the processor 601 is further configured to:

[0187] For multiple monitored asynchronous network requests, based on the request attributes of each asynchronous network request, the asynchronous network requests with the same request attributes are bundled for processing.

[0188] In a possible implementation manner, the processor 601 is further configured to:

[0189] If the request task corresponding to the asynchronous network request belongs to a preset type task, the request task is divided into a plurality of subtasks, wherein the preset type tasks include: a computationally intensive task;

[0190] Execute each subtask according to different time nodes.

[0191] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are performed:

[0192] Obtain resource usage information of the front-end application system, and determine whether the concurrency adjustment condition is met based on the resource usage information, where the resource usage information is used to indicate currently occupied resources;

[0193] When the concurrency adjustment condition is met, a concurrency adjustment request is generated, and the concurrency adjustment request carries resource usage information;

[0194] According to the resource usage information, the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system is adjusted, and the target asynchronous network requests with the adjusted concurrent number are executed in parallel.

[0195] In a possible implementation manner, when the processor executes the instruction for determining whether the concurrency adjustment condition is satisfied based on the resource usage information, the processor is specifically configured to:

[0196] Comparing the resource usage information with a preset resource usage threshold to obtain a comparison result;

[0197] Based on the comparison results, determine whether the concurrent adjustment conditions are met.

[0198] In a possible implementation manner, when the processor executes an instruction to adjust the concurrent number of asynchronous network requests to be concurrently processed in the front-end application system according to the resource usage information, and to execute in parallel the adjusted concurrent number of target asynchronous network requests, it is specifically used to:

[0199] Get the initial concurrent number and preset concurrent adjustment time of the front-end application system;

[0200] Determine the target concurrency based on the preset computing strategy and resource usage information, where the resource usage information includes one or more of the following: processor usage, memory information, disk input / output operation rate, and network status information;

[0201] According to the preset concurrency adjustment time, the concurrency number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted from the initial concurrency number to the target concurrency number, and the target asynchronous network requests of the target concurrency number are executed in parallel.

[0202] In a possible implementation manner, when the processor executes the instruction to execute in parallel the adjusted concurrent number of target asynchronous network requests, it is specifically configured to:

[0203] Determine the priority of each asynchronous network request according to the business attributes corresponding to each asynchronous network request to be processed concurrently in the front-end application system;

[0204] According to the priority of each asynchronous network request, a target asynchronous network request corresponding to the adjusted concurrent number is screened out from multiple asynchronous network requests to be concurrently processed by the front-end application system, and the target asynchronous network request is concurrently executed.

[0205] In a possible implementation manner, the processor is further configured to:

[0206] If the response to the target asynchronous network request fails, the request failure factor is obtained;

[0207] Determine the retry strategy based on the request failure factors.

[0208] In a possible implementation manner, when the processor executes the instruction for determining a retry strategy according to a request failure factor, it is specifically configured to:

[0209] Determine the error handling logic corresponding to the request failure factor according to the attribute information of the request failure factor, where the attribute information includes the type and source of the request failure factor;

[0210] Determine the retry strategy based on the error handling logic.

[0211] In a possible implementation manner, after executing the instruction to execute in parallel the adjusted concurrent number of target asynchronous network requests, the processor is further configured to:

[0212] If the number of asynchronous network requests to be processed concurrently in the front-end application system is greater than the adjusted concurrent number, at least one remaining asynchronous network request is added to the asynchronous task queue;

[0213] The remaining asynchronous network requests are asynchronous network requests other than the target asynchronous network request among the asynchronous network requests to be processed concurrently by the front-end application system.

[0214] In a possible implementation manner, when the processor executes the instruction to add at least one remaining asynchronous network request to the asynchronous task queue, it is specifically configured to:

[0215] Get the dependencies and priorities of each remaining asynchronous network request;

[0216] Determine the execution order of the remaining asynchronous network requests according to the dependency and priority of the remaining asynchronous network requests;

[0217] Based on the asynchronous task queue, execute the remaining asynchronous network requests in the order of execution.

[0218] In a possible implementation manner, when the processor executes the instruction to add at least one remaining asynchronous network request to the asynchronous task queue, it is specifically configured to:

[0219] Based on the asynchronous task queue, adjust the execution status of each remaining asynchronous network request, which includes pause, resume, and cancel.

[0220] In a possible implementation manner, the processor is further configured to:

[0221] For multiple monitored asynchronous network requests, based on the request attributes of each asynchronous network request, the asynchronous network requests with the same request attributes are bundled for processing.

[0222] In a possible implementation manner, the processor is further configured to:

[0223] If the request task corresponding to the asynchronous network request belongs to a preset type task, the request task is divided into a plurality of subtasks, wherein the preset type tasks include: a computationally intensive task;

[0224] Execute each subtask according to different time nodes.

[0225] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0226] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, which 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 method 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, RandomAccess Mem ory), disk or optical disk and other media that can store program code.

[0227] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A concurrent processing method, characterized in that: include: Obtain resource usage information of the front-end application system, and determine whether a concurrency adjustment condition is met based on the resource usage information, wherein the resource usage information is used to indicate currently occupied resources; When the concurrency adjustment condition is met, generating a concurrency adjustment request, wherein the concurrency adjustment request carries the resource usage information; According to the resource usage information, the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system is adjusted, and the adjusted concurrent number of target asynchronous network requests is executed in parallel.

2. The concurrent processing method according to claim 1, characterized in that: The determining whether a concurrency adjustment condition is met based on the resource usage information includes: Comparing the resource usage information with a preset resource usage threshold to obtain a comparison result; According to the comparison result, it is determined whether the concurrent adjustment condition is met.

3. The concurrent processing method according to claim 1, characterized in that: The step of adjusting the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and executing the adjusted concurrent number of target asynchronous network requests in parallel, comprises: Obtaining the initial concurrent number and preset concurrent adjustment time of the front-end application system; Determine the target concurrent quantity based on the preset computing strategy and the resource usage information, wherein the resource usage information includes one or more of the following: processor usage rate, memory information, disk input / output operation rate, and network status information; According to the preset concurrency adjustment time, the concurrency number of asynchronous network requests to be concurrently processed in the front-end application system is adjusted from the initial concurrency number to the target concurrency number, and the target asynchronous network requests of the target concurrency number are executed in parallel.

4. The concurrent processing method according to claim 1, characterized in that: The parallel execution of the adjusted concurrent number of target asynchronous network requests includes: Determining the priority of each asynchronous network request according to the service attributes corresponding to each asynchronous network request to be processed concurrently in the front-end application system; According to the priority of each asynchronous network request, a target asynchronous network request corresponding to the adjusted concurrent number is screened out from the multiple asynchronous network requests to be concurrently processed by the front-end application system, and the target asynchronous network request is concurrently executed.

5. The concurrent processing method according to claim 1, characterized in that: The method further comprises: If responding to the target asynchronous network request fails, obtaining the request failure factor; Determine a retry strategy based on the request failure factors.

6. The concurrent processing method according to claim 5, characterized in that: Determining a retry strategy according to the request failure factor includes: Determining an error handling logic corresponding to the request failure factor according to attribute information of the request failure factor, wherein the attribute information includes a type and a source of the request failure factor; The retry strategy is determined according to the error handling logic.

7. The concurrent processing method according to claim 1, characterized in that: After the adjusted concurrent number of target asynchronous network requests is executed in parallel, the method further includes: If the number of asynchronous network requests to be processed concurrently in the front-end application system is greater than the adjusted concurrent number, adding at least one remaining asynchronous network request to the asynchronous task queue; The remaining asynchronous network requests are asynchronous network requests other than the target asynchronous network request among the asynchronous network requests to be concurrently processed by the front-end application system.

8. The concurrent processing method according to claim 7, characterized in that: The step of adding at least one remaining asynchronous network request to the asynchronous task queue includes: Obtaining the dependency and priority of each of the remaining asynchronous network requests; Determining the execution order of the remaining asynchronous network requests according to the dependency relationship and priority of the remaining asynchronous network requests; Based on the asynchronous task queue, each of the remaining asynchronous network requests is executed according to the execution order.

9. The concurrent processing method according to claim 7, characterized in that: The step of adding at least one remaining asynchronous network request to the asynchronous task queue includes: Based on the asynchronous task queue, the execution status of each of the remaining asynchronous network requests is adjusted, and the execution status includes pause, resume and cancel.

10. The concurrent processing method according to claim 1, characterized in that: The method further comprises: For the multiple asynchronous network requests monitored, based on the request attributes of each of the asynchronous network requests, the asynchronous network requests with the same request attributes are bundled for processing.

11. The concurrent processing method according to claim 10, characterized in that: The method further comprises: If the request task corresponding to the asynchronous network request belongs to a preset type of task, the request task is divided into a plurality of subtasks, wherein the preset type of task includes: a computationally intensive task; The subtasks are executed at different time points.

12. A concurrent control system, characterized in that: The concurrency control system includes an intelligent concurrency scheduler and a resource monitoring module; The resource monitoring module is used to obtain resource usage information of the front-end application system, and determine whether a concurrency adjustment condition is met based on the resource usage information, wherein the resource usage information is used to indicate currently occupied resources; when the concurrency adjustment condition is met, a concurrency adjustment request is generated, wherein the concurrency adjustment request carries the resource usage information; The intelligent concurrent scheduler is used to adjust the concurrent number of asynchronous network requests to be processed concurrently in the front-end application system according to the resource usage information, and to execute the adjusted concurrent number of target asynchronous network requests in parallel.

13. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the concurrent processing method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the concurrent processing method according to any one of claims 1 to 11 are executed.

Citation Information

Cited By

  • Page picture resource progressive loading method, device and system and storage medium

    CN119669595A

  • Concurrent request processing method and device, equipment and storage medium

    CN120583151A

  • Asynchronous request processing method and device, equipment, storage medium and program product

    CN121664887A

  • Scheduling method and device for parallel construction tasks of static website generator and electronic equipment

    CN121919010A

  • Static website generator scheduling method and device for building tasks in parallel and electronic equipment

    CN121919010B