Request sending method and device, computer equipment, readable storage medium and program product
By dynamically adjusting the number of connections sent to the receiver server, the problem of overloading of the receiver in the CDN is solved according to the change rate of successful requests and failed requests, and the timely delivery of logs and the improvement of resource utilization efficiency is achieved.
Patent Information
- Application Number
- CN202411748081.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In the content distribution network (CDN), some customers may overload the receiver due to insufficient reception capacity, and even trigger an avalanche effect, affecting the timely delivery of logs.
By obtaining the total number of requests, successful requests and failed requests sent to the receiving server within multiple sets of preset time intervals, a corresponding functional relationship is constructed to determine the change rate of the number of successful requests and failed requests. According to the comparison of the rate of change, dynamically adjust the number of connections sent to the receiver server to avoid overloading of the receiver.
It realizes effective expansion of request sending while ensuring the maximum throughput possible, avoids large-scale request failure, reduces the probability of overload on the receiver, improves resource utilization efficiency, and ensures timely delivery of logs.
Smart Images

Figure CN119652971A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a request sending method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In a content delivery network (CDN), each user's access will generate one or more access logs, recording basic information of the request and other customized information. Some customers hope that CDN service providers can return these access logs for internal analysis.
[0003] Since logs are independent and suitable for parallel processing, CDN server providers usually use an automatically scalable thread pool to include logs in requests for sending, and dynamically create new sending threads and TCP (Transmission Control Protocol) connections as the number of requests increases. However, due to the uneven technical level and technical architecture of customers, some customers may have insufficient receiving capacity. When the business volume increases significantly, it is easy to overload the receiving server, triggering the receiving server alarm and even causing an avalanche effect. Therefore, there is an urgent need for a request sending method that can prevent the receiving party from being overloaded and ensure the timely delivery of logs. Summary of the invention
[0004] Based on this, it is necessary to provide a request sending method, device, computer equipment, computer-readable storage medium and computer program product that can prevent the recipient from being overloaded and ensure timely delivery of logs in response to the above technical problems.
[0005] In a first aspect, the present application provides a request sending method, comprising:
[0006] Obtain the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals;
[0007] Constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and determining a first change rate of the number of successful requests based on the first functional relationship, and determining a second change rate of the number of failed requests based on the second functional relationship;
[0008] In a case where the first change rate is greater than zero and greater than the second change rate, the number of connections used to simultaneously send requests to the receiving server is increased.
[0009] In one of the embodiments, when the first change rate is greater than zero and greater than the second change rate, increasing the number of connections for simultaneously sending requests to the receiving server includes:
[0010] When the first change rate is greater than zero and greater than the second change rate, one connection is added each time for simultaneously sending requests to the receiving server.
[0011] In one embodiment, after determining the first change rate of the number of successful requests based on the first functional relationship and determining the second change rate of the number of failed requests based on the second functional relationship, the method further comprises:
[0012] In a case where the second change rate is greater than zero and greater than the first change rate, the number of connections used to simultaneously send requests to the receiving server is reduced.
[0013] In one of the embodiments, when the second change rate is greater than zero and greater than the first change rate, reducing the number of connections used to simultaneously send requests to the receiving server includes:
[0014] Get the maximum number of requests that can be sent based on a single connection within the current time window;
[0015] Calculate the product of the maximum number and the second change rate, and calculate the ratio of the number of failed requests to the product;
[0016] Rounding down the ratio to obtain a target change value;
[0017] When the second change rate is greater than zero and greater than the first change rate, the number of connections for simultaneously sending requests to the receiving server with a target change value is reduced.
[0018] In one of the embodiments, the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals are obtained, and before that, the total number of requests, the number of successful requests, and the number of failed requests include:
[0019] When the state of the connection used to send the request to the receiving server is abnormal, the response to the request is abnormal, or the time taken to send the request exceeds a preset time threshold, the number of failed requests is increased by 1.
[0020] In one embodiment, the step of constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests includes:
[0021] Based on the least square method, linear fitting is performed on the change of the number of successful requests with the total number of requests to obtain a first functional relationship;
[0022] Based on the least square method, a linear fit is performed on the change of the number of failed requests with the total number of requests to obtain a second functional relationship.
[0023] In a second aspect, the present application further provides a request sending device, including:
[0024] A data acquisition module, used to acquire the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals;
[0025] A data processing module, constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and determining a first change rate of the number of successful requests based on the first functional relationship, and determining a second change rate of the number of failed requests based on the second functional relationship;
[0026] A connection adjustment module is used to increase the number of connections used to simultaneously send requests to the receiving server when the first change rate is greater than zero and greater than the second change rate.
[0027] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-described methods when executing the computer program.
[0028] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the methods described above when executed by a processor.
[0029] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of any of the methods described above when executed by a processor.
[0030] The above-mentioned request sending method, device, computer equipment, computer-readable storage medium and computer program product do not need to rely on the information of the receiving server. By identifying the situation where increasing the number of requests will lead to an increase in throughput and the benefits brought are greater than the losses, the number of connections used to simultaneously send requests to the receiving server is increased. This can achieve effective expansion of request sending while ensuring the highest possible throughput, avoid large-scale request failures on the client side, reduce the probability of receiving overload, and avoid wasting connections on invalid requests, thereby improving the sender's resource utilization efficiency and ensuring the timely delivery of logs. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A schematic diagram of a process of sending a request in one embodiment;
[0033] Figure 2 is a flow chart of step S206 in one embodiment;
[0034] Figure 3 A flowchart of a request sending method in another embodiment;
[0035] Figure 4 is a flow chart of step S207 in one embodiment;
[0036] Figure 5 A flowchart of a request sending method in yet another embodiment;
[0037] Figure 6 A flowchart of steps for constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests in one embodiment;
[0038] Figure 7 It is a structural block diagram of a request sending device in one embodiment;
[0039] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] At present, for large-scale distributed systems, for billing or operation and maintenance needs, large-scale support systems are usually built to aggregate and count business indicators. For example, for CDN networks, cloud service providers and customers need to understand the traffic generated by customer businesses in real time. Therefore, some customers require real-time access to logs generated by CDN networks for analysis. However, these customers are usually also customers with large usage. For example, the peak request volume of some users can reach 2.4 million times per second. Taking an HTTP (HyperText Transfer Protocol) request containing 5,000 logs as an example, 4,800 requests need to be initiated to the customer per second to complete the return. Assuming that a single log contains 500 bytes and the compression rate is 0.5, it will consume 572 MiB / s (4576Mbps) of bandwidth, which will undoubtedly cause huge pressure on both the sender and the receiver.
[0042] Therefore, both the sender and the receiver usually adopt horizontal expansion to improve processing capabilities. For example, the sender usually uses an automatically scalable thread pool to create a new sending thread and a corresponding TCP connection when the number of requests to be sent increases. The receiver usually adds more servers to handle more requests. However, more requests may not necessarily lead to greater throughput (the number of data successfully transmitted per unit time). The receiver always has a processing limit. When the limit is exceeded, some requests will be rejected, and even an avalanche may occur. For example, if the business volume increases significantly, when the sender has already expanded to try to send more requests, and the receiver has not had time to adjust, it is more likely to have an avalanche effect (that is, the processing capacity of the entire system does not increase linearly with the number of requests, but instead drops sharply after the number of requests exceeds a certain point).
[0043] Some related technologies provide receiving control strategies implemented on the receiving server. However, in actual applications, there is a business boundary between cloud service providers and customers. Cloud service providers cannot interfere with customers' technical architecture, and customers will not expose their own processing capabilities to the outside world. Other related technologies provide methods to avoid external system avalanches by self-limiting, but they do not consider the throughput problem. Instead, they start from the perspective of service crash, that is, they optimize for a call success rate of 0.
[0044] Based on this, the embodiment of the present application provides a request sending method, and the present embodiment uses the method applied to the sending server as an example. Figure 1 As shown, the method comprises the following steps:
[0045] Step S202, obtaining the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals.
[0046] For example, within a series of fixed-length time windows (e.g., within 1 second), as the working conditions of the receiver and the sender fluctuate (e.g., the amount of data to be transmitted changes), the number of requests will fluctuate. Therefore, the request status within multiple fixed-length time windows can be collected at intervals of a preset time, and the change trend can be used as a basis for decision making. {0, …, n}, you can set the duration of each interval Collect n groups Among them, the total number of requests It can be the total number of requests sent per second, the number of successful requests It can be the total number of successful requests sent per second, the number of failed requests It can be the total number of requests that failed to be sent per second. In a possible implementation, it can be determined whether the request was successfully sent based on the response status code of the request. It is understandable that only the requests that were successfully sent are the effective throughput.
[0047] Step S204, construct a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and determine a first change rate of the number of successful requests based on the first functional relationship, and determine a second change rate of the number of failed requests based on the second functional relationship.
[0048] For example, the response of the server depends on the number of requests sent. Since the server itself can be regarded as unchanged within the preset time interval, the total number of requests can be regarded as the independent variable of the number of successful requests and the number of failed requests, and its derivative can be used to characterize the change rate of the number of successful requests and the number of failed requests when the total number of requests changes. For example, the first formula can be used to determine the number of successful requests: With the total number of requests First rate of change , the first formula may include:
[0049] ;
[0050] The second formula can be used to determine the number of failed requests With the total number of requests Second rate of change , the second formula may include:
[0051] ;
[0052] It is understandable that the first rate of change and the second rate of change The sign change of can be used to represent the gains and losses when the total number of requests changes.
[0053] Step S206: when the first change rate is greater than zero and greater than the second change rate, increase the number of connections used to simultaneously send requests to the receiving server.
[0054] Among them, the first change rate is greater than zero, which can be used to indicate that increasing the number of requests will lead to more successfully sent requests (that is, an increase in throughput); the first change rate is greater than the second change rate, which can be used to indicate that the change in the number of successful requests caused by increasing the number of requests is greater than the change in the number of failed requests.
[0055] Since the number of connections used to simultaneously send requests to the receiving server and the response time are fixed, it is equivalent to fixing the maximum sending capacity of the sender. Therefore, the rate of sending requests can be controlled by adjusting the connections used to simultaneously send requests to the receiving server. Exemplarily, the connection pool scheduling framework in the related art can be added with a trigger judgment condition based on the connection utilization rate and the number of requests to be sent to trigger the increase of the number of connections.
[0056] In a possible implementation, the connection used to simultaneously send requests to the receiving server can be characterized by concurrency. For example, in the case of 100% connection utilization, the third formula can be used to determine the currently required parallelism p, and the third formula may include:
[0057] ;
[0058] Among them, ceil() is a floating rounding function. is the total number of requests the sender wants to send per second, is the maximum number of requests that can be sent per connection per second. It can be determined using the fourth formula , the fourth formula may include:
[0059] ;
[0060] in, is the response time. Therefore, by calculating the currently required parallelism p, the number of connections that need to be created can be determined. It can be understood that if Greater than , a second connection (for example, a TCP connection) needs to be created. When p is 2, there will definitely be two requests sent at the same time.
[0061] It should be noted that, unlike concurrent tasks, which emphasize simultaneous execution within a time period, that is, having the effect of simultaneous execution at a macro level, a time period is accumulated by multiple unit times, and multiple concurrent tasks are not necessarily executed at the same time within a unit time. The degree of parallelism refers to the number of tasks executed simultaneously. In the specific business scenario of log transmission, the degree of parallelism indicator can be the number of connections in the thread pool.
[0062] In the above request sending method, there is no need to rely on the information of the receiving server. By identifying the situation where increasing the number of requests will increase the throughput and the benefits outweigh the losses, the number of connections used to simultaneously send requests to the receiving server is increased. This can achieve effective expansion of request sending while ensuring the largest possible throughput, avoid large-scale request failures on the client side, reduce the probability of receiving overload, and avoid wasting connections on invalid requests, thereby improving the sender's resource utilization efficiency and ensuring timely delivery of logs.
[0063] In an exemplary embodiment, Figure 2 As shown, the above step S206 includes:
[0064] Step S2061, when the first change rate is greater than zero and greater than the second change rate, one connection is added each time for simultaneously sending requests to the receiving server.
[0065] For example, the change in the number of connections each time a connection is added for simultaneously sending requests to the receiving server may be limited. Equal to 1. In this way, when it is determined that additional connections are allowed, the growth rate of the connections can be controlled to control the total number of requests sent in the current time window (between two adjustments).
[0066] Optionally, when the first change rate and the second change rate are less than or equal to zero, the change amount of the number of connections Can be equal to 0.
[0067] In an exemplary embodiment, Figure 3 As shown, the above method may also include:
[0068] Step S207, when the second change rate is greater than zero and greater than the first change rate, reducing the number of connections used to simultaneously send requests to the receiving server.
[0069] Among them, the second change rate is greater than zero, which can be used to characterize that increasing the number of requests will lead to more requests that fail to be sent. The second change rate is greater than the first change rate, which can be used to characterize that the change in the number of successful requests caused by increasing the number of requests is less than the change in the number of failed requests. Therefore, the number of connections used to simultaneously send requests to the receiving server can be reduced to reduce the rate of sending requests. In a possible implementation, the execution of step S207 can be triggered in parallel with the operation of the connection pool scheduling framework in the related technology to judge the recovery of idle connections based on connection utilization, without affecting each other.
[0070] If a single IP address (Internet Protocol Address) of the receiver uses a reverse proxy to point to multiple processing servers, one or more of which fails, and there is no reasonable health check mechanism to remove failed servers, a fixed proportion of requests sent to the IP address will be forwarded to the failed server, resulting in failed requests. The proportion of failed requests is fixed, that is, In this case, since there is no mutual impact between the faulty server and the normal server, it is also effective to continue to increase the number of requests sent.
[0071] In this embodiment, by identifying the situation where increasing the number of requests cannot improve throughput and the loss is greater than the benefit, the degree of parallelism is reduced, thereby avoiding the waste of resources caused by too many connections and the memory usage of the server.
[0072] Furthermore, the number of connections that need to be reduced can be determined by performing a linear prediction estimate on the number of failed requests. Figure 4 As shown, the above step S207 may include:
[0073] Step S2071, obtaining the maximum number of requests that can be sent based on a single connection within the current time window.
[0074] Step S2072, calculating the product of the maximum number and the second change rate, and calculating the ratio of the number of failed requests to the product.
[0075] Step S2073, round down the ratio to obtain the target change value.
[0076] Step S2074, when the second change rate is greater than zero and greater than the first change rate, reduce the connection for simultaneously sending requests to the receiving server with the target change value.
[0077] For example, when the number of failed requests needs to be Reduced to 0, the fifth formula can be used to determine the target change value , the fifth formula may include:
[0078] ;
[0079] The target change value is the change in the number of connections in the current time window, that is, the change in the number of connections adjusted this time, floor() is a rounding function, The number of failed requests that need to be reduced. is the second change in the number of failed requests. The maximum number of requests that can be sent based on a single connection in the current time window. The sixth formula can also be used to determine the target change value , the sixth formula may include:
[0080] ;
[0081] in, is the response time, The duration of the current time window.
[0082] In this embodiment, based on the proportion of failed requests that will result from an increase in the number of requests, it is possible to estimate the number of requests that need to be withdrawn. Further, based on the number of requests that need to be withdrawn and the number of requests that a single connection can carry at full load, it is possible to estimate the number of connections that need to be reduced.
[0083] In an exemplary embodiment, Figure 5 As shown, the above method may also include:
[0084] Step S201, when the state of the connection used to send the request to the receiving server is abnormal, the response to the request is abnormal, or the time taken to send the request exceeds a preset time threshold, the number of failed requests is increased by 1.
[0085] For example, requests that are normal in the TCP phase, do not time out or reset the connection, the server does not actively disconnect, HTTP returns a normal status code of 200, and the HTTP phase does not take longer than a preset time threshold (e.g., 5 seconds) can be counted as successful requests. Requests that do not meet any of the above conditions can be counted as failed requests.
[0086] Optionally, only the response time of successful requests can be used to calculate the response time. Response time Methods of determining may include: calculating the mean or median.
[0087] In an exemplary embodiment, Figure 6 As shown, the steps of constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests include:
[0088] Step A1, based on the least square method, linear fitting is performed on the change of the number of successful requests with the total number of requests to obtain a first functional relationship.
[0089] Step A2: Based on the least square method, a linear fit is performed on the variation of the number of failed requests with the total number of requests to obtain a second functional relationship.
[0090] For example, each interval has a preset duration. Collect n groups Since the business scenario will not mutate suddenly, the first functional relationship between the total number of requests and the number of successful requests may be a linear relationship, and the first functional relationship may include:
[0091] ;
[0092] The second functional relationship between the total number of requests and the number of failed requests may be a linear relationship, and the second functional relationship may include:
[0093] ;
[0094] in, and is the linear intercept.
[0095] In one possible implementation, The time required for the least squares method to fit the request is 10 seconds, so 6 sets of data can be collected every minute for least squares fitting, achieving a good balance between accuracy and response speed (the response time for most requests is within 5 seconds, and twice the response time is long enough). In scenarios with larger data volumes but better network conditions, such as internal systems using intranet transmission, It can be further reduced to 2 times the average response time.
[0096] To sum up, in the above request sending method, there is no need to rely on the information of the receiving server. By identifying the situation where increasing the number of requests will increase the throughput and the benefits outweigh the losses, the number of connections used to simultaneously send requests to the receiving server is increased. This can achieve effective expansion of request sending while ensuring the largest possible throughput, avoid large-scale request failures on the client side, reduce the probability of receiving overload, and avoid wasting connections on invalid requests, thereby improving the sender's resource utilization efficiency and ensuring timely delivery of logs.
[0097] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0098] Based on the same inventive concept, the embodiment of the present application also provides a request sending device for implementing the request sending method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more request sending device embodiments provided below can refer to the limitations on the request sending method above, and will not be repeated here.
[0099] In an exemplary embodiment, Figure 7 As shown, a request sending device 300 is provided, comprising: a data acquisition module 301, a data processing module 302 and a connection adjustment module 303, wherein:
[0100] The data acquisition module 301 is used to acquire the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals.
[0101] The data processing module 302 is used to construct a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and to determine a first change rate of the number of successful requests based on the first functional relationship, and to determine a second change rate of the number of failed requests based on the second functional relationship.
[0102] The connection adjustment module 303 is used to increase the number of connections used to simultaneously send requests to the receiving server when the first change rate is greater than zero and greater than the second change rate.
[0103] In an exemplary embodiment, the connection adjustment module 303 is further configured to:
[0104] When the first change rate is greater than zero and greater than the second change rate, one connection is added each time for simultaneously sending requests to the receiving server.
[0105] In an exemplary embodiment, the connection adjustment module 303 is further configured to:
[0106] When the second change rate is greater than zero and greater than the first change rate, the number of connections used to simultaneously send requests to the receiving server is reduced.
[0107] In an exemplary embodiment, the connection adjustment module 303 is further configured to:
[0108] Get the maximum number of requests that can be sent based on a single connection within the current time window;
[0109] Calculate the product of the maximum number and the second change rate, and calculate the ratio of the number of failed requests to the product;
[0110] Round the ratio down to get the target change value;
[0111] When the second change rate is greater than zero and greater than the first change rate, the number of connections for simultaneously sending requests to the receiving server with the target change value is reduced.
[0112] In an exemplary embodiment, the request sending device 300 further includes:
[0113] The request judgment module is used to increase the number of failed requests by 1 when the state of the connection used to send the request to the receiving server is abnormal, the response to the request is abnormal, or the time taken to send the request exceeds a preset time threshold.
[0114] In an exemplary embodiment, the data processing module 302 is further used to:
[0115] Based on the least squares method, a linear fit is performed on the change of the number of successful requests with the total number of requests to obtain the first functional relationship;
[0116] Based on the least square method, a linear fit is performed on the change in the number of failed requests with the total number of requests to obtain the second functional relationship.
[0117] Each module in the above-mentioned request sending device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0118] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a request sending method is implemented.
[0119] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0120] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0121] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0122] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0123] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0124] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0125] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0126] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A request sending method, characterized in that: The method comprises: Obtain the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals; Constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and determining a first change rate of the number of successful requests based on the first functional relationship, and determining a second change rate of the number of failed requests based on the second functional relationship; In a case where the first change rate is greater than zero and greater than the second change rate, the number of connections used to simultaneously send requests to the receiving server is increased.
2. The method according to claim 1, characterized in that When the first change rate is greater than zero and greater than the second change rate, increasing the number of connections used to simultaneously send requests to the receiving server comprises: When the first change rate is greater than zero and greater than the second change rate, one connection is added each time for simultaneously sending requests to the receiving server.
3. The method according to claim 1, characterized in that: After determining the first change rate of the number of successful requests based on the first functional relationship and determining the second change rate of the number of failed requests based on the second functional relationship, the method further comprises: In a case where the second change rate is greater than zero and greater than the first change rate, the number of connections used to simultaneously send requests to the receiving server is reduced.
4. The method according to claim 3, characterized in that When the second change rate is greater than zero and greater than the first change rate, reducing the number of connections used to simultaneously send requests to the receiving server comprises: Get the maximum number of requests that can be sent based on a single connection within the current time window; Calculate the product of the maximum number and the second change rate, and calculate the ratio of the number of failed requests to the product; Rounding down the ratio to obtain a target change value; When the second change rate is greater than zero and greater than the first change rate, the number of connections for simultaneously sending requests to the receiving server with a target change value is reduced.
5. The method according to claim 1, characterized in that The total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within the plurality of preset time intervals are obtained, and the above includes: When the state of the connection used to send the request to the receiving server is abnormal, the response to the request is abnormal, or the time taken to send the request exceeds a preset time threshold, the number of failed requests is increased by 1.
6. The method according to claim 1, characterized in that The constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests includes: Based on the least square method, linear fitting is performed on the change of the number of successful requests with the total number of requests to obtain a first functional relationship; Based on the least square method, a linear fit is performed on the change of the number of failed requests with the total number of requests to obtain a second functional relationship.
7. A request sending device, characterized in that: The device comprises: A data acquisition module, used to acquire the total number of requests, the number of successful requests, and the number of failed requests sent to the receiving server within multiple groups of preset time intervals; A data processing module, constructing a first functional relationship between the total number of requests and the number of successful requests and a second functional relationship between the total number of requests and the number of failed requests, and determining a first change rate of the number of successful requests based on the first functional relationship, and determining a second change rate of the number of failed requests based on the second functional relationship; A connection adjustment module is used to increase the number of connections used to simultaneously send requests to the receiving server when the first change rate is greater than zero and greater than the second change rate.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
State determination method, device and system and medium
CN115878411A
Communication method and device between transaction platforms, equipment and storage medium
CN116723226A
Content distributing system, method for distributing content and computer program thereof
CN1469555A
System, method and computer program product to maximize server throughput while avoiding server overload by controlling the rate of establishing server-side net work connections
US20030023743A1