Task processing method and device, equipment and storage medium

By dynamically adjusting the timeout threshold and rechecking time, using the historical and real-time response data of the service nodes, the problem of untimely response to task requests in the Internet scenario is solved, and the low latency and efficiency of task requests are achieved.

CN119065798APending Publication Date: 2024-12-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310631482.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In the Internet scenario, due to complex network conditions and unstable service nodes, the task request response of the interface call method is not timely, and the static timeout threshold cannot be effectively adapted during the peak traffic period and low peak traffic, resulting in an increase in the delay in task requests.

Method used

By dynamically adjusting the timeout threshold, the service node's historical response data and the real-time response time in the current interaction process are used to determine the dynamic timeout time and re-check time, ensuring that the timeout threshold of the task request is in line with the actual network environment, thereby improving the effectiveness of the task and Low latency.

Benefits of technology

Effectively adapt to various network environments, reduce the delay of task requests, and improve response efficiency, avoiding long-term waiting caused by network problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065798A_ABST
    Figure CN119065798A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a task processing method and device, equipment and a storage medium, which are used for dynamically adjusting an overtime threshold so as to more effectively adapt to various network environments and ensure the effectiveness and low delay of tasks. Comprising the steps that task requests are sent to N downstream service nodes, the waiting duration of each downstream service node in the N downstream service nodes for the task requests is recorded, and N is a positive integer; when N is greater than or equal to 2, obtaining response duration fed back by at least one first downstream service node included in N downstream service nodes; determining a dynamic timeout duration of at least one second downstream service node included in the N downstream service nodes according to the response duration; and when the waiting duration of the second downstream service node is greater than the dynamic timeout duration, ending the task request. The technical scheme provided by the invention can be applied to the fields of Internet technology, cloud technology, big data and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a task processing method, device, equipment and storage medium. Background Art

[0002] With the development of Internet technology, various systems have been developed, and there are various data interactions between systems. There are various ways of data interaction, such as data access through interfaces, direct interactive access through databases, or direct communication through various request messages or other methods. Now, interfaces are often called for data interaction using communication protocols, which is the most common method in current Internet scenarios. This method can quickly interact with data in multiple systems and improve efficiency. However, due to various factors such as complex network conditions or unstable service node systems, this interface call method has the problem of untimely response to task requests.

[0003] To solve this problem, a reasonable timeout threshold is usually set for the task request so that the task request can be terminated as soon as possible after the timeout, instead of occupying network resources and waiting for the service node to respond to the task request, thereby making the task request have lower latency.

[0004] Different application scenarios have different characteristics of task request traffic, that is, there are usually traffic peaks and low traffic peaks, at which time the static timeout threshold will have problems. Therefore, in order to more effectively adapt to the current network environment, it is necessary to provide a very effective task processing method. Summary of the invention

[0005] The embodiments of the present application provide a task processing method, apparatus, device and storage medium for dynamically adjusting a timeout threshold, thereby more effectively adapting to a variety of network environments and ensuring the effectiveness and low latency of tasks.

[0006] In view of this, the present application provides a task processing method on the one hand, including: sending a task request to N downstream service nodes, and recording the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer; when N is greater than or equal to 2, obtaining the response time fed back by at least one first downstream service node, the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout period, and the first network timeout period is determined according to the historical response data of the first downstream service node; determining the dynamic timeout period of at least one second downstream service node according to the response time, the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout period, and the second network timeout period is determined according to the historical response data of the second downstream service node; when the waiting time of the second downstream service node is greater than the dynamic timeout period, terminating the task request.

[0007] Another aspect of the present application provides a task processing device, comprising:

[0008] A sending module, used to send a task request to N downstream service nodes, and record the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer;

[0009] an acquisition module, configured to acquire, when N is greater than or equal to 2, a response duration fed back by at least one first downstream service node, the at least one first downstream service node being included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout duration, and the first network timeout duration is determined according to historical response data of the first downstream service node;

[0010] A processing module is used to determine a dynamic timeout duration of at least one second downstream service node according to the response duration, wherein the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout duration, and the second network timeout duration is determined based on historical response data of the second downstream service node; when the waiting time of the second downstream service node is greater than the dynamic timeout duration, the task request is terminated.

[0011] In a possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is specifically configured to average the response duration to obtain a first average response duration;

[0012] The first average response time is multiplied by a first waiting factor to obtain a first product value, where the first waiting factor is a set weight value;

[0013] The larger value of the first product value and the minimum waiting time is used to obtain the dynamic timeout time, and the minimum waiting time is the set static threshold.

[0014] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is further used to determine the dynamic recheck duration of the second downstream service node according to the response duration;

[0015] The sending module is further configured to send a recheck request to the second downstream service point when the waiting time of the second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time.

[0016] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to average the response time to obtain the first average response time;

[0017] Obtaining a second product value of the first average response time and a second waiting factor, where the second waiting factor is a set weight value and the second waiting factor is less than the first waiting factor;

[0018] The larger value of the second product value and the minimum recheck waiting time is used to obtain the dynamic timeout time, and the minimum recheck waiting time is the set static threshold.

[0019] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to update the re-check statistics of the second downstream service node.

[0020] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is further used to determine the dynamic recheck duration of the second downstream service node according to the response duration;

[0021] Obtain the number of recheck statistics of the second downstream service node;

[0022] The sending module is further used to send a recheck request to the second downstream service point when the waiting time of the second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time, and the recheck statistical number is less than a first threshold.

[0023] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is also used to update the historical response data of the first downstream service node according to the response duration.

[0024] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is further used to acquire a response status of the first downstream service node, where the response status is used to indicate whether the first downstream service node succeeds or fails in feeding back data;

[0025] The processing module is further used to determine the amount of data currently received by the task request according to the response status;

[0026] When the waiting time of the second downstream service node is greater than the minimum waiting time and the data volume meets the layer loss ratio, the task request is terminated. The layer loss ratio is used to indicate the ratio of the currently received data volume to the complete data volume corresponding to the task request.

[0027] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is also used to set an overall waiting time for the task request during the current interaction process.

[0028] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to terminate the task request when the waiting time of the second downstream service node is greater than the dynamic timeout time or greater than the overall waiting time.

[0029] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is used to acquire historical response data of the first downstream service node and historical response data of the second downstream service node, the historical response data of the first downstream service node includes the historical response duration of the first downstream service node, and the historical response data of the second downstream service node includes the historical response duration of the second downstream service node;

[0030] A processing module, configured to average the historical response time of the first downstream service node to obtain a second average response time, and average the historical response time of the second downstream service node to obtain a third average response time;

[0031] Setting the second average response duration as a first network timeout duration of the first downstream service node in the current interaction process;

[0032] The third average response duration is set as a second network timeout duration of the second downstream service node in the current interaction process.

[0033] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is used to acquire historical response data of the downstream service node when N is equal to 1, and the historical response data includes a historical response duration of the downstream service node;

[0034] A processing module, used for averaging the historical response time to obtain a third average response time;

[0035] Setting the third average response duration as a third network timeout duration of the downstream service node in the current interaction process;

[0036] When the waiting time of the downstream service node exceeds the third network timeout time, the task request is terminated.

[0037] Another aspect of the present application provides a computer device, including: a memory, a processor, and a bus system;

[0038] Wherein, the memory is used to store programs;

[0039] The processor is used to execute the program in the memory, and the processor is used to execute the above-mentioned methods according to the instructions in the program code;

[0040] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

[0041] Another aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.

[0042] Another aspect of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided by the above aspects.

[0043] It can be seen from the above technical scheme that the embodiments of the present application have the following advantages: the historical response data of the service node is used to dynamically set the network timeout period. At the same time, when there are multiple service nodes, the real-time response period of other service nodes in the current interaction process is used to determine the dynamic timeout period, so that the timeout threshold of the task request is more in line with the actual network environment, thereby ensuring the effectiveness and low latency of the task. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of the application architecture in the embodiment of the present application;

[0045] Figure 2a A schematic diagram of an application scenario of task processing in an embodiment of the present application;

[0046] Figure 2b A schematic diagram of a flow chart of dynamic timeout in task processing in an embodiment of the present application;

[0047] Figure 2c A schematic diagram of a process of dynamic rechecking in task processing in an embodiment of the present application;

[0048] Figure 3 A schematic diagram of an embodiment of a task processing method in an embodiment of the present application;

[0049] Figure 4 This is another schematic diagram of an embodiment of the task processing method in the embodiment of the present application;

[0050] Figure 5 This is another schematic diagram of an embodiment of the task processing method in the embodiment of the present application;

[0051] Figure 6 This is another schematic diagram of an embodiment of the task processing method in the embodiment of the present application;

[0052] Figure 7 This is another schematic diagram of an embodiment of the task processing method in the embodiment of the present application;

[0053] Figure 8 A schematic diagram of an embodiment of a task processing device in an embodiment of the present application;

[0054] Fig. 9 This is another schematic diagram of an embodiment of a task processing device in an embodiment of the present application;

[0055] Fig.10 Schematic diagram of another embodiment of the task processing device in the embodiment of the present application. DETAILED DESCRIPTION

[0056] The embodiments of the present application provide a task processing method, apparatus, device and storage medium for dynamically adjusting a timeout threshold, thereby more effectively adapting to a variety of network environments and ensuring the effectiveness and low latency of tasks.

[0057] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0058] With the development of Internet technology, various systems have been developed, and there are various data interactions between systems. There are various ways of data interaction, including data access through interfaces, direct interactive access through databases, or direct communication through various request messages or other methods. Now, interfaces are often called for data interaction using communication protocols, which is the most common method in current Internet scenarios. This method can quickly interact with data in multiple systems and improve efficiency. However, due to various factors such as complex network conditions or unstable service node systems, this interface calling method has the problem of untimely response to task requests. In order to solve this problem, a reasonable timeout threshold is usually set for task requests, so that task requests can end task requests as soon as possible after timeout, instead of occupying network resources and waiting for service nodes to respond to the task requests, so that task requests have lower latency. Different application scenarios have different characteristics of the traffic of task requests, that is, there are usually peak traffic periods and low traffic peaks, and static timeout thresholds will have problems at this time. Therefore, in order to more effectively adapt to the current network environment, it is necessary to provide a very effective task processing method.

[0059] In order to solve the above technical problems, the present application provides the following technical solutions: sending a task request to N downstream service nodes, and recording the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer; when N is greater than or equal to 2, obtaining the response time fed back by at least one first downstream service node, the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout period, and the first network timeout period is determined according to the historical response data of the first downstream service node; determining the dynamic timeout period of at least one second downstream service node according to the response time, the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout period, and the second network timeout period is determined according to the historical response data of the second downstream service node; when the waiting time of the second downstream service node is greater than the dynamic timeout period, terminating the task request. In this way, the historical response data of the service node is used to dynamically set the network timeout period. At the same time, when there are multiple service nodes, the real-time response time of other service nodes in the current interaction process is used to determine the dynamic timeout period, so that the timeout threshold of the task request is more in line with the actual network environment, thereby ensuring the effectiveness and low latency of the task.

[0060] The present application provides a task processing method, apparatus, device, and storage medium, which can dynamically adjust the timeout threshold, thereby more effectively adapting to a variety of network environments to ensure the effectiveness and low latency of the task. The following describes an exemplary application of the electronic device provided by the present application. The electronic device provided by the present application can be implemented as various types of user terminals or as a server.

[0061] By running the task processing scheme provided by the embodiment of the present application, the electronic device can dynamically adjust the timeout threshold, thereby more effectively adapting to various network environments and ensuring the effectiveness and low latency of the task. That is, the electronic device itself dynamically adjusts the timeout threshold, thereby more effectively adapting to various network environments and ensuring the effectiveness and low latency of the task. It is applicable to various application scenarios. For example, information search, etc.

[0062] See also Figure 1 , Figure 1It is an optional architecture diagram under an application scenario of the task processing solution provided in the embodiment of the present application. In order to realize and support a task processing solution, the terminal device 100 is connected to the server 300 through the network 200, and the server 300 is connected to the database 400. The network 200 can be a wide area network or a local area network, or a combination of the two. The client for implementing the task processing solution is deployed on the terminal device 100, wherein the client can be run on the terminal device 100 in the form of a browser, or can be run on the terminal device 100 in the form of an independent application (application, APP), etc. The specific presentation form of the client is not limited here. The server 300 involved in the present application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal device 100 can be a smart phone, a tablet computer, a laptop, a PDA, a personal computer, a smart TV, a smart watch, a vehicle-mounted device, a wearable device, etc., but is not limited thereto. The terminal device 100 and the server 300 can be directly or indirectly connected through the network 200 by wired or wireless communication, and this application does not limit this. The number of servers 300 and terminal devices 100 is also not limited. The solution provided in this application can be completed independently by the terminal device 100, or by the server 300, or by the terminal device 100 and the server 300 in cooperation, and this application does not make specific limitations. Among them, the database 400, in short, can be regarded as an electronic filing cabinet-a place for storing electronic files, and users can add, query, update, delete, and other operations on the data in the file. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application program. A database management system (DBMS) is a computer software system designed for managing databases, generally with basic functions such as storage, interception, security, and backup.Database management systems can be classified according to the database models they support, such as relational, Extensible Markup Language (XML); or according to the types of computers they support, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to performance impulse focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages ​​at the same time. In the present application, database 400 can be used to store historical response data and the response time and response status in the current interaction process. Of course, the storage location of historical response data and the response time and response status in the current interaction process is not limited to the database, for example, it can also be stored in the terminal device 100, blockchain or distributed file system of server 300.

[0063] Based on the above structure, Figure 2a An application scenario shown is used to illustrate the task processing flow of this application:

[0064] like Figure 2a As shown, node A is an upstream service node, and node B1, node B2 and node B3 are sub-service nodes of the downstream service node B of node A, wherein the node B1, node B2 and node B3 are responsible for part of the data respectively. Therefore, in the actual application scenario, the node A needs to send a task request to the node B1, node B2 and node B3 at the same time, and then the node B1, node B2 and node B3 respond to the task request in the current interaction process and send back packet data to the node A. In this application scenario, the node A will record and save two copies of data. One of the data is the historical response data corresponding to the node B1, node B2 and node B3 respectively. It can be understood that the historical response data can be the corresponding historical response data within the time window, such as the response data of the node B1 in the 1000 task requests before the current interaction process; or, the response data corresponding to the task request processed by the node B1 within 4 minutes before the current interaction process, which is not limited here. The other data is the response data returned by each downstream service node after responding to the task request in the current interaction process.

[0065] Based on the above two sets of data, during the current interaction process, node A can determine its corresponding network timeout duration according to the historical response data corresponding to nodes B1, B2 and B3 respectively, that is, the network timeout duration corresponding to node B1 can be set to T1, the network timeout duration corresponding to node B2 can be set to T2, and the network timeout duration corresponding to node B3 can be set to T3.

[0066] After the node B1, node B2 and node B3 receive the task request sent by the node A, they can respond to the task request according to their specific network environment and system conditions. Assume that the node B1 responds to the task request within T1 and feeds back response data 1, wherein the response data 1 includes response status 1 and response duration S1; the node B2 responds to the task request within T2 and feeds back response data 2, wherein the response data 2 includes response status 2 and response duration S2. Since the node B1, node B2 and node B3 have the same processing logic, theoretically the node B3 should also be able to feed back response data within T3. At this time, the node A can determine the dynamic timeout duration of the node B3 according to the response duration S1 and the response duration S2. Similarly, the node A can also determine the dynamic recheck duration of the node B3 according to the response duration S1 and the response duration S2. Finally, the node A executes the task request based on the dynamic timeout duration and the dynamic recheck duration.

[0067] by Figure 2b The flowchart shown illustrates the task processing method of this application:

[0068] 1. According to the historical response data of each service node, set the network timeout for a single task request, which can be recorded as SOCKET_TIMEOUT.

[0069] 2. Request all shard services in parallel (i.e. send task requests to all service nodes corresponding to the task request).

[0070] 3. Determine whether the current task request has timed out. Specifically, this can be determined in the following ways:

[0071] In an exemplary solution, the overall waiting time of the task request is set. If the waiting time of any service node in the current task request exceeds the overall waiting time, it is determined that the current task request has timed out and the task request is terminated.

[0072] In another exemplary scheme, the dynamic timeout period is determined based on the minimum waiting time and the response time obtained from multiple service nodes. If the waiting time of any service node in the current task request exceeds the dynamic timeout period, the current task request is determined to have timed out and the task request is terminated.

[0073] 4. Asynchronously execute the historical response data update of the service node that returns the response data within the network timeout period in step 3, and process the return packet data of the service node; at the same time, trigger a notification signal to notify other service nodes to continue to execute the task request.

[0074] 5. After receiving the notification signal, continue to execute the dynamic timeout detection process and determine the amount of data received by the current task request. If the waiting time in other service nodes exceeds the minimum waiting time and the current amount of data received reaches the layer loss ratio, it is determined that the result of the current task request is valid. At this time, the task request can be terminated in advance, otherwise the task continues to be executed.

[0075] During the task execution process, the upstream service node can also perform a dynamic recheck operation. It is understandable that the dynamic recheck process is located in the above Figure 2b Between 3 and 4 in the process shown, the specific process can be as follows Figure 2c As shown:

[0076] 1. Determine the dynamic recheck duration based on the statically configured minimum recheck waiting time and the response time obtained when multiple service nodes are used, and determine whether recheck is required based on the waiting time and the dynamic recheck time.

[0077] 2. For the service nodes that did not respond to the task request, send a recheck request. It is understandable that each service node can set a flow control mechanism for recheck requests. If the number of recheck statistics of the current service node is greater than the threshold in the flow control mechanism, then no recheck will be performed to prevent avalanches.

[0078] It can be understood that in the specific implementation of the present application, related data such as historical response data and response time and response status in the current interaction process are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0079] Combined with the above introduction, the following describes the task processing method in this application with different numbers of downstream service nodes. Figure 3 , taking the case where the number of downstream service nodes is greater than or equal to 2 and the upstream service node is the execution subject as an example, the task processing method in the embodiment of the present application is introduced, and one embodiment thereof includes:

[0080] 301. Send a task request to N downstream service nodes, where N is a positive integer greater than or equal to 2.

[0081] In the case where each of the N downstream service nodes is responsible for part of the data for the task request of the upstream service node, the upstream service node needs to send the task requests to the N downstream service nodes at the same time.

[0082] In an exemplary embodiment, Figure 2a In the application scenario shown, the node A is used as the upstream service node, and the node B1, node B2 and node B3 are used as the three downstream service nodes of the node A. Then, the node A needs to send a task request to the node B1, node B2 and node B3 at the same time in each task. It is understandable that in different application scenarios, the task request can have different types. For example, in the search scenario, the task request can be a request to the downstream service node to return data that matches the search keyword. In an exemplary scheme, the task request can include the search keyword "the method of braised pork in brown sauce", and the downstream service node can be a server corresponding to different platforms (such as "XX kitchen", the server corresponding to this application software) or a server corresponding to the public network. The data returned by each server can be related articles or videos published by registered users of different platforms, such as the article entitled "the home-cooked method of braised pork in brown sauce" published by registered user "A" in the application software "XX kitchen".

[0083] 302. Record the waiting time of each downstream service node in the N downstream service nodes for the task request.

[0084] After the upstream service node sends the task request to the N downstream service nodes, the corresponding timer may be started for each of the N downstream service nodes, and then the timer is used to record the waiting time of each downstream service node for the task request.

[0085] In an exemplary embodiment, Figure 2a In the application scenario shown, after the node A sends a task request to the node B1, the node B2 and the node B3, timer 1 is started for the node B1, timer 2 is started for the node B2, and timer 3 is started for the node B3. The above three timers are used to record the waiting time of each node. It can be understood that after the node B1, the node B2 and the node B3 respond to the task request and feed back the response data, their corresponding timers will stop timing. For example, if the node B1 feeds back the response data to the node A within 3 milliseconds after the task request is sent, the timer of the node B1 will stop timing at 3 milliseconds.

[0086] In this embodiment, the response data includes response duration and response status, wherein the response duration is used to indicate the time taken by the downstream service node to respond to the task request successfully and return data, or the time taken to respond to the task failure and return a failure message, and the response status is used to indicate whether the downstream service node responds to the task request successfully or unsuccessfully.

[0087] 303. Obtain a response duration fed back by at least one first downstream service node, where the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout duration, and the first network timeout duration is determined based on historical response data of the first downstream service node.

[0088] During the current interaction process, if the downstream service node feeds back response data to the upstream service node within its corresponding network timeout duration, the downstream service node can be attributed to the first downstream service node, and the upstream server can then obtain the response duration of the first downstream service node.

[0089] It is understandable that the first downstream service node does not specify a particular downstream service node, but is used to indicate a type of downstream service node. Figure 2a In the application scenario shown, if the node B1 feeds back response data to the node A within its network timeout period, the node B1 will be attributed to the first downstream service node.

[0090] Optionally, the network timeout duration corresponding to the downstream service node is determined based on historical response data of the downstream service node, and the historical response data includes historical response duration.

[0091] In an exemplary solution, the upstream service node may average the historical response time of the downstream service node to obtain a first average response time, and then use the first average response time as the network timeout time of the downstream service node. Figure 2a In the application scenario shown, the node A obtains the 1000 historical response times of the node B1 before the current interaction process, and then calculates the average response time of the 1000 historical response times to be 100 milliseconds, so the network timeout of the node B1 can be set to 100 milliseconds. Similarly, the same method can be used to set the corresponding network timeout for nodes B2 and B3.

[0092] It is understandable that other methods may also be used when the upstream service node sets the network timeout period based on the historical response time, such as selecting the maximum value in the historical response time as the network timeout period, or selecting the median value in the historical response time as the network timeout period, etc., as long as the network timeout period can be made close to the actual network environment of the downstream service node, and no specific limitation is made here.

[0093] 304. Determine a dynamic timeout duration of at least one second downstream service node based on the response duration, where the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout duration, and the second network timeout duration is determined based on historical response data of the second downstream service node.

[0094] After the upstream service node obtains the response time from the first downstream service node, if it is determined that there is a second downstream service node in the downstream service node that has not responded to the task request, the upstream service node determines the dynamic timeout duration of the second downstream service node according to the response time of the first downstream service node and the minimum waiting time. In this embodiment, the minimum waiting time can be a static threshold value set according to an empirical value.

[0095] In an exemplary solution, the upstream service node averages the response time of the first downstream service node to obtain a first average response time; the first average response time is multiplied by a first waiting factor to obtain a first product value, where the first waiting factor is a set weight value; the larger value of the first product value and the minimum waiting time is taken to obtain the dynamic timeout time, where the minimum waiting time is a set static threshold. Figure 2a Taking the application scenario shown as an example, assuming that the response time of node A to obtain node B1 and node B2 at the current moment is 4 milliseconds and 6 milliseconds respectively, and the minimum waiting time is set to 10 milliseconds according to the empirical value, and the first waiting factor is set to 3, then the dynamic timeout duration of node B3 can be calculated as max(10, avg(4, 6)*3)=15.

[0096] It is understandable that the second downstream service node does not specify a specific downstream service node, but is used to indicate a type of downstream service node. Figure 2a In the application scenario shown, if the node B3 does not feed back response data to the node A after the node B1 and the node B2 respond to the task request, the node B3 will be classified as the first downstream service node.

[0097] Optionally, the network timeout duration corresponding to the downstream service node is determined based on historical response data of the downstream service node, and the historical response data includes historical response duration.

[0098] In an exemplary solution, the upstream service node may average the historical response time of the downstream service node to obtain a first average response time, and then use the first average response time as the network timeout time of the downstream service node. Figure 2a In the application scenario shown, the node A obtains the 1000 historical response times of the node B1 before the current interaction process, and then calculates the average response time of the 1000 historical response times to be 100 milliseconds, so the network timeout of the node B1 can be set to 100 milliseconds. Similarly, the same method can be used to set the corresponding network timeout for nodes B2 and B3.

[0099] It is understandable that other methods may also be used when the upstream service node sets the network timeout period based on the historical response time, such as selecting the maximum value in the historical response time as the network timeout period, or selecting the median value in the historical response time as the network timeout period, etc., as long as the network timeout period can be made close to the actual network environment of the downstream service node, and no specific limitation is made here.

[0100] 305 . Determine whether the waiting time of the second downstream service node is greater than the dynamic timeout time. If so, execute step 306 ; if not, execute steps 302 to 305 .

[0101] After obtaining the dynamic timeout duration, the upstream service node compares the waiting duration of the second downstream service node with the dynamic timeout duration to make a timeout judgment. If the waiting duration of the second downstream service node is greater than the dynamic timeout duration, it can be determined that the task request has timed out, and step 306 can be executed at this time to end the task request. If the waiting duration of the second downstream service node is not greater than the dynamic timeout duration, it can be determined that the task request has not timed out, and the dynamic timeout judgment can continue. At this time, the above steps 302 to 305 can be repeated until the task request is executed and ends, or the task request ends after the timeout.

[0102] 306. End the task request.

[0103] In order to ensure that the overall response time will not be affected by the network problems of the downstream service nodes and will not cause a long wait, the present application also sets an overall waiting time for the task request. Figure 4 As shown:

[0104] 401. Set the overall waiting time for the task request.

[0105] In this embodiment, the overall waiting time is used to indicate the maximum execution time of the task request. When the waiting time of any downstream service node exceeds the overall waiting time, the task request will be forcibly terminated regardless of the return status of each downstream service node.

[0106] Steps 402 to 405 are the same as steps 301 to 304 described above, and will not be described in detail here.

[0107] 406. Determine whether the waiting time of the second downstream service node is greater than the dynamic timeout time or whether the waiting time of the second downstream service node is greater than the overall waiting time. If so, execute step 407; if not, execute steps 402 to 406.

[0108] After obtaining the dynamic timeout duration, the upstream service node compares the waiting duration of the second downstream service node with the dynamic timeout duration and the overall waiting duration to make a timeout judgment. If the waiting duration of the second downstream service node is greater than the dynamic timeout duration or the overall waiting duration, it can be determined that the task request has timed out, and step 407 can be executed at this time to end the task request. If the waiting duration of the second downstream service node is not greater than the dynamic timeout duration and the overall waiting duration, it can be determined that the task request has not timed out, and the dynamic timeout judgment can continue. At this time, the above steps 402 to 406 can be repeated until the task request is executed and ends, or the task request ends after the timeout.

[0109] 407. End the task request.

[0110] In order to ensure the validity of the result of the task request and improve the response efficiency of the task request, the present application can also set a layer loss ratio for the arbitrary request to determine whether it is timed out. The specific implementation example can be as follows: Figure 5 As shown:

[0111] 501. Set the layer loss ratio for the task request.

[0112] In this embodiment, the layer loss ratio is used to indicate the ratio of the amount of data currently received to the total amount of data corresponding to the task request. In actual applications, in certain specific scenarios, it is not necessary to receive the entire amount of data requested for the task, and the task can be achieved by receiving partial data. For example, for a data retrieval scenario, the total amount of data that can be received from multiple servers according to the search keywords is 20 articles or videos, but the search interface can only display 10 articles or videos at a time, then only 10 articles or videos can be returned, and it can be determined that the search results are valid, and the layer loss ratio can be set to 50%.

[0113] Steps 502 to 505 are the same as the aforementioned steps 301 to 304 and will not be described again here.

[0114] 506. Obtain the amount of data currently received by the task request.

[0115] In this embodiment, the upstream service node receives the amount of data returned by each first downstream service node, and performs sum calculation to obtain the amount of data currently received by the task request.

[0116] As Figure 2a Taking the application scenario shown as an example, the node A receives the data returned by the node B1 and the node B2, and sums the two data to obtain the amount of data currently received by the task request sent by the node A. Assuming that the node B1 returns one-third of the data of the task request, and the node B2 returns one-third of the data of the task request, the task request currently receives two-thirds of the data.

[0117] 507 . Determine whether the waiting time of the second downstream service node is greater than the minimum waiting time and determine whether the currently received data volume satisfies the layer loss ratio. If so, execute step 408 ; if not, execute steps 502 to 507 .

[0118] The upstream service node compares the waiting time of the second downstream service node with the minimum waiting time, and compares the ratio of the currently received data volume to the total data corresponding to the task request with the layer loss ratio, so as to make a timeout judgment. If the waiting time of the second downstream service node is greater than the minimum waiting time, and the ratio of the currently received data volume to the total data corresponding to the task request is greater than or equal to the layer loss ratio, it can be judged that the result of the task request is valid, and the task request can be terminated in advance at this time. At this time, step 508 can be executed to terminate the task request. Otherwise, the dynamic timeout judgment can be continued, and the above steps 502 to 507 can be repeated until the result of the task request is valid.

[0119] 508. End the task request.

[0120] In order to ensure that the task request can improve the response efficiency, this application can also combine the dynamic recheck duration with the dynamic timeout duration. For details, please refer to Figure 6 The embodiment shown.

[0121] Steps 601 to 606 are the same as the aforementioned steps 301 to 306 and will not be repeated here.

[0122] 607. Determine a dynamic recheck duration of at least one second downstream service node according to the response duration.

[0123] After the upstream service node obtains the response time from the first downstream service node, if it is determined that there is a second downstream service node in the downstream service node that has not responded to the task request, the upstream service node determines the dynamic recheck time of the second downstream service node based on the response time of the first downstream service node and the minimum recheck time. In this embodiment, the minimum recheck time can be a static threshold set according to an empirical value.

[0124] In an exemplary scheme, the upstream service node takes the average of the response times to obtain the first average response time; obtains a second product value of the first average response time and a second waiting factor, where the second waiting factor is a set weight value and is smaller than the first waiting factor; takes the larger value of the second product value and the minimum recheck waiting time to obtain the dynamic timeout period, where the minimum recheck waiting time is a set static threshold.

[0125] As Figure 2a Taking the application scenario shown as an example, assuming that the response time of node A obtained by node A at the current moment is 4 milliseconds and 6 milliseconds respectively, and the minimum recheck time is set to 8 milliseconds according to the empirical value, and the first waiting factor is set to 2, then the dynamic recheck time of node B3 can be calculated as max(8, avg(4, 6)*2)=10.

[0126] It should be understood that there is no sequential relationship between step 607 and step 604 , and after obtaining the response duration, step 607 and step 604 may be executed simultaneously.

[0127] 608. When the waiting time of the second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time, send a recheck request to the second downstream service node.

[0128] In this embodiment, when the upstream service node determines that the second downstream service node has not timed out, the upstream service node determines whether the waiting time of the second downstream service node exceeds the dynamic recheck time. If so, the upstream service node and the second downstream service node send the recheck request.

[0129] It is understandable that after sending the recheck request, it is still necessary to record the waiting time of the second downstream service node and continue to perform the dynamic timeout judgment of the above steps 601 to 605.

[0130] It should be understood that the upstream server sending the recheck request to the second downstream service node means sending the recheck request to the backup node of the second downstream service node. Figure 2aIn the application scenario shown, when the requirements for sending a recheck request are met, the node A sends the recheck request to the backup node of the node B3 to avoid waiting for the node B3.

[0131] Optionally, in order to avoid avalanche of downstream service nodes, in this embodiment, the second downstream service node may also set a flow control mechanism for the recheck request. The specific implementation process may be as follows:

[0132] The upstream service node records the number of recheck statistics sent to the second downstream service node (i.e., the number of recheck statistics of the second downstream service node is updated every time a recheck request is sent, for example, the first time it is sent, the number of recheck statistics is recorded as 1, and the second time it is sent, the number of recheck statistics is recorded as 2). When the number of recheck statistics is greater than the threshold, the recheck request will not be sent to the second downstream service node even if the conditions for sending the recheck request are met.

[0133] Understandably, Figures 4 to 6 The solutions shown can be combined with each other, and the details will not be repeated here.

[0134] See also Figure 7 , taking the number of downstream service nodes as 1 and the upstream service node as the execution subject as an example, the task processing method in the embodiment of the present application is introduced, and one embodiment thereof includes:

[0135] 701. Obtain historical response data of the downstream service node, where the historical response data includes historical response duration of the downstream service node.

[0136] In this embodiment, the upstream service node can record the historical response data of the downstream service node and directly read the historical response data during the current interaction process. The historical response data can be the corresponding historical response data within the time window, such as the response data of the downstream service node in the 1000 task requests before the current interaction process; or the response data corresponding to the task request processed by the downstream service node within 4 minutes before the current interaction process, which is not limited here.

[0137] 702. Determine a network timeout duration of the downstream service node according to the historical response duration.

[0138] The upstream service node can average the historical response time of the downstream service node to obtain an average response time, and then use the average response time as the network timeout of the downstream service node. In an exemplary solution, assuming that node A obtains 1000 historical response times of node B before the current interaction process, and then averages the 1000 historical response times to obtain an average response time of 100 milliseconds, the network timeout of node B can be set to 100 milliseconds.

[0139] It is understandable that other methods may also be used when the upstream service node sets the network timeout period based on the historical response time, such as selecting the maximum value in the historical response time as the network timeout period, or selecting the median value in the historical response time as the network timeout period, etc., as long as the network timeout period can be made close to the actual network environment of the downstream service node, and no specific limitation is made here.

[0140] 703. Send a task request to a downstream service node.

[0141] In the case where each of the downstream service nodes is responsible for part of the data for the task request of the upstream service node, the upstream service node needs to send the task request to the downstream service node at the same time.

[0142] In an exemplary embodiment, Figure 2a In the application scenario shown, assuming that the node A is the upstream service node and the node B1 is the only downstream service node of the node A, the node A only needs to send a task request to the node B1 in each task. It is understandable that in different application scenarios, the task request can be of different types. For example, in the search scenario, the task request can be a request to the downstream service node to return data that matches the search keyword. In an exemplary scheme, the task request can include the search keyword "the method of braised pork in brown sauce", and the downstream service node can be a server corresponding to different platforms (such as "XX kitchen", the server corresponding to this application software) or a server corresponding to the public network. The data returned by each server can be related articles or videos published by registered users of different platforms, such as an article entitled "the home-cooked method of braised pork in brown sauce" published by registered user "A" in the application software "XX kitchen".

[0143] 704. Record the waiting time of the downstream service node for the task request.

[0144] After the upstream service node sends the task request to the downstream service node, a corresponding timer may be started for the downstream service node, and then the timer is used to record the waiting time of the downstream service node for the task request.

[0145] 705. When the waiting time of the downstream service node exceeds the network timeout time, the task request is terminated.

[0146] The upstream service node compares the waiting time of the downstream service node with the network timeout time. If the waiting time is greater than the network timeout time, it is determined that the task request has timed out, and the task request is terminated.

[0147] It is understandable that in this technical solution, the downstream service node can also use a recheck solution, but in this case the recheck duration is a set static threshold.

[0148] The task processing device in this application is described in detail below. Figure 8 , Figure 8 This is a schematic diagram of an embodiment of a task processing device in an embodiment of the present application. The task processing device 20 includes:

[0149] The sending module 201 is used to send a task request to N downstream service nodes, and record the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer;

[0150] An acquisition module 202 is used to acquire a response duration fed back by at least one first downstream service node when N is greater than or equal to 2, where the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout duration, and the first network timeout duration is determined according to historical response data of the first downstream service node;

[0151] The processing module 203 is used to determine the dynamic timeout duration of at least one second downstream service node according to the response duration, where the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout duration, and the second network timeout duration is determined based on the historical response data of the second downstream service node; when the waiting time of the second downstream service node is greater than the dynamic timeout duration, the task request is terminated.

[0152] In an embodiment of the present application, a task processing device is provided. The above device is used to dynamically set the network timeout duration using the historical response data of the service node. At the same time, when there are multiple service nodes, the dynamic timeout duration is determined using the real-time response duration of other service nodes in the current interaction process, so that the timeout threshold of the task request is more in line with the actual network environment, thereby ensuring the effectiveness and low latency of the task.

[0153] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0154] The processing module 203 is specifically used to average the response time to obtain a first average response time;

[0155] The first average response time is multiplied by a first waiting factor to obtain a first product value, where the first waiting factor is a set weight value;

[0156] The larger value of the first product value and the minimum waiting time is used to obtain the dynamic timeout time, and the minimum waiting time is the set static threshold.

[0157] In an embodiment of the present application, a task processing device is provided. With the above device, since the service nodes corresponding to the same task request are service nodes with the same processing logic, the dynamic timeout duration of the service node that has not responded can be determined by referring to the response duration of other service nodes that have not timed out, so that the timeout threshold of the task request is more in line with the real-time network environment, thereby avoiding the waiting time of the task request being too long, and realizing the function of reducing the delay of the task request.

[0158] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application, the processing module 203 is further used to determine the dynamic recheck duration of the second downstream service node according to the response duration;

[0159] The sending module 201 is further configured to send a recheck request to the second downstream service point when the waiting time of the second downstream service point is less than the dynamic timeout time and greater than the dynamic recheck time.

[0160] In an embodiment of the present application, a task processing device is provided. By using the above device, the dynamic timeout duration is combined with the dynamic recheck duration, thereby achieving long-tail control of task requests and reducing the response time of task requests.

[0161] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0162] The processing module 203 is used to average the response time to obtain the first average response time;

[0163] Obtaining a second product value of the first average response time and a second waiting factor, where the second waiting factor is a set weight value and the second waiting factor is less than the first waiting factor;

[0164] The larger value of the second product value and the minimum recheck waiting time is used to obtain the dynamic timeout time, and the minimum recheck waiting time is the set static threshold.

[0165] In an embodiment of the present application, a task processing device is provided. With the above device, since the service nodes corresponding to the same task request are service nodes with the same processing logic, the dynamic recheck duration of the service nodes that have not responded can be determined by referring to the response duration of other service nodes that have not timed out, so that a more reasonable recheck duration can be obtained for different network environments, thereby improving the recheck efficiency.

[0166] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0167] The processing module 203 is used to update the recheck statistics of the second downstream service node.

[0168] In an embodiment of the present application, a task processing device is provided. The above device is used to count the number of rechecks of downstream service nodes, and the number of rechecks of downstream service nodes is controlled according to the statistical number of rechecks, thereby avoiding avalanches of downstream service nodes.

[0169] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application, the processing module 203 is further used to determine the dynamic recheck duration of the second downstream service node according to the response duration;

[0170] Obtain the number of recheck statistics of the second downstream service node;

[0171] The sending module 201 is further configured to send a recheck request to the second downstream service point when the waiting time of the second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time, and the recheck statistical number is less than a first threshold.

[0172] In an embodiment of the present application, a task processing device is provided. The above device is used to combine the dynamic timeout duration with the dynamic recheck duration, thereby achieving long-tail control of task requests and reducing the response time of task requests. At the same time, a recheck flow control mechanism is added to avoid avalanches in downstream service nodes.

[0173] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application, the processing module 203 is further used to update the historical response data of the first downstream service node according to the response duration.

[0174] In an embodiment of the present application, a task processing device is provided. The above device is used to save the response data of each service node and adjust the timeout threshold in the next interaction process as historical response data, which can effectively ensure that the network timeout duration can meet the actual network environment.

[0175] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0176] The acquisition module 202 is further used to acquire a response status of the first downstream service node, where the response status is used to indicate whether the first downstream service node succeeds or fails in feeding back data;

[0177] The processing module 203 is further used to determine the amount of data currently received by the task request according to the response status;

[0178] When the waiting time of the second downstream service node is greater than the minimum waiting time and the data volume meets the layer loss ratio, the task request is terminated. The layer loss ratio is used to indicate the ratio of the currently received data volume to the complete data volume corresponding to the task request.

[0179] In an embodiment of the present application, a task processing device is provided. The above device is used to determine whether the task request has timed out according to the minimum waiting time and the layer loss ratio, and terminate the task request when the minimum waiting time is exceeded and the layer loss ratio is met, so that the response efficiency of the task request can be improved while ensuring the validity of the result, thereby better controlling the long-tail impact of the task.

[0180] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0181] The processing module 203 is further used to set an overall waiting time for the task request during the current interaction process.

[0182] In an embodiment of the present application, a task processing device is provided. By using the above device, the overall waiting time of the task request is set to ensure that the overall response time will not be delayed by a long wait due to network problems.

[0183] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0184] The processing module 203 is configured to terminate the task request when the waiting time of the second downstream service node is greater than the dynamic timeout time or greater than the overall waiting time.

[0185] In an embodiment of the present application, a task processing device is provided. By using the above device, the task request is timed out based on the dynamic timeout duration and the overall waiting duration, so as to ensure that the overall response time will not be delayed for a long time due to network problems.

[0186] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0187] The acquisition module 202 is used to acquire the historical response data of the first downstream service node and the historical response data of the second downstream service node, wherein the historical response data of the first downstream service node includes the historical response duration of the first downstream service node, and the historical response data of the second downstream service node includes the historical response duration of the second downstream service node;

[0188] Processing module 203, used for averaging the historical response time of the first downstream service node to obtain a second average response time, and averaging the historical response time of the second downstream service node to obtain a third average response time;

[0189] Setting the second average response duration as a first network timeout duration of the first downstream service node in the current interaction process;

[0190] The third average response duration is set as a second network timeout duration of the second downstream service node in the current interaction process.

[0191] In an embodiment of the present application, a task processing device is provided. The above device is used to use the historical response data of each service node to respectively determine the network timeout duration of each service node, so that the timeout threshold of each service node is more consistent with the actual network, thereby avoiding the situation where each service node waits for a long time or the waiting time is insufficient.

[0192] Optionally, in the above Figure 8 On the basis of the corresponding embodiment, in another embodiment of the task processing device 20 provided in the embodiment of the present application,

[0193] The acquisition module 202 is used to acquire historical response data of the downstream service node when N is equal to 1, and the historical response data includes the historical response duration of the downstream service node;

[0194] The processing module 203 is used to average the historical response time to obtain a third average response time;

[0195] Setting the third average response duration as a third network timeout duration of the downstream service node in the current interaction process;

[0196] When the waiting time of the downstream service node exceeds the third network timeout time, the task request is terminated.

[0197] In an embodiment of the present application, a task processing device is provided. With the above device, when there is no other reference service node, the network timeout duration can be dynamically adjusted according to the historical response data of the service node itself, so as to be more in line with the actual network environment and ensure the validity and low latency of the task request.

[0198] The task processing device provided in this application can be used for a server, see Fig. 9 , Fig. 9 : is a schematic diagram of a server structure provided in an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.

[0199] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2000. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0200] The steps performed by the server in the above embodiment can be based on the Fig. 9 The server structure shown.

[0201] The task processing device provided in this application can be used in terminal equipment, see Fig.10 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. In the embodiments of the present application, the terminal device is a smart phone as an example for explanation:

[0202] Fig.10 The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Fig.10The smart phone includes: a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will appreciate that Fig.10 The structure of the smartphone shown in the figure does not constitute a limitation of the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0203] Combine the following Fig.10 A detailed introduction to the various components of a smartphone:

[0204] The RF circuit 410 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 480 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.

[0205] The memory 420 can be used to store software programs and modules. The processor 480 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, a phone book, etc.), etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0206] The input unit 430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smart phone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 431 or near the touch panel 431 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 480, and can receive and execute commands sent by the processor 480. In addition, the touch panel 431 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 431, the input unit 430 may also include other input devices 432. Specifically, other input devices 432 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.

[0207] The display unit 440 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 440 may include a display panel 441. Optionally, the display panel 441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides a corresponding visual output on the display panel 441 according to the type of touch event. Although in Fig.10 In the embodiment, the touch panel 431 and the display panel 441 are used as two independent components to implement the input and output functions of the smartphone, but in some embodiments, the touch panel 431 and the display panel 441 can be integrated to implement the input and output functions of the smartphone.

[0208] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in smartphones, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0209] The audio circuit 460, the speaker 461, and the microphone 462 can provide an audio interface between the user and the smartphone. The audio circuit 460 can transmit the received audio data to the speaker 461 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 462 converts the collected sound signal into an electrical signal, which is received by the audio circuit 460 and converted into audio data, and then the audio data is output to the processor 480 for processing, and then sent to another smartphone through the RF circuit 410, or the audio data is output to the memory 420 for further processing.

[0210] WiFi is a short-range wireless transmission technology. Smartphones can help users send and receive emails, browse web pages, and access streaming media through WiFi module 470, which provides users with wireless broadband Internet access. Fig.10 A WiFi module 470 is shown, but it is understandable that it is not an essential component of the smartphone and can be omitted as needed without changing the essence of the invention.

[0211] Processor 480 is the control center of the smartphone, which uses various interfaces and lines to connect various parts of the entire smartphone, and executes various functions of the smartphone and processes data by running or executing software programs and / or modules stored in memory 420, and calling data stored in memory 420, so as to monitor the smartphone as a whole. Optionally, processor 480 may include one or more processing units; optionally, processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into processor 480.

[0212] The smart phone also includes a power source 490 (such as a battery) for supplying power to various components. Optionally, the power source can be logically connected to the processor 480 through a power management system, thereby managing functions such as charging, discharging, and power consumption management through the power management system.

[0213] Although not shown, the smartphone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0214] The steps performed by the terminal device in the above embodiment can be based on the Fig.10 The terminal device structure shown.

[0215] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.

[0216] The present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.

[0217] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0218] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. There may be other division methods in actual implementation, such as multiple units 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0219] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0220] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0221] If the integrated unit 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 application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0222] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A task processing method, characterized in that: include: Sending a task request to N downstream service nodes, and recording the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer; When N is greater than or equal to 2, obtaining a response duration fed back by at least one first downstream service node, where the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout duration, and the first network timeout duration is determined according to historical response data of the first downstream service node; Determine a dynamic timeout duration of at least one second downstream service node according to the response duration, the at least one second downstream service node being included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout duration, and the second network timeout duration is determined according to historical response data of the second downstream service node; When the waiting time of the second downstream service node is greater than the dynamic timeout time, the task request is terminated.

2. The method according to claim 1, characterized in that The determining of the dynamic timeout duration of at least one second downstream service node according to the response duration includes: Taking the average of the response time lengths to obtain a first average response time length; Multiplying the first average response time by a first waiting factor to obtain a first product value, where the first waiting factor is a set weight value; The larger value of the first product value and the minimum waiting time is taken to obtain the dynamic timeout time, and the minimum waiting time is the set static threshold.

3. The method according to claim 2, characterized in that After obtaining the response duration fed back by at least one first downstream service node, the method further includes: Determining a dynamic recheck duration of the at least one second downstream service node according to the response duration; When the waiting time of the at least one second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time, a recheck request is sent to the at least one second downstream service node.

4. The method according to claim 3, characterized in that Determining the dynamic recheck duration of the at least one second downstream service node according to the response duration includes: Taking the average of the response times to obtain the first average response time; Obtaining a second product value of the first average response time and a second waiting factor, where the second waiting factor is a set weight value, and the second waiting factor is less than the first waiting factor; The larger value of the second product value and the minimum recheck waiting time is taken to obtain the dynamic timeout time, and the minimum recheck waiting time is the set static threshold.

5. The method according to claim 3, characterized in that: After sending the recheck request to the at least one second downstream service point, the method further includes: The recheck statistics of the at least one second downstream service node are updated.

6. The method according to claim 2, characterized in that After obtaining the response duration fed back by at least one first downstream service node, the method further includes: Determining a dynamic recheck duration of the at least one second downstream service node according to the response duration; Obtaining a statistical number of rechecks of the at least one second downstream service node; When the waiting time of the at least one second downstream service node is less than the dynamic timeout time and greater than the dynamic recheck time, and the recheck statistical number is less than a first threshold, a recheck request is sent to the at least one second downstream service point.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: The historical response data of the at least one first downstream service node is updated according to the response duration.

8. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Obtain the amount of data currently received by the task request; When the waiting time of at least one second downstream service node is greater than the minimum waiting time and the data volume meets the layer loss ratio, the task request is terminated. The layer loss ratio is used to indicate the ratio of the currently received data volume to the complete data volume corresponding to the task request. The minimum waiting time is a set static threshold.

9. The method according to any one of claims 1 to 6, characterized in that The method further comprises: In the current interaction process, an overall waiting time is set for the task request.

10. The method according to claim 9, characterized in that After determining the dynamic timeout duration of at least one second downstream service node according to the response duration, the method further includes: When the waiting time of the at least one second downstream service node is greater than the dynamic timeout time or greater than the overall waiting time, the task request is terminated.

11. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Acquire historical response data of the first downstream service node and historical response data of the second downstream service node, wherein the historical response data of the first downstream service node includes a historical response duration of the first downstream service node, and the historical response data of the second downstream service node includes a historical response duration of the second downstream service node; The historical response times of the first downstream service node are averaged to obtain a second average response time, and the historical response times of the second downstream service node are averaged to obtain a third average response time; Setting the second average response duration as a first network timeout duration of the first downstream service node in the current interaction process; The third average response duration is set as a second network timeout duration of the second downstream service node in the current interaction process.

12. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When N is equal to 1, acquiring historical response data of the downstream service node, the historical response data including the historical response duration of the downstream service node; averaging the historical response times to obtain a third average response time; Setting the third average response duration as a third network timeout duration of the downstream service node in the current interaction process; When the waiting time of the downstream service node exceeds the third network timeout time, the task request is terminated.

13. A task processing device, characterized in that: include: A sending module, used to send a task request to N downstream service nodes, and record the waiting time of each downstream service node in the N downstream service nodes for the task request, where N is a positive integer; an acquisition module, configured to acquire, when N is greater than or equal to 2, a response duration fed back by at least one first downstream service node, wherein the at least one first downstream service node is included in the N downstream service nodes, wherein the first downstream service node is a node that responds to the task request within a first network timeout duration, and the first network timeout duration is determined according to historical response data of the first downstream service node; A processing module is used to determine a dynamic timeout duration of at least one second downstream service node according to the response duration, wherein the at least one second downstream service node is included in the N downstream service nodes, wherein the second downstream service node is a node that does not respond to the task request within a second network timeout duration, and the second network timeout duration is determined based on historical response data of the second downstream service node; when the waiting time of the second downstream service node is greater than the dynamic timeout duration, the task request is terminated.

14. A computer device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, and the processor is used to execute the method according to any one of claims 1 to 12 according to the instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

15. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 12.

Citation Information

Cited By

  • Automatic script execution method and system, server, medium and program product

    CN120353543A

  • Automatic script execution method, system, server, medium and program product

    CN120353543B