Request processing method and apparatus
By analyzing the request statistics and load information of the service node on the client side to determine whether to delay sending the request, the problem of service node overload in the distributed storage system is solved, and the stability and efficient response of the node are achieved.
Patent Information
- Application Number
- PCT/CN2024/074784
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-24
- Filing Date
- 2024-01-30
- Publication Date
- 2024-08-29
AI Technical Summary
In a distributed storage system, storage service nodes are overloaded due to excessive processing pressure, which may result in unresponsiveness or crash, and the inability to provide normal services. How to reduce the processing volume to ensure node stability is an urgent problem that needs to be solved.
On the client side, by receiving and analyzing the request statistics and load information of the target service node, it determines whether the request to be sent meets the delay sending conditions, determines the delay strategy based on the conditions, and delays sending the request according to the strategy to avoid overloading the service node.
It effectively reduces the load pressure on the service node, ensures the working stability of the node, enables it to respond to requests more effectively, and improves processing efficiency.
Smart Images

Figure CN2024074784_29082024_PF_FP_ABST
Abstract
Description
Request processing method and device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 24, 2023, with application number 202310199489.9 and application name “Request Processing Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of this specification relate to the technical field of distributed storage systems, and more particularly to a request processing method. One or more embodiments of this specification also relate to a request processing apparatus, a computing device, and a computer-readable storage medium. Background Art
[0003] With the rapid development of internet technology, distributed storage systems are widely used. The process for accessing a distributed storage system involves the client sending a request to a server, which receives and processes the request and returns a response to the client. Because distributed storage systems employ a typical client-server model, with storage and compute separated, services from multiple compute clusters often access a single storage cluster. This can cause storage service nodes to become overloaded due to processing pressure, resulting in unresponsiveness or crashes, making it impossible to provide normal client services. Therefore, reducing the processing load of storage service nodes and ensuring their operational stability is a pressing issue.
[0004] Summary of the Invention
[0005] In view of this, embodiments of this specification provide a request processing method. One or more embodiments of this specification also relate to a request processing apparatus, a request processing system, a computing device, a computer-readable storage medium, and a computer program to address technical deficiencies in the prior art.
[0006] According to a first aspect of an embodiment of this specification, a request processing method is provided, which is applied to a target client and includes:
[0007] Receive a request to be sent to a target service node;
[0008] Determine request statistics and load information corresponding to the target service node;
[0009] In a case where it is determined according to the request statistical information and the load information that the request to be sent meets the delayed sending condition, determining a delay strategy corresponding to the request to be sent;
[0010] The to-be-sent request is sent to the target service node according to the delay strategy.
[0011] According to a second aspect of an embodiment of this specification, a request processing device is provided, applied to a target client, including:
[0012] A receiving device configured to receive a request to be sent to a target service node;
[0013] A first determining device is configured to determine request statistical information and load information corresponding to the target service node;
[0014] a second determining means, configured to, when it is determined based on the request statistical information and the load information that the request to be sent meets a delayed sending condition, determine a delay strategy corresponding to the request to be sent;
[0015] The sending device is configured to send the to-be-sent request to the target service node according to the delay strategy.
[0016] According to a third aspect of an embodiment of this specification, a request processing system is provided, the system including a service node and a client;
[0017] The client is used to store a request-sending executable instruction; when the request-sending executable instruction is executed by the client, any one of the steps of the request processing method is implemented, and is used for the client to interact with the service node.
[0018] According to a fourth aspect of the embodiments of this specification, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the request processing method when executing the computer instructions.
[0019] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer instructions, and when the computer instructions are executed by a processor, the steps of the request processing method are implemented.
[0020] According to a sixth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned request processing method.
[0021] The request processing method provided in this specification is applied to a client, and includes receiving a request to be sent for a target service node; determining request statistical information and load information corresponding to the target service node; when it is determined that the request to be sent meets a delayed sending condition based on the request statistical information and the load information, determining a delay strategy corresponding to the request to be sent; and sending the request to be sent to the target service node according to the delay strategy.
[0022] One embodiment of this specification implements a method whereby a client determines whether a pending request meets a delay condition by determining request statistics and load information corresponding to a target service node. If the pending request meets the delay condition, a corresponding delay policy is determined, and the pending request is sent to the target service node in accordance with the delay policy. This method enables the client to proactively delay sending requests to the service node, preventing overloaded access to the service node, ensuring the stability of the service node, and enabling the service node to more effectively respond to valid requests, thereby improving the service node's operational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] FIG1 is a schematic diagram of a request processing method provided by an embodiment of this specification;
[0024] FIG2 is a flowchart of a request processing method provided by one embodiment of this specification;
[0025] FIG3 is a flowchart of a request processing method provided by an embodiment of this specification;
[0026] FIG4 is a schematic diagram of the structure of a request processing device provided by an embodiment of this specification;
[0027] FIG5 is a structural block diagram of a computing device provided by one embodiment of this specification. DETAILED DESCRIPTION
[0028] The following description sets forth many specific details to facilitate a thorough understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0029] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a," "the," and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to any or all possible combinations of one or more associated listed items.
[0030] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0031] First, the terms involved in one or more embodiments of this specification are explained.
[0032] RPC: Remote Procedure Call, which corresponds to our local call. Remote actually refers to the need for network communication, which can be understood as calling methods on a remote machine.
[0033] Storage and computing separation: This is a distributed architecture concept that pools computing and storage resources through independent computing clusters and storage clusters. The benefit is that it fully utilizes various resources to achieve elastic expansion of computing and storage, which is more flexible and more in line with the characteristics of cloud computing.
[0034] In a storage-computing separation architecture, common strategies to prevent server overload include:
[0035] Providing degraded results: After receiving a failed request response, the client will enter a degraded process, such as no longer accessing data or sending the request to other data sources for data access. However, it is usually difficult for storage services to degrade services.
[0036] Actively reject requests when the service node is overloaded: The server will actively reject requests sent by the client when it is overloaded. This is a relatively common overload design. However, in extreme scenarios, such as when a large number of clients send high-frequency requests, the overload judgment and active rejection of the service node will also consume a large amount of processing resources such as the service node's processor, memory, and network resources, affecting the service node's normal service capabilities and recovery speed.
[0037] Resending requests: Perform exponential backoff retries after a client timeout or failure. This method can quickly reduce the load on service nodes, but it requires changes to the client business code and correctness assurance. Many business layers lack a complete and correct retry strategy, which also increases the burden on business usage.
[0038] Client-side request quota setting: Setting a client request QPS quota has the disadvantage that it is difficult for the business layer to estimate the data value, and it is not flexible and inconvenient in actual application.
[0039] Based on this, this specification provides a request processing method for determining whether the request to be sent meets the delayed sending condition by determining the request statistics and load information corresponding to the target service node on the client side. If the request to be sent meets the delayed sending condition, the delay strategy corresponding to the request to be sent is determined, and the request to be sent is sent to the target service node according to the delay strategy. The client actively delays sending requests to the service node to avoid overloaded access to the service node, ensures the working stability of the service node, enables the service node to respond to valid requests more effectively, and improves the working efficiency of the service node. Anti-overload access to the service node is implemented on the client side, reducing the load pressure of the service node and improving the processing efficiency of the service node. This specification also involves a request processing device, a request processing system, a computing device, a computer-readable storage medium and a computer program, which are described in detail one by one in the following embodiments.
[0040] FIG1 is a schematic diagram of the structure of a request processing method provided according to an embodiment of the present specification. FIG1 includes a storage-computing separation architecture, which includes multiple clients, i.e., computing nodes, and multiple storage clusters, i.e., service nodes. Clients can access service nodes through SDK. When multiple clients access the same service node at the same time, such as multiple clients accessing service node 2 at the same time in FIG1 , due to the limited processing capacity of service node 2, the default overload protection mechanism of service node 2 will discard requests whose number of pending requests exceeds the preset processing threshold and return a message of failed response to the corresponding client. However, in order to process requests faster, the client will set a very short cyclic retry time and send the failed response request again to the service node, causing the service node to spend resources to process invalid requests, affecting the processing of other normal services on the service node. A request processing method provided by an embodiment of this specification, when a client is about to send an access request to a service node, determines the request statistics and load information corresponding to the service node, determines whether the access request needs to be delayed based on the request statistics and load information, and sends the request according to the corresponding delay strategy when the access request meets the delayed sending conditions, thereby alleviating the load pressure of the service node, enabling the service node to handle other services normally, while also ensuring that the access request can be processed by the service node as soon as possible, improving the efficiency of client request processing, and providing users with a better user experience. The request processing method provided by this specification implements the client side to determine the request statistics and load information corresponding to the target service node, determine whether the request to be sent meets the delayed sending conditions, and when the request to be sent meets the delayed sending conditions, determine the delay strategy corresponding to the request to be sent, and send the request to be sent to the target service node according to the delay strategy. The client actively delays sending requests to the service node, avoids overloaded access to the service node, ensures the working stability of the service node, enables the service node to respond to valid requests more effectively, and improves the working efficiency of the service node.
[0041] FIG2 shows a flowchart of a request processing method provided according to an embodiment of this specification. The method is applied to a target client and includes steps 202 to 208 .
[0042] Step 202: Receive a request to be sent to a target service node.
[0043] Among them, the pending request for the target service node can be understood as a request that needs to be sent to the target service node. The pending request can be a request for the client to access the resources stored on the target service node. For example, if an application on the client needs to call the resources on the target service node, a resource call request will be sent to the target service node based on the client. The resource call request is the pending request.
[0044] In actual applications, in a storage-computing separation architecture, when the client sends a request to be sent to the target service node, the target service node will accept the request and start processing it. After the request processing is completed, the response information corresponding to the request will be returned to the client. The client will send the returned response information to the project application corresponding to the request.
[0045] In a specific embodiment of the present specification, the client receives a resource download request from a project application for a target service node, takes the resource download request as a to-be-sent request, and subsequently sends the to-be-sent request to the corresponding target service node.
[0046] Step 204: Determine the request statistics and load information corresponding to the target service node.
[0047] Among them, the request statistics include information such as the number of requests sent, the number of request failures, and the number of successful requests. Since the client needs to send the pending requests to the target service node, it only needs to determine the request statistics corresponding to the target service node. The request statistics can be the number of times the client sends requests to the target service node within a preset period and the number of successful or failed responses from the target service node. The load information can be understood as the target service node's recent processing request QPS and queue depth QD. The processing request QPS is the number of successful responses to processing requests within the service node period (default 1 second), and the queue depth QD is the number of pending requests in the service node's current request queue.
[0048] In actual applications, the client side records the request statistics and load information corresponding to each service node and updates these statistics and load information in real time, thereby achieving the timeliness of delayed request transmission. After the client determines that it needs to send the pending request to the target service node, it determines the request statistics and load information corresponding to the target service node. Subsequently, based on the request statistics and load information, it can determine whether the current pending request needs to be delayed, thereby reducing the load pressure on the target service node, avoiding overload conditions on the target service node, and ensuring the stability of the target service node.
[0049] In a specific embodiment of this specification, a client determines request statistics and load information corresponding to a target service node. The request statistics include that the client sent 10 requests to the target service node within one minute, of which 7 were successful and 3 failed. The load information includes that the target service node's request processing speed is 5 and the queue depth (QD) is 10.
[0050] Furthermore, in order to avoid the subsequent overload of the target service node due to incorrect judgment of delayed requests to be sent due to abnormal request statistical information, it is necessary to ensure the correctness of the request statistical information, and specifically determine the request statistical information corresponding to the target service node, including: determining the historical sending requests within a preset time period for the target service node, and the historical response information corresponding to the historical sending requests; determining the request statistical information corresponding to the target service node based on the historical sending requests and the historical response information.
[0051] Among them, the preset time period can be understood as a pre-set statistical period for the number of requests sent by the client to the target service node, and the preset time period can be set according to actual conditions. For example, if the number of requests sent by the client to the target service node in the last 1 minute is counted, the historical response information can be understood as the number of successful requests and / or the number of failed requests in the requests sent by the client to the target service node within the preset time period. Because the processing capacity of the target service node is limited, when there are too many pending requests in the queue of the target service node, the overload protection mechanism of the target service node will be triggered, and the target service node will directly return a failure response message to the request just received. At this time, the client will count the number of request failures once.
[0052] In actual applications, based on historical request sending and historical response information, the number of requests sent by the client to the target service node within a preset period and the response information corresponding to each request, that is, whether each request is successful, can be determined. By counting historical request sending and historical response information, the request statistics corresponding to the target service node can be determined.
[0053] In a specific embodiment of the present specification, the client determines historical requests sent to the target service node within a preset time period, and historical response information corresponding to each historical request, and determines request statistics corresponding to the target service node based on the historical requests and historical response information.
[0054] Based on this, the client can determine the historical sending requests and historical response information of the target service node, and accurately count the request statistics corresponding to the target service node, so as to facilitate the subsequent judgment of whether the request to be sent needs to be delayed based on the request statistics.
[0055] Furthermore, in order to avoid overload of the target service node, it is necessary to enable the client to clearly understand the load status of the target service node, and the load status of the target service node can be returned to the client by the target service node through request response information. Specifically determining the load information corresponding to the target service node includes: receiving historical reply information of the target service node for the historical request sent; and determining the load information corresponding to the target service node based on the historical reply information.
[0056] Among them, the historical sending request is the request that the client previously sent to the target service node. The historical reply information can be understood as the response information returned by the target service node to the client for the historical sending request. The historical reply information can be a successful response information or a failed response information. The target service node will add load information to the historical reply information, so the client can determine the corresponding load information of the target service node from the historical reply information.
[0057] In actual applications, the service node automatically adds the load information QPS and QD to the reply information when returning the RPC Response, so that the client can obtain the current load information of the service node from the reply information when receiving the reply information.
[0058] In a specific embodiment of the present specification, the client receives historical reply information returned by the target service node in response to historical transmission requests, and determines the load information corresponding to the target service node based on the load information carried in the historical reply information.
[0059] Based on this, the client can obtain the load information of the service node from the historical response information returned by the service node, so as to have a clearer understanding of the current load situation of the service node, and facilitate the subsequent accurate judgment of whether the request to be sent needs to be delayed.
[0060] Furthermore, in order to avoid overload of the target service node, it is necessary to enable the client to clearly understand the load status of the target service node. The heartbeat server can also monitor the load status of the service node, and the heartbeat service can send the load information to the client. Specifically determining the load information corresponding to the target service node includes: receiving the heartbeat information sent by the heartbeat server to the target service node, wherein the heartbeat server is used to monitor the load information corresponding to each service node; and determining the load information corresponding to the target service node based on the heartbeat information.
[0061] Among them, the heartbeat server can be understood as a server that manages service nodes. The heartbeat server can periodically collect load information of all service nodes and use the heartbeat service to regularly send the collected load information to all clients so that the clients can obtain the load information of each service node.
[0062] In actual applications, the service node can periodically aggregate load information to the heartbeat server. After receiving the load information sent by the service node, the heartbeat server will generate heartbeat information based on the load information and send the heartbeat information to the client. After receiving the heartbeat information, the client can obtain the load information corresponding to the target service node from the heartbeat information. In specific implementation, in order to avoid the heartbeat server sending too much heartbeat information data, the client can also send a load information acquisition request to the heartbeat server. After receiving the load information acquisition request, the heartbeat server returns the load information of the corresponding target service node to the client according to the request, thereby reducing the amount of heartbeat information data that needs to be sent and improving processing efficiency.
[0063] In a specific embodiment of the present specification, the client receives heartbeat information for a target service node sent by a heartbeat server. After receiving the heartbeat information, the client determines the load information corresponding to the target service node based on the load information carried in the heartbeat information.
[0064] Based on this, the client can obtain the load information of the service node from the heartbeat information returned by the heartbeat server, so as to more clearly understand the current load situation of the service node and facilitate subsequent accurate judgment on whether the request to be sent needs to be delayed.
[0065] Step 206: When it is determined according to the request statistics information and the load information that the request to be sent meets the delayed sending condition, a delay strategy corresponding to the request to be sent is determined.
[0066] Among them, the delay satisfaction condition can be understood as the judgment condition for determining whether the request needs to be delayed. According to the request statistical information and load information, it can be judged whether the request to be sent meets the delayed sending condition. If the delayed sending condition is met, the delay strategy corresponding to the request to be sent is determined. If the delayed sending condition is not met, the request to be sent is directly sent to the target service node.
[0067] In practical applications, if it is determined based on request statistics and load information that a pending request satisfies a delayed sending condition, a delay policy corresponding to the pending request can be determined. The delay policy can be a time delay policy or a priority degradation policy. The time delay policy can include a delay period before the client sends the request. The priority delay policy can include lowering the priority of the pending request and processing requests corresponding to other service nodes first, i.e., sending the other requests to other service nodes. The delay policy can also be other methods for delaying the sending of requests, which are not specifically limited in this application.
[0068] In a specific embodiment of the present specification, after determining the request statistical information and load information, the client determines whether the request to be sent meets the delayed sending condition based on the request statistical information and load information, and determines the delay strategy corresponding to the request to be sent if the request to be sent meets the delayed sending condition.
[0069] Based on this, by combining the request statistics on the client side and the load information on the service node side, a judgment is made as to whether the request to be sent needs to be sent, so that the client can participate in the judgment and active action of overload defense. Through the mutual cooperation between the client and the service node, the client actively refuses or delays sending requests, helping the service node to better complete overload protection and quick response.
[0070] Furthermore, since the request statistical information includes historical sending requests and historical response information, in order to avoid the client from incorrectly judging the sending strategy of the request to be sent, a preset delay threshold can be determined based on the load information and compared with the request statistical information, so as to more accurately determine whether the request to be sent needs to be delayed. Specifically, when it is determined according to the request statistical information and the load information that the request to be sent meets the delayed sending condition, the delay strategy corresponding to the request to be sent is determined, including: calculating the historical request failure rate of the target service node within the preset period based on the historical request number of the historical sending requests and the historical failure number of the historical response information; calculating the preset delay threshold corresponding to the request to be sent based on the load information, wherein the preset delay threshold includes the preset request number and the preset request failure rate; when the historical request number is greater than the preset request number and the historical request failure rate is greater than the preset request failure rate, it is determined that the request to be sent meets the delayed sending condition, and the step of determining the delay strategy corresponding to the request to be sent is continued.
[0071] The historical request count can be understood as the number of requests or requests sent historically. For example, if a client sent 10 requests to the target service node within the past minute, the historical request count is 10. The historical failure count can be understood as the number of failed requests in historical response information. Historical response information may include request failure information, so the request failure count can be determined. For example, if the historical response information includes 5 successful requests and 5 failed requests, the historical failure count is 5. Based on the historical request count and the historical failure count, the historical request failure rate of the target service node within a preset period can be calculated. The preset period is the same as the preset period for statistical calculations of historical request sending. The historical request failure rate can be understood as the probability that a client sends a request to the target service node within the preset period and the response fails. For example, if a client sends 10 requests to the target service node within 1 minute and 5 of them fail to respond, the historical request failure rate is 0.5. The preset delay threshold can be understood as a threshold for determining whether a request needs to be delayed. The preset delay threshold includes the preset request count and the preset request failure rate. The preset delay threshold can serve as a warning threshold for target service node overload. During specific implementation, the preset delay threshold can be calculated based on the load information of the service node. For example, the larger the value of QPS plus QD of the service node, the more busy the current service node is. In this case, the preset delay threshold can be appropriately adjusted to suppress request sending more quickly. It should be noted that the calculation method of the preset number of requests and the preset request failure rate in the preset delay threshold can be determined based on actual conditions. It only needs to ensure that the size of the preset number of requests and the preset request failure rate are correlated with the load information. This application does not impose any specific restrictions on the calculation method of the preset number of requests and the preset request failure rate.
[0072] In actual applications, when the number of historical requests is greater than the preset number of requests and the historical request failure rate is greater than the preset request failure rate, it means that the target service node is overloaded and the request to be sent needs to be delayed.
[0073] In a specific embodiment of the present specification, the client determines that the number of historical requests is 10 based on historical sending requests, and determines that the number of historical failures is 6 based on historical response information. Then, the historical failure rate is calculated to be 0.6 based on the number of historical requests and the number of historical failures. The preset number of requests is calculated to be 5 and the preset request failure rate is 0.5 based on the load information. The number of historical requests is compared with the preset number of requests, as well as the historical request failure rate and the preset request failure rate. It is determined that the historical request data is greater than the preset number of requests and the historical request failure rate is greater than the preset request failure rate. Then, it is determined that the request to be sent at this time meets the delayed sending condition, and the delay strategy corresponding to the request to be sent is continued to be executed. Subsequently, the request to be sent is delayed according to the delay strategy.
[0074] In summary, by determining the number of historical requests and the historical request failure rate based on request statistics, and calculating the preset number of requests and the preset request failure rate based on load information, the client and the service node cooperate with each other, and compare the number of historical requests with the preset number of requests, and the historical request failure rate with the preset request failure rate, accurately judge whether the request to be sent meets the delayed sending request, thereby avoiding the service node from entering an overload state and ensuring that the service node can work normally.
[0075] Step 208: Send the to-be-sent request to the target service node according to the delay strategy.
[0076] In the case where it is determined that the request to be sent needs to be delayed, the request to be sent needs to be sent to the target service node according to the determined delay strategy.
[0077] In actual applications, if the client determines that the target service node is currently busy, all subsequent requests sent by the client to the target service node within a period of time will be sent according to the delay strategy, thereby avoiding overload of the service node and ensuring the stability of the service node.
[0078] In a specific embodiment of the present specification, the client sends the request to be sent to the target service node according to the determined delay strategy.
[0079] Based on this, the client determines whether the pending request meets the conditions for delayed sending by determining the request statistics and load information corresponding to the target service node. If the pending request meets the conditions for delayed sending, a corresponding delay policy is determined and the pending request is sent to the target service node according to the delay policy. This enables the client to proactively delay sending requests to the service node, preventing the service node from being overloaded, ensuring the stability of the service node, and enabling the service node to more effectively respond to valid requests, thereby improving the service node's work efficiency.
[0080] Furthermore, in order to avoid the client sending the request to be sent to the target service node, causing the target service node to be overloaded and the client to be unable to normally obtain the processing result corresponding to the request, the request to be sent can be delayed based on the delay strategy. Specifically, when the delay strategy is a time delay strategy, the request to be sent is sent to the target service node according to the delay strategy, including: determining the historical request failure rate based on the time delay strategy, and calculating the delay time according to the historical request failure rate; and sending the request to be sent to the target service node according to the delay time.
[0081] If the delay strategy is determined to be a time delay strategy, the pending request is sent to the target service node according to the time delay strategy. The time delay strategy can be understood as the client sending the pending request to the target service node after the delay time has passed. If the target service node returns a response failure message, the client can send the pending request to the target service node again after the delay time has passed until the target service node returns a response success message or the client reaches the request processing time, and automatically exits the request sending node.
[0082] In practical applications, if the delay policy is determined to be a time delay policy, it is necessary to determine the historical request failure rate based on the time delay policy, and calculate the delay time based on the historical request failure rate. The higher the historical request failure rate, the longer the delay time. It should be noted that this application does not impose any specific restrictions on the calculation method of the delay time. It is only necessary to determine that the calculation method of the delay time is related to the historical request failure rate.
[0083] In a specific embodiment of the present specification, the delay strategy is determined to be a time delay strategy. If the current time is T, the client will delay sending all requests to the target service node according to the time delay strategy within time T+t, and determine the historical request failure rate f, calculate the delay time d based on the historical request failure rate f, and delay sending the requests to be sent to the target service node according to the delay time d.
[0084] Based on this, when the delay strategy is a time delay strategy, the delay time is calculated by the historical request failure rate, which can not only ensure that the client will not immediately send the pending request to the service node, thereby ensuring that the service node will not be overloaded, but also enable the client to send the pending request to the service node in time after the delay time, so that the service node can process the pending request to ensure that the client can obtain the response result corresponding to the request in time.
[0085] Furthermore, in order to avoid the situation where multiple clients send requests to the target service node with the same delay time, causing the target service node to be in an overloaded state, a certain degree of randomness can be added when calculating the delay time. Specifically, the delay time is calculated according to the historical request failure rate, including: calculating the initial delay time based on the historical request failure rate;
[0086] A random time corresponding to the request to be sent is determined, and a delay time is calculated according to the random time and the initial delay time.
[0087] The initial delay time can be understood as the delay time calculated based on the historical request failure rate, and the random time corresponding to the request to be sent can be understood as the time randomly added by the client when calculating the delay time this time. For example, if the calculated initial delay time is 5ms and the random time is determined to be 1ms, the delay time calculated based on the random time and the initial delay time is 6ms.
[0088] In actual applications, since multiple clients may delay sending requests to the target service node according to the time delay strategy, each client will calculate the delay time and send the request to the target service node according to the delay time. This will also cause the target service node to be overloaded and may also cause the target service node to be unable to respond to requests, making it impossible for each client to receive the corresponding response success information. To avoid the above-mentioned resonance effect, different clients can add a certain degree of randomness when calculating the delay time. In specific implementations, the random time corresponding to the request to be sent can be determined, and the delay time can be calculated according to the random calculation formula.
[0089] In a specific embodiment of this specification, client A calculates an initial delay of 5ms based on historical request failure rates, determines a random time of 1ms, and calculates a delay of 6ms based on the random time and the initial delay. The client calculates an initial delay of 5ms based on historical request failure rates, determines a random time of 1ms, and calculates a delay of 4ms based on the random time and the initial delay.
[0090] In summary, by adding randomness to the delay calculation process, different clients can obtain different delay times through different calculation methods even if they obtain the same initial delay time and random time, thereby avoiding the resonance effect and reducing the possibility of service node overload.
[0091] Furthermore, when the client sends a request to be sent according to the time delay strategy, in order to avoid the client sending other requests to the target service node, the client needs to delay sending all requests sent to the target service node within the time delay period, and specifically send the request to be sent to the target service node according to the delay time, including: determining the time delay period based on the time delay strategy, wherein the time delay period is used to determine the execution period of executing the time delay strategy to send a global request to the target server; within the time delay period, sending the request to be sent to the target service node according to the delay time.
[0092] Among them, the time delay period can be understood as the period during which the client needs to delay sending requests. For example, if the time when the delayed sending strategy is triggered is T, the time delay period can be determined to be (T, T+t). During this time delay period, all requests sent by the client to the target service node are delayed according to the delay time, thereby ensuring that the client does not send requests to the target service node immediately. Global requests can be understood as all subsequent requests sent by the client to the target service node. During the preset delay period, the client needs to execute the time delay strategy to delay sending all requests to the target service node.
[0093] In a specific embodiment of the present specification, the client determines a time delay period according to a time delay policy, and within the time delay period, all requests that the client is about to send to the target service node are delayed in sending.
[0094] In summary, by determining the time delay period, the client can send all subsequent global requests that need to be sent to the target service node within the time delay period to the target service node with a delay according to the delay time.
[0095] Furthermore, in order to avoid the situation where the client sends requests to the service node in a cyclic manner according to the delay time and is unable to obtain response information corresponding to the request due to the service node being always busy, the request response time can be set to jump out of the request sending cycle. The specific method also includes: determining the request response time corresponding to the request to be sent; and generating response failure information for the request to be sent when the delay time is greater than the request response time.
[0096] Among them, the request response time can be understood as the end time of the request sending set by the user. After the request sending time exceeds the request response time, the client can directly generate a response failure message corresponding to the request to be sent, indicating that the target service node cannot respond normally to the request to be sent at this time. The client can directly generate a response failure message and feedback to the user.
[0097] In actual applications, after the user sets the request response time, if the request has not been processed and responded to by the service node within the request response time, the client can directly generate a response failure message corresponding to the request, thereby avoiding the situation of continuously sending the request to the target service node, and ensuring that the user can know the current processing status of the request in a timely manner.
[0098] In a specific embodiment of the present specification, the request to be sent is a resource download request. After the client sends the resource download request to the target service node according to the delay time, the target service node continues to return a response failure to the client. The client will continue to send resource download requests to the target service node according to the delay time. When the delay time exceeds the remaining request response time, the client will directly generate a response failure message to the application layer, so that the user will be informed of the request status of the resource download failure.
[0099] Based on this, by setting the request response time and comparing it with the delay time, the client can avoid being in a loop state of delaying sending requests, thereby saving processing resources of the client and the service node.
[0100] Furthermore, after the request to be sent is successfully responded to or failed by the target service node, the client will count the target request instances and target failure numbers corresponding to the request to be sent, and update the request statistical information to facilitate the judgment of the delayed sending conditions of subsequent requests. The specific method also includes: counting the target request number and target failure number corresponding to the request to be sent; updating the request statistical information based on the target request number and the target failure number.
[0101] Among them, the target request number can be understood as the number of times the request to be sent corresponds to the request to be sent, and the target failure number can be understood as the number of response failures of the request to be sent. The target request number and target failure number corresponding to the request to be sent are updated in the request statistics information so that when the subsequent client makes a delayed sending condition judgment for subsequent requests again, it can make a judgment based on the latest data to ensure the timeliness of the data.
[0102] In a specific embodiment of the present specification, the target number of requests and the target number of failures corresponding to the requests to be sent are counted, and the target number of requests and the target number are updated to the request statistical information. When the client subsequently makes a decision on whether to delay sending the next request again, it can make a decision based on the updated request statistical information.
[0103] This specification provides a request processing method, which is applied to a target client, and includes: receiving a request to be sent for a target service node; determining the request statistics and load information corresponding to the target service node; determining the delay strategy corresponding to the request to be sent when it is determined based on the request statistics and the load information that the request to be sent meets the delayed sending condition; and sending the request to be sent to the target service node according to the delay strategy. On the client side, by determining the request statistics and load information corresponding to the target service node, it is judged whether the request to be sent meets the delayed sending condition. When the request to be sent meets the delayed sending condition, the delay strategy corresponding to the request to be sent is determined, and the request to be sent is sent to the target service node according to the delay strategy. This enables the client to actively delay sending requests to the service node, avoid overload access to the service node, ensure the working stability of the service node, enable the service node to respond to valid requests more effectively, and improve the working efficiency of the service node.
[0104] The following further describes the request processing method provided in this specification using the application of the request processing method in information query as an example, in conjunction with Figure 3. Figure 3 shows a flowchart of the processing process of a request processing method provided in one embodiment of this specification, including steps 302 to 318.
[0105] Step 302: Receive an information query request for a target service node.
[0106] In one achievable manner, the client receives an information query request from the application layer for a target service node.
[0107] Step 304: Determine historical sending requests within a preset time period for the target service node, and historical response information corresponding to the historical sending requests.
[0108] In one achievable manner, the client determines historical sending requests to the target service node within 1 minute, and historical response information corresponding to the historical sending requests.
[0109] Step 306: Determine the request statistics corresponding to the target service node according to the historical sent requests and historical response information.
[0110] In one achievable manner, request statistics corresponding to the target service node are generated based on historical request and response information sent by the client to the target service node within 1 minute.
[0111] Step 308: Determine the load information corresponding to the target service node.
[0112] In one achievable manner, the client receives historical reply information returned by the target service node in response to historical sending requests, and determines the load information corresponding to the target service node from the historical reply information.
[0113] In one achievable manner, the client receives heartbeat information sent by the heartbeat server to the target service node, and determines the load information corresponding to the target service node from the heartbeat information.
[0114] Step 310: Calculate the historical request failure rate of the target service node within a preset period based on the historical request quantity of historical sending requests and the historical failure quantity of historical response information.
[0115] In one achievable manner, the client calculates a historical request failure rate corresponding to the target service node based on the number of historical requests sent and the number of historical failures in historical response information.
[0116] Step 312: Calculate a preset delay threshold corresponding to the request to be sent according to the load information, wherein the preset delay threshold includes a preset number of requests and a preset request failure rate.
[0117] In one achievable manner, the client calculates a preset number of requests and a preset request failure rate based on the load information.
[0118] Step 314: When the number of historical requests is greater than the preset number of requests and the historical request failure rate is greater than the preset request failure rate, it is determined that the request to be sent meets the delayed sending condition.
[0119] In one achievable manner, when the client determines that the number of historical requests is greater than the preset number of requests and the failure rate of historical requests is greater than the preset request failure rate, it indicates that the request to be sent needs to be delayed.
[0120] Step 316: When the delay strategy is a time delay strategy, determine a historical request failure rate based on the time delay strategy, and calculate the delay time according to the historical request failure rate.
[0121] In one achievable manner, the client determines that the delay strategy is a time delay strategy, determines a historical request failure rate, and calculates the delay time based on the historical request failure rate.
[0122] In one feasible method, when the client calculates the delay time based on the historical request failure rate, it can first calculate the initial delay time based on the historical request failure rate, and determine the random time corresponding to the request to be sent, and calculate the delay time based on the initial delay time and the random time according to the random calculation method.
[0123] Step 318: Determine a time delay period based on the time delay policy, and send the request to be sent to the target service node according to the delay time within the time delay period.
[0124] In one feasible manner, the current time is determined to be T, and the time delay period is determined to be (T, T+t) based on the time delay strategy. During the time delay period, the request to be sent is sent to the target service node according to the delay time.
[0125] In one achievable manner, when the delay time is greater than the request response time, that is, the remaining time in the timeout time, resource download failure information corresponding to the request is directly generated and returned to the application layer.
[0126] This specification provides a request processing method for resource downloading, which is applied to a target client, including receiving an information query request for a target service node, determining historical sending requests for the target service node within a preset time period, and historical response information corresponding to the historical sending requests, determining request statistics corresponding to the target service node based on the historical sending requests and historical response information, determining load information corresponding to the target service node, calculating the historical request failure rate of the target service node within a preset period based on the historical number of historical requests and the historical number of failures of historical response information, and calculating a preset delay threshold corresponding to the request to be sent based on the load information, wherein the preset delay threshold includes a preset number of requests and a preset request failure rate. When the number of historical requests is greater than the preset number of requests and the historical request failure rate is greater than the preset request failure rate, it is determined that the request to be sent meets the delayed sending condition. When the delay policy is a time delay policy, the historical request failure rate is determined based on the time delay policy, and the delay time is calculated according to the historical request failure rate. The time delay period is determined based on the time delay policy, and within the time delay period, the request to be sent is sent to the target service node according to the delay time. The client determines the request statistics and load information corresponding to the target service node on the client side, determines whether the pending request meets the conditions for delayed sending, and if so, determines the corresponding delay policy for the pending request. The request is then sent to the target service node according to the delay policy. This allows the client to proactively delay sending requests to the service node, preventing overloaded access to the service node, ensuring the stability of the service node, and enabling the service node to more effectively respond to valid requests, thereby improving its efficiency.
[0127] Corresponding to the above method embodiment, this specification also provides a request processing device embodiment. FIG4 shows a schematic diagram of the structure of a request processing device provided in an embodiment of this specification. As shown in FIG4, the device includes:
[0128] The receiving means 402 is configured to receive a request to be sent to a target service node;
[0129] The first determining means 404 is configured to determine the request statistics information and load information corresponding to the target service node;
[0130] The second determining means 406 is configured to determine a delay strategy corresponding to the request to be sent if it is determined that the request to be sent meets the delay sending condition according to the request statistical information and the load information;
[0131] The sending device 408 is configured to send the to-be-sent request to the target service node according to the delay strategy.
[0132] Optionally, the first determination device 404 is further configured to: determine historical sending requests within a preset time period for the target service node, and historical response information corresponding to the historical sending requests; and determine request statistical information corresponding to the target service node based on the historical sending requests and the historical response information.
[0133] Optionally, the first determining device 404 is further configured to: receive historical reply information of the target service node in response to the historical sending request; and determine the load information corresponding to the target service node according to the historical reply information.
[0134] Optionally, the first determining device 404 is further configured to: receive heartbeat information sent by a heartbeat server to the target service node, wherein the heartbeat server is used to monitor load information corresponding to each service node; and determine the load information corresponding to the target service node according to the heartbeat information.
[0135] Optionally, the first determination device 404 is further configured to: calculate the historical request failure rate of the target service node within the preset period based on the historical request number of the historical sending requests and the historical failure number of the historical response information; calculate the preset delay threshold corresponding to the request to be sent based on the load information, wherein the preset delay threshold includes the preset request number and the preset request failure rate; when the historical request number is greater than the preset request number and the historical request failure rate is greater than the preset request failure rate, determine that the request to be sent meets the delayed sending condition, and continue to execute the step of determining the delay strategy corresponding to the request to be sent.
[0136] Optionally, the sending device 408 is further configured to: determine a historical request failure rate based on a time delay strategy, and calculate a delay time according to the historical request failure rate; and send the request to be sent to the target service node according to the delay time.
[0137] Optionally, the sending device 408 is further configured to: calculate an initial delay time based on the historical request failure rate; determine a random time corresponding to the request to be sent, and calculate a delay time based on the random time and the initial delay time.
[0138] Optionally, the sending device 408 is further configured to: determine a time delay period based on the time delay strategy, wherein the time delay period is used to determine an execution period for executing the time delay strategy to send a global request to the target server; within the time delay period, send the request to be sent to the target service node according to the delay time.
[0139] Optionally, the device further includes a generation module configured to: determine a request response time corresponding to the request to be sent; and generate response failure information of the request to be sent when the delay time is greater than the request response time.
[0140] Optionally, the device further includes an update module configured to: count the target number of requests and the target number of failures corresponding to the requests to be sent; and update the request statistical information based on the target number of requests and the target number of failures.
[0141] The present specification provides a request processing device, which is applied to a target client and includes a receiving device configured to receive a request to be sent for a target service node; a first determining device configured to determine the request statistics and load information corresponding to the target service node; a second determining device configured to determine the delay strategy corresponding to the request to be sent when it is determined that the request to be sent meets the delayed sending condition based on the request statistics and the load information; and a sending device configured to send the request to be sent to the target service node according to the delay strategy. By determining the request statistics and load information corresponding to the target service node on the client side, it is judged whether the request to be sent meets the delayed sending condition. When the request to be sent meets the delayed sending condition, the delay strategy corresponding to the request to be sent is determined, and the request to be sent is sent to the target service node according to the delay strategy. This enables the client to actively delay sending requests to the service node, avoid overload access to the service node, ensure the working stability of the service node, enable the service node to respond to valid requests more effectively, and improve the working efficiency of the service node.
[0142] The above is a schematic diagram of a request processing device according to this embodiment. It should be noted that the technical solution of the request processing device and the technical solution of the request processing method described above are based on the same concept. For details not described in detail in the technical solution of the request processing device, please refer to the description of the technical solution of the request processing method described above.
[0143] Figure 5 shows a block diagram of a computing device 500 according to an embodiment of this specification. Components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.
[0144] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)), whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0145] In one embodiment of the present specification, the aforementioned components of computing device 500 and other components not shown in FIG5 may also be connected to each other, for example, via a bus. It should be understood that the computing device structure block diagram shown in FIG5 is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art may add or replace other components as needed.
[0146] Computing device 500 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 500 can also be a mobile or stationary server.
[0147] The processor 520 implements the steps of the request processing method when executing the computer instructions.
[0148] The above is a schematic solution of a computing device of this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the request processing method described above are based on the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the request processing method described above.
[0149] An embodiment of the present specification also provides a request processing system, which stores computer instructions. The system includes a service node and a client; the client is used to store a request sending executable instruction; when the request sending executable instruction is executed by the client, the steps of the request processing method are implemented, which is used for the client to interact with the service node.
[0150] An embodiment of the present specification further provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the request processing method described above.
[0151] The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the request processing method described above are based on the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the request processing method described above.
[0152] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned request processing method.
[0153] The above is an illustrative solution of a computer program of this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the request processing method described above are based on the same concept. For details not described in detail in the technical solution of the computer program, please refer to the description of the technical solution of the request processing method described above.
[0154] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0155] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0156] It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0157] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0158] The preferred embodiments disclosed above are intended only to help illustrate this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A request processing method, applied to a target client, comprising: Receiving a request to be sent to a target service node; Determine request statistics and load information corresponding to the target service node; In a case where it is determined according to the request statistics information and the load information that the request to be sent meets the delayed sending condition, determining a delay strategy corresponding to the request to be sent; The request to be sent is sent to the target service node according to the delay strategy.
2. The method according to claim 1, determining the request statistics corresponding to the target service node comprises: Determine historical sending requests within a preset time period for the target service node, and historical response information corresponding to the historical sending requests; Determine request statistics corresponding to the target service node according to the historical sending requests and the historical response information.
3. The method according to claim 2, determining the load information corresponding to the target service node comprises: Receiving historical reply information of the target service node in response to the historical sending request; The load information corresponding to the target service node is determined according to the historical reply information.
4. The method according to claim 2, determining the load information corresponding to the target service node comprises: Receiving heartbeat information sent by a heartbeat server to the target service node, wherein the heartbeat server is used to monitor load information corresponding to each service node; Determine the load information corresponding to the target service node according to the heartbeat information.
5. The method according to claim 2, wherein, when it is determined according to the request statistics information and the load information that the request to be sent meets the delayed sending condition, determining a delay strategy corresponding to the request to be sent comprises: Calculate the historical request failure rate of the target service node within the preset period according to the historical request quantity of the historical sending request and the historical failure quantity of the historical response information; Calculating a preset delay threshold corresponding to the request to be sent according to the load information, wherein the preset delay threshold includes a preset number of requests and a preset request failure rate; When the number of historical requests is greater than the preset number of requests and the historical request failure rate is greater than the preset request failure rate, it is determined that the request to be sent meets the delayed sending condition, and the step of determining the delay strategy corresponding to the request to be sent is continued.
6. The method according to claim 1, wherein when the delay strategy is a time delay strategy, sending the request to be sent to the target service node according to the delay strategy comprises: Determine a historical request failure rate based on a time delay strategy, and calculate a delay time according to the historical request failure rate; The request to be sent is sent to the target service node according to the delay time.
7. The method according to claim 6, wherein the delay time is calculated according to the historical request failure rate, comprising: Calculating an initial delay time based on the historical request failure rate; Determine the random time corresponding to the request to be sent, and calculate based on the random time and the initial delay time Delay time.
8. The method according to claim 6, sending the request to be sent to the target service node according to the delay time, comprising: Determine a time delay period based on the time delay policy, wherein the time delay period is used to determine an execution period for executing the time delay policy to send a global request to the target server; Within the time delay period, the to-be-sent request is sent to the target service node according to the delay time.
9. The method of claim 6, further comprising: Determine a request response time corresponding to the request to be sent; When the delay time is greater than the request response time, response failure information of the request to be sent is generated.
10. The method according to any one of claims 1 to 9, further comprising: Counting the target request quantity and target failure quantity corresponding to the request to be sent; The request statistics are updated based on the target number of requests and the target number of failures.
11. A request processing device, applied to a target client, comprising: A receiving device, configured to receive a request to be sent to a target service node; A first determining device is configured to determine request statistical information and load information corresponding to the target service node; A second determining device is configured to determine a delay strategy corresponding to the request to be sent when it is determined that the request to be sent meets the delay sending condition according to the request statistical information and the load information; The sending device is configured to send the to-be-sent request to the target service node according to the delay strategy.
12. A request processing system, the system comprising a service node and a client; The client is used to store a request to send executable instruction; when the request to send executable instruction is executed by the client, the steps of the method according to any one of claims 1 to 10 are implemented, and are used for the client to interact with the service node.
13. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 10 when executing the computer instructions.
14. A computer-readable storage medium storing computer-executable instructions, wherein the computer instructions, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Business resource allocation method and relevant device
CN110433487A
Live broadcast pushing method and device
CN114679598A
Method, system and device for sending and receiving network request
CN114827281A
Request processing method and device
CN116320011A
System and method for load balancing based on expected latency for use in media content or other environments
US20170230295A1
Cited By
Distribution method and system, storage medium and program product
CN120066804A
