Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As shown in fig. 1, a method for adjusting connection timeout provided in an embodiment of the present invention may include:
s100, obtaining expected values of request waiting time lengths of a plurality of connection requests in at least one historical time period before a first time period, wherein each expected value is the expected value of the request waiting time length of the plurality of connection requests in one historical time period, which is influenced by the connection overtime time of the historical time period;
in this embodiment, the request waiting time of each connection request may be managed according to a time period, specifically, the present invention may divide the time into a plurality of time periods, for example, from a certain time of a certain day of a certain month of a certain year, every five seconds is a time period. The connection request within a time period may be a connection request whose transmission time is within the time period. When the method shown in fig. 1 is applied to a request transmission device (e.g., a client device), the request transmission device may determine in which time period each connection request is located according to the transmission time of the connection request. As time passes, the partial time period becomes a historical time period. The present embodiment may record the request waiting time of each connection request sent.
Optionally, each time period may be set with a connection timeout time, where the connection timeout time of one time period is the connection timeout time of each connection request in the time period. Optionally, in this embodiment, a default connection timeout time (for example, 10 seconds) may be set for the first time period in advance, and then the connection timeout time of the first time period is adjusted according to the method shown in fig. 1 of the present invention. In other embodiments of the present invention, a default connection timeout time for a first time period may be set to a connection timeout time for a previous time period of the first time period.
Optionally, the request waiting duration in this embodiment is a duration consumed in a request process of performing network connection. There are three situations after the request sending device sends a certain connection request for the first time:
in the first case, after the request sending device sends a certain connection request, the request sending device waits for a period of time (the length of the time is less than the connection timeout time), and a network connection is established between the request sending device and the request receiving device. The request wait duration for this case is: the duration from the time the connection request is sent to the time the network connection is successfully established. After the network connection is established, the request for network connection is completed. A connection request in case one may be referred to as: the connection request of the request procedure is ended due to the network connection establishment.
In the second case, after the request sending device sends a certain connection request, the request sending device waits for a period of time (the length of the time reaches the connection timeout time), and the network connection between the request sending device and the request receiving device is not established yet. The request wait duration for this case is: connection timeout time. And after the request waiting time reaches the connection overtime, ending the request process of network connection. A connection request in case two may be referred to as: the connection request of the request process is ended because the request wait period reaches the connection timeout time.
And thirdly, after the request sending equipment sends a certain connection request, waiting to the current moment (the length of the waiting time is less than the connection overtime), and stopping the network connection between the request sending equipment and the request receiving equipment at the current moment. The request wait duration for this case is: the duration from the time the connection request is sent to the current time. Since the waiting is still needed in this case, the request sending device sends the connection request in a blocking state, and the request process for network connection is not yet finished. A connection request in case three may be referred to as: a blocked connection request.
Optionally, after receiving the connection request, the request receiving device may establish a network connection with the request sending device through an existing network connection establishment technology such as "three-way handshake", which is not limited herein.
Optionally, for the case two, the request sending device of this embodiment may send the connection request again to retry. It should be noted that the connection request that is retried is preferentially processed by the request receiving device, and thus the request waiting time of the connection request that is retried is shorter than the request waiting time of the connection request that is initially sent. In an alternative embodiment of the present invention, the request wait period for a retried connection request may not be considered in calculating the expected value for the request wait period. Of course, in other embodiments of the present invention, the request waiting time of the retried connection request may be added to the calculation process of calculating the expected value of the request waiting time.
In an alternative embodiment of the invention, the request latency of a blocked connection request may not be considered when calculating the expected value of the request latency.
Specifically, the historical time period before the first time period may be a historical time period adjacent to the first time period, or may be a historical time period not adjacent to the first time period. The plurality of historical time periods before the first time period obtained in this embodiment may be continuous or discontinuous. The span of the first time period may be the same as the span of the historical time period, e.g., the span of the first time period is 5 seconds and the span of the historical time period is also 5 seconds. It will be appreciated that the span of the first time period may not be the same as the span of the historical time period. In the case of multiple historical time periods, the spans of the historical time periods may be the same or different, and are not further limited herein.
Alternatively, the first time period and the historical time period before the first time period may span longer than the connection timeout time of each time period, respectively.
Optionally, as shown in fig. 2, in another method for adjusting connection timeout time provided in the embodiment of the present invention, step S100 may include:
s110, for at least one historical time period before the first time period: acquiring the number of connection requests and the request waiting time for ending the request process in the historical time period, and acquiring the number of blocked connection requests and the request waiting time in the historical time period;
specifically, the connection request for ending the request process in the historical time period may include the following two connection requests:
a connection request of a first type for ending the request process within the history period due to the request waiting time reaching the connection timeout time of the history period;
second, a connection request within the historical period of time that ends the request process due to network connection establishment.
For ease of understanding, the following is exemplified:
example 1: starting from 00 min 00 s at 3/27/3/2019, every 5 s is a time period, and the current time is 00 min 30 s at 00 h at 27/3/2019, six historical time periods exist, which are respectively: [00, 05), [05, 10), [10, 15), [15, 20), [20, 25) and [25, 30). For convenience, the six historical time periods are not added with the time of the year, the month and the day, and are not added with units. The unit of the above six history time periods is seconds. The embodiment may adjust the connection timeout time of the next period according to the expected value of the request waiting time of the multiple connection requests in the previous period of the two adjacent periods. For example 1, the connection timeout time of [05, 10) may then be adjusted according to the expected value of the request wait duration for the multiple connection requests within [00, 05). Adjusting the connection timeout time of [10, 15) according to a desired value of a request wait duration for a plurality of connection requests within [05, 10), and so on. The connection timeout time of the time period in which the current time is located can be adjusted according to the expected value of the request waiting time of the multiple connection requests in the historical time period closest to the current time. Since the current time is 00 minutes 30 seconds at 00 o' clock on 27 th day 3/27 th day in 2019), the connection timeout time of [30, 35) may be adjusted according to the expected value of the request waiting time of the plurality of connection requests in [25, 30) for example 1 in this embodiment.
Suppose that 10 connection requests are sent by the request sending device in [25, 30) in example 1, of which 2 connection requests are connection requests to be retried and the remaining 8 connection requests are connection requests to be sent for the first time. The present embodiment may determine the expected value of the request wait durations of the plurality of connection requests within [25, 30) according to the request wait durations of the 8 initially transmitted connection requests. These 8 connection requests are request 1 to request 8, respectively, assuming that request 1 to request 3 are connection requests that end the request process due to the request wait time reaching a connection timeout of [25, 30), request 4 to request 6 are connection requests that end the request process due to network connection establishment, and request 7 and request 8 are blocked connection requests. [25, 30 ] the connection timeout time was 3 seconds. Specifically, the request waiting time of request 1 to request 8 is shown in table 1:
TABLE 1
| Request for
|
Request 1
|
Request 2
|
Request 3
|
Request 4
|
Request 5
|
Request 6
|
Request 7
|
Request 8
|
| Request wait duration
|
3 seconds
|
3 seconds
|
3 seconds
|
1.2 seconds
|
1.8 seconds
|
2.1 seconds
|
0.7 second
|
0.3 second |
And S120, calculating and obtaining expected values of the request waiting time lengths of the plurality of connection requests in the historical time period according to the obtained number of the connection requests and the request waiting time length, wherein the connection request for finishing the request process and the blocked connection request do not comprise a connection request for retry.
Optionally, in another method for adjusting connection timeout provided in the embodiment of the present invention, step S120 may be specifically based on a formula
Calculating and obtaining an expected value r of request waiting time lengths of a plurality of connection requests in the historical time period, wherein N is the number of the connection requests for ending the request process in the historical time period, and N is N1+N2,N1The number of connection requests, t, for which the request process is ended due to the request wait time reaching the connection timeout time of the history period within the history periodiA request wait duration for the ith connection request within the history period that ends the request process because the request wait duration reached the connection timeout time for the history period, i is a number of connection requests within the history period that end the request process because the request wait duration reached the connection timeout time for the history period, N2For connections within the historical period of time that end the request process due to network connection establishmentNumber of received requests, tjA request waiting time for the jth connection request within the history period for ending the request procedure due to network connection establishment, j being the number of connection requests within the history period for ending the request procedure due to network connection establishment, M being the number of blocked connection requests within the history period, tkThe request waiting time of the blocked kth connection request in the historical time period is k, k is the serial number of the blocked connection request in the historical time period, i, j and k are natural numbers, w1Weight, w, of average request waiting time of connection request for ending request process in the history period2The average request wait time of the blocked connection requests in the historical period of time.
It will be appreciated that the request latency of a blocked connection request is not a full request latency, since the connection request that completes the request process goes through a full request process, while the request process of a blocked connection request has not yet completed. As can be seen, the confidence of the request wait time of the connection request to end the request process is higher. Therefore, in an optional embodiment of the present application, the average request waiting time of the connection request for ending the request process may be weighted more than the average request waiting time of the blocked connection request. This makes it possible to obtain more accurate and reasonable calculation of the expected value.
Let the weight occupied by the average request waiting time of the connection request for ending the request procedure in [25, 30) in example 1 be 0.9; assuming that the weight occupied by the average request wait time period of the blocked connection requests in [25, 30) is 0.1, the following can be obtained by substituting the above equation for the request wait time periods and numbers of the requests shown in table 1:
S200, adjusting the connection timeout time of the first time period based on the comparison result of the expected value and a preset threshold.
In particular, the preset threshold may be set and adjusted by a technician. Alternatively, the preset threshold may be set according to expected values of the request waiting time periods of the plurality of connection requests in the plurality of historical time periods. For example: counting the expected value of the request waiting time of other connection requests except the retried connection request in a plurality of historical time periods during normal operation of the request receiving equipment, and setting the preset threshold value as a certain multiple of the expected value, such as 1.1 times.
Of course, the preset threshold may be set by other setting methods, and the present invention is not limited herein.
Optionally, the preset threshold may be one or multiple.
Step S200 may include the following three specific embodiments:
in a first specific embodiment, when the expected value obtained in step S100 includes an expected value in a continuous preset number of historical time periods, the preset threshold may include a first preset threshold, and step S200 may include:
and comparing each expected value in the continuous historical time periods with the first preset threshold respectively, and adjusting the connection overtime time of the first time period when each expected value in the continuous historical time periods with the preset number is greater than the first preset threshold.
Still using example 1 to illustrate: when the preset number is 5, the first time period is [30, 35), if the expected values of the request waiting time periods of the connection requests in the five history time periods [05, 10 ], [10, 15 ], [15, 20 ], [20, 25) and [25, 30) are obtained in step S100, the expected values of the five history time periods may be respectively compared with the first preset threshold, and when the expected values are all greater than the first preset threshold, it indicates that the expected value of the request waiting time period of the connection request is longer in a longer time period in the past. The request timeout time of [30, 35) can be reduced by some amount at this time, for example: adjusted to 0.9 times the request timeout time of [25, 30), or adjusted to 0.9 times the average of the request timeout times of the five history periods of [05, 10), [10, 15), [15, 20), [20, 25) and [25, 30).
When at least one of the expected values in the consecutive history time periods of the preset number is not greater than the first preset threshold, the connection timeout time of the first time period may not be adjusted. At this time, the connection timeout time of the first period is still the default connection timeout time, which may be the connection timeout time of the previous period of the first period.
In a second specific embodiment, the preset threshold may include a second preset threshold, and step S200 may specifically include:
and comparing the obtained expected values with a second preset threshold respectively, and adjusting the connection timeout time of the first time period when at least one expected value is greater than the second preset threshold.
Wherein the first preset threshold may be smaller than the second preset threshold.
Still using example 1 to illustrate: when the preset number is 5, the first time period is [30, 35), if the expected values of the request waiting time periods of the connection requests in the five history time periods of [05, 10 ], [10, 15 ], [15, 20 ], [20, 25) and [25, 30) are obtained in step S100, the expected values of the five history time periods may be compared with the second preset threshold respectively, and when at least one of the expected values is greater than the second preset threshold, the expected value of the request waiting time period which has been very long in the past is described. The request timeout time of [30, 35) can be reduced by some to avoid long wait times.
When each of the obtained expected values is not greater than the second preset threshold, the connection timeout time of the first time period may not be adjusted. At this time, the connection timeout time of the first period is still the default connection timeout time, which may be the connection timeout time of the previous period of the first period.
In a third specific embodiment, the preset threshold may include a first preset threshold and a second preset threshold, and step S200 may specifically include:
comparing each expected value in a continuous preset number of historical time periods with the first preset threshold value respectively, and comparing each obtained expected value with the second preset threshold value respectively, wherein the first preset threshold value is smaller than the second preset threshold value;
and when at least one of the obtained expected values is greater than the second preset threshold value, or the expected values in the continuous preset number of historical time periods are greater than the first preset threshold value, adjusting the connection timeout time of the first time period.
By comparing with the first preset threshold and the second preset threshold, respectively, the expected values obtained in step S100 can be measured at multiple angles and the connection timeout time of the subsequent time period can be adjusted accordingly.
When at least one of the expected values in the continuous preset number of historical time periods is not greater than the first preset threshold value and the obtained expected values are not greater than the second preset threshold value, the connection timeout time of the first time period may not be adjusted. At this time, the connection timeout time of the first period is still the default connection timeout time, which may be the connection timeout time of the previous period of the first period.
Optionally, the manner of adjusting the connection timeout time of the first time period in the three specific embodiments may specifically be:
and adjusting the connection timeout time of the first time period to be a preset multiple of the average value of the connection timeout times of the at least one historical time period, wherein the preset multiple is smaller than 1 time.
Optionally, the manner of adjusting the connection timeout time of the first time period in the three specific embodiments may also be specifically:
and adjusting the connection timeout time of the first time period to be a preset multiple of the connection timeout time of a historical time period.
Optionally, the historical time period is adjacent to and before the first time period.
It will be appreciated that as the connection timeout decreases, the expected value of the request wait period for the connection request decreases accordingly. When the expected value of the request waiting time period is reduced to the preset threshold value, the expected value is not reduced. Specifically, after the expected value of the request waiting duration in the third embodiment is reduced to the first preset threshold, the connection timeout time of the subsequent time period is not reduced any more.
Of course, in addition to reducing the connection timeout time, the embodiment of the present invention may also increase the connection timeout time, for example: the preset threshold may include a third preset threshold, and the step S200 may specifically include:
and comparing each obtained expected value with the third preset threshold value respectively, and increasing the connection timeout time of the first time period when the expected values are smaller than the third preset threshold value.
The method for adjusting connection timeout provided by the embodiment of the invention can obtain expected values of request waiting durations of a plurality of connection requests in at least one historical time period before a first time period, wherein each expected value is an expected value of the request waiting duration of the plurality of connection requests in one historical time period, which is influenced by the connection timeout of the historical time period; adjusting the connection timeout time of the first time period based on a comparison result of the expected value and a preset threshold. According to the embodiment of the invention, the connection timeout time of the first time period after the historical time period can be adjusted through the comparison result of the expected value of the request waiting time of the connection request of the historical time period and the preset threshold. When the expected value of the request waiting time period of the connection request of the history period is longer, the connection timeout time of the first period can be reduced. Therefore, the connection request in the first time period can be retried without waiting for a long time to quickly establish the network connection, and the invention improves the establishment efficiency of the network connection.
Corresponding to the above method embodiment, the embodiment of the present invention further provides a device for adjusting connection timeout.
As shown in fig. 3, a system for adjusting connection timeout provided in an embodiment of the present invention may include: the expected value obtaining unit 100 and the adjusting unit 200,
the expected value obtaining unit 100 is configured to obtain expected values of request waiting durations of a plurality of connection requests in at least one historical time period before the first time period, where each expected value is an expected value of a request waiting duration in which the plurality of connection requests in one historical time period are affected by a connection timeout time of the historical time period;
optionally, the expected value obtaining unit 100 may be specifically configured to:
for at least one historical time period prior to the first time period: obtaining the number of connection requests and request waiting time for ending the request process in the historical time period, obtaining the number of blocked connection requests and request waiting time in the historical time period, and calculating and obtaining expected values of the request waiting time of a plurality of connection requests in the historical time period according to the obtained number of connection requests and the request waiting time, wherein the connection requests for ending the request process and the blocked connection requests do not include retried connection requests.
Wherein the expected value obtaining unit 100 may be specifically used for obtaining the expected value according to a formula
Calculating and obtaining an expected value r of request waiting time lengths of a plurality of connection requests in the historical time period, wherein N is the number of the connection requests for ending the request process in the historical time period, and N is N1+N2,N1The number of connection requests, t, for which the request process is ended due to the request wait time reaching the connection timeout time of the history period within the history periodiA request waiting time length of the ith connection request for ending the request process due to the request waiting time length reaching the connection timeout time of the historical time period in the historical time period, i is a connection due to the request waiting time length reaching the historical time period in the historical time periodNumber of connection requests ending the request process by a timeout, N2The number of connection requests, t, for which the request process ended due to network connection establishment within the historical period of timejA request waiting time for the jth connection request within the history period for ending the request procedure due to network connection establishment, j being the number of connection requests within the history period for ending the request procedure due to network connection establishment, M being the number of blocked connection requests within the history period, tkThe request waiting time of the blocked kth connection request in the historical time period is k, k is the serial number of the blocked connection request in the historical time period, i, j and k are natural numbers, w1Weight, w, of average request waiting time of connection request for ending request process in the history period2The average request wait time of the blocked connection requests in the historical period of time.
The adjusting unit 200 is configured to adjust the connection timeout time of the first time period based on a comparison result between the expected value and a preset threshold.
Optionally, the preset threshold includes a first preset threshold, and the adjusting unit 200 may be specifically configured to:
and comparing each expected value in the continuous historical time periods with the first preset threshold respectively, and adjusting the connection overtime time of the first time period when each expected value in the continuous historical time periods with the preset number is greater than the first preset threshold.
Optionally, the preset threshold includes a second preset threshold, and the adjusting unit 200 may be specifically configured to:
and comparing the obtained expected values with a second preset threshold respectively, and adjusting the connection timeout time of the first time period when at least one expected value is greater than the second preset threshold.
Optionally, the preset threshold includes a first preset threshold and a second preset threshold, and the adjusting unit 200 may be specifically configured to:
comparing each expected value in a continuous preset number of historical time periods with the first preset threshold value respectively, and comparing each obtained expected value with the second preset threshold value respectively, wherein the first preset threshold value is smaller than the second preset threshold value;
and when at least one of the obtained expected values is greater than the second preset threshold value, or the expected values in the continuous preset number of historical time periods are greater than the first preset threshold value, adjusting the connection timeout time of the first time period.
The adjusting unit 200 may specifically set to adjust the connection timeout time of the first time period as follows: and adjusting the connection timeout time of the first time period to be a preset multiple of the average value of the connection timeout times of the at least one historical time period, wherein the preset multiple is smaller than 1 time.
The device for adjusting the connection timeout time can obtain the expected values of the request waiting time lengths of a plurality of connection requests in at least one historical time period before the first time period, wherein each expected value is the expected value of the request waiting time length of the plurality of connection requests in one historical time period, which is influenced by the connection timeout time of the historical time period; adjusting the connection timeout time of the first time period based on a comparison result of the expected value and a preset threshold. According to the embodiment of the invention, the connection timeout time of the first time period after the historical time period can be adjusted through the comparison result of the expected value of the request waiting time of the connection request of the historical time period and the preset threshold. When the expected value of the request waiting time period of the connection request of the history period is longer, the connection timeout time of the first period can be reduced. Therefore, the connection request in the first time period can be retried without waiting for a long time to quickly establish the network connection, and the invention improves the establishment efficiency of the network connection.
The device for adjusting the connection timeout time comprises a processor and a memory, wherein the expected value obtaining unit 100, the adjusting unit 200 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can set one or more, and the connection timeout time is adjusted by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium, on which a program is stored, where the program, when executed by a processor, implements the method for adjusting connection timeout time.
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for adjusting the connection timeout time is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
obtaining expected values of request waiting time lengths of a plurality of connection requests in at least one historical time period before the first time period, wherein each expected value is an expected value of the request waiting time length of the plurality of connection requests in one historical time period, which is influenced by the connection timeout time of the historical time period;
adjusting the connection timeout time of the first time period based on a comparison result of the expected value and a preset threshold.
Optionally, the obtaining the expected value of the request waiting time lengths of the plurality of connection requests in at least one historical time period before the first time period includes:
for at least one historical time period prior to the first time period: obtaining the number of connection requests and request waiting time for ending the request process in the historical time period, obtaining the number of blocked connection requests and request waiting time in the historical time period, and calculating and obtaining expected values of the request waiting time of a plurality of connection requests in the historical time period according to the obtained number of connection requests and the request waiting time, wherein the connection requests for ending the request process and the blocked connection requests do not include retried connection requests.
Optionally, the calculating, according to the obtained number of connection requests and the request waiting time, to obtain the expected value of the request waiting time of the multiple connection requests in the historical time period includes:
according to the formula
Calculating and obtaining an expected value r of request waiting time lengths of a plurality of connection requests in the historical time period, wherein N is the number of the connection requests for ending the request process in the historical time period, and N is N1+N2,N1The number of connection requests, t, for which the request process is ended due to the request wait time reaching the connection timeout time of the history period within the history periodiA request wait duration for the ith connection request within the history period that ends the request process because the request wait duration reached the connection timeout time for the history period, i is a number of connection requests within the history period that end the request process because the request wait duration reached the connection timeout time for the history period, N2The number of connection requests, t, for which the request process ended due to network connection establishment within the historical period of timejA request waiting time for the jth connection request within the history period for ending the request procedure due to network connection establishment, j being the number of connection requests within the history period for ending the request procedure due to network connection establishment, M being the number of blocked connection requests within the history period, tkThe request waiting time of the blocked kth connection request in the history time period, k is the number of the blocked connection request in the history time period, i,j and k are both natural numbers, w1Weight, w, of average request waiting time of connection request for ending request process in the history period2The average request wait time of the blocked connection requests in the historical period of time.
Optionally, the preset threshold includes a first preset threshold, and the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
and comparing each expected value in the continuous historical time periods with the first preset threshold respectively, and adjusting the connection overtime time of the first time period when each expected value in the continuous historical time periods with the preset number is greater than the first preset threshold.
Optionally, the preset threshold includes a second preset threshold, and the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
and comparing the obtained expected values with a second preset threshold respectively, and adjusting the connection timeout time of the first time period when at least one expected value is greater than the second preset threshold.
Optionally, the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
comparing each expected value in a continuous preset number of historical time periods with the first preset threshold value respectively, and comparing each obtained expected value with the second preset threshold value respectively, wherein the first preset threshold value is smaller than the second preset threshold value;
and when at least one of the obtained expected values is greater than the second preset threshold value, or the expected values in the continuous preset number of historical time periods are greater than the first preset threshold value, adjusting the connection timeout time of the first time period.
Optionally, the adjusting the connection timeout time of the first time period includes:
and adjusting the connection timeout time of the first time period to be a preset multiple of the average value of the connection timeout times of the at least one historical time period, wherein the preset multiple is smaller than 1 time.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
obtaining expected values of request waiting time lengths of a plurality of connection requests in at least one historical time period before the first time period, wherein each expected value is an expected value of the request waiting time length of the plurality of connection requests in one historical time period, which is influenced by the connection timeout time of the historical time period;
adjusting the connection timeout time of the first time period based on a comparison result of the expected value and a preset threshold.
Optionally, the obtaining the expected value of the request waiting time lengths of the plurality of connection requests in at least one historical time period before the first time period includes:
for at least one historical time period prior to the first time period: obtaining the number of connection requests and request waiting time for ending the request process in the historical time period, obtaining the number of blocked connection requests and request waiting time in the historical time period, and calculating and obtaining expected values of the request waiting time of a plurality of connection requests in the historical time period according to the obtained number of connection requests and the request waiting time, wherein the connection requests for ending the request process and the blocked connection requests do not include retried connection requests.
Optionally, the calculating, according to the obtained number of connection requests and the request waiting time, to obtain the expected value of the request waiting time of the multiple connection requests in the historical time period includes:
according to the formula
Calculating and obtaining an expected value r of request waiting time lengths of a plurality of connection requests in the historical time period, wherein N is the number of the connection requests for ending the request process in the historical time period, and N is N1+N2,N1The number of connection requests, t, for which the request process is ended due to the request wait time reaching the connection timeout time of the history period within the history periodiA request wait duration for the ith connection request within the history period that ends the request process because the request wait duration reached the connection timeout time for the history period, i is a number of connection requests within the history period that end the request process because the request wait duration reached the connection timeout time for the history period, N2The number of connection requests, t, for which the request process ended due to network connection establishment within the historical period of timejA request waiting time for the jth connection request within the history period for ending the request procedure due to network connection establishment, j being the number of connection requests within the history period for ending the request procedure due to network connection establishment, M being the number of blocked connection requests within the history period, tkThe request waiting time of the blocked kth connection request in the historical time period is k, k is the serial number of the blocked connection request in the historical time period, i, j and k are natural numbers, w1Weight, w, of average request waiting time of connection request for ending request process in the history period2The average request wait time of the blocked connection requests in the historical period of time.
Optionally, the preset threshold includes a first preset threshold, and the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
and comparing each expected value in the continuous historical time periods with the first preset threshold respectively, and adjusting the connection overtime time of the first time period when each expected value in the continuous historical time periods with the preset number is greater than the first preset threshold.
Optionally, the preset threshold includes a second preset threshold, and the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
and comparing the obtained expected values with a second preset threshold respectively, and adjusting the connection timeout time of the first time period when at least one expected value is greater than the second preset threshold.
Optionally, the adjusting the connection timeout time of the first time period based on the comparison result between the expected value and the preset threshold includes:
comparing each expected value in a continuous preset number of historical time periods with the first preset threshold value respectively, and comparing each obtained expected value with the second preset threshold value respectively, wherein the first preset threshold value is smaller than the second preset threshold value;
and when at least one of the obtained expected values is greater than the second preset threshold value, or the expected values in the continuous preset number of historical time periods are greater than the first preset threshold value, adjusting the connection timeout time of the first time period.
Optionally, the adjusting the connection timeout time of the first time period includes:
and adjusting the connection timeout time of the first time period to be a preset multiple of the average value of the connection timeout times of the at least one historical time period, wherein the preset multiple is smaller than 1 time.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.