CN108737460B - Connection processing method and client - Google Patents

Connection processing method and client Download PDF

Info

Publication number
CN108737460B
CN108737460B CN201710245628.1A CN201710245628A CN108737460B CN 108737460 B CN108737460 B CN 108737460B CN 201710245628 A CN201710245628 A CN 201710245628A CN 108737460 B CN108737460 B CN 108737460B
Authority
CN
China
Prior art keywords
time
client
normal distribution
server
moment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710245628.1A
Other languages
Chinese (zh)
Other versions
CN108737460A (en
Inventor
江勇霖
周海发
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710245628.1A priority Critical patent/CN108737460B/en
Publication of CN108737460A publication Critical patent/CN108737460A/en
Application granted granted Critical
Publication of CN108737460B publication Critical patent/CN108737460B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/142Network analysis or design using statistical or mathematical methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Pure & Applied Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Algebra (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a connection processing method and a client, wherein the method comprises the following steps: the method comprises the steps that a client-side establishes a first communication connection with a server, wherein if the client-side receives first window indication information sent by the server, the client-side indicates that the client-side cannot send data to the server by means of the first communication connection; counting the time when the client receives the first window indication information within a first preset time length to obtain a time set; calculating normal distribution corresponding to the time set; and when the probability parameter corresponding to the target moment is determined to be larger than or equal to the preset value based on the normal distribution, the first communication connection between the client and the server is disconnected.

Description

Connection processing method and client
Technical Field
The present invention relates to the field of wireless communications, and in particular, to a connection processing method and a client.
Background
Apple Push Notification Service (APNS) is a technology for implementing message Push between a client and a server. The basic implementation of the APNS technology is HyperText Transfer Protocol (HTTP), and with the development of HTTP, the APNS technology has been combined with the latest version of HTTP 2.0.
When the technology of the APNS based on HTTP2.0 is implemented, at least the following problems exist: at a certain moment, the server resource corresponding to a certain communication connection is in short supply, and at this moment, the server returns indication information with the window length of 0 to the client so as to inform the client that the client does not need to send a request to the server by using the communication connection temporarily. After the client receives the indication information that the window is 0, the client does not have any other things except that the server continuously and periodically updates the window size, that is, the communication connection is in an unavailable state, and the communication connection not only additionally occupies communication resources, but also causes the pushing process to be unable to be performed normally.
Disclosure of Invention
In order to solve the foregoing technical problem, embodiments of the present invention provide a connection processing method and a client.
The connection processing method provided by the embodiment of the invention comprises the following steps:
the method comprises the steps that a client-side establishes a first communication connection with a server, wherein if the client-side receives first window indication information sent by the server, the client-side indicates that the client-side cannot send data to the server by means of the first communication connection;
counting the time when the client receives the first window indication information within a first preset time length to obtain a time set;
calculating normal distribution corresponding to the time set;
and when the probability parameter corresponding to the target moment is determined to be larger than or equal to the preset value based on the normal distribution, the first communication connection between the client and the server is disconnected.
In this embodiment of the present invention, before calculating the normal distribution corresponding to the time set, the method further includes:
counting the number of moments included in the moment set;
and when the number of the moments included in the moment set is greater than or equal to the threshold value, calculating the normal distribution corresponding to the moment set.
In this embodiment of the present invention, the calculating the normal distribution corresponding to the time set includes:
calculating an average value and a variance value corresponding to the time set based on each time in the time set;
and calculating normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, wherein the normal distribution indicates the probability parameter corresponding to each time.
In the embodiment of the present invention, the method further includes:
based on the normal distribution, determining probability parameters corresponding to target moments;
and comparing the probability parameter corresponding to the target moment with the preset value.
In the embodiment of the present invention, the method further includes:
determining a range with probability parameters larger than the preset value as a reference range based on the normal distribution;
and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
In the embodiment of the invention, the starting time of the first preset duration is T1, the ending time is T2, and T2 is greater than T1;
the method further comprises the following steps: and selecting one or more target moments from the T2 moment to the T3 moment, wherein the distance between the T3 moment and the T2 moment is less than or equal to a second preset time length, and T3 is greater than T2.
The client provided by the embodiment of the invention comprises:
the connection establishing unit is used for establishing a first communication connection with a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection;
the counting unit is used for counting the time when the client receives the first window indication information within a first preset time length to obtain a time set;
the processing unit is used for calculating normal distribution corresponding to the time set;
and the disconnection unit is used for disconnecting the first communication connection with the server when the probability parameter corresponding to the target moment is determined to be greater than or equal to the preset value based on the normal distribution.
In this embodiment of the present invention, the client further includes:
the counting unit is further configured to count the number of times included in the time set;
the processing unit is further configured to calculate a normal distribution corresponding to the time set when the number of times included in the time set is greater than or equal to the threshold value.
In an embodiment of the present invention, the processing unit includes:
the first calculating subunit is configured to calculate, based on each time in the time set, an average value and a variance value corresponding to the time set;
and the second calculating subunit is configured to calculate a normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, where the normal distribution indicates a probability parameter corresponding to each time.
In this embodiment of the present invention, the processing unit is further configured to determine a probability parameter corresponding to a target time based on the normal distribution; and comparing the probability parameter corresponding to the target moment with the preset value.
In this embodiment of the present invention, the processing unit is further configured to determine, based on the normal distribution, a range in which a probability parameter is greater than the preset value as a reference range; and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
In the embodiment of the invention, the starting time of the first preset duration is T1, the ending time is T2, and T2 is greater than T1;
the client further comprises: the selection unit is used for selecting one or more target moments between the moment T2 and the moment T3, wherein the distance between the moment T3 and the moment T2 is less than or equal to a second preset time length, and T3 is greater than T2.
In the technical scheme of the embodiment of the invention, a client establishes a first communication connection with a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection; counting the time when the client receives the first window indication information within a first preset time length to obtain a time set; calculating normal distribution corresponding to the time set; and when the probability parameter corresponding to the target moment is determined to be larger than or equal to the preset value based on the normal distribution, the first communication connection between the client and the server is disconnected. The embodiment of the invention determines the probability of receiving the indication information with the window of 0 in a future period of time in a normal distribution mode, thereby reasonably deciding which communication connections should be disconnected, avoiding the colleague of communication resource waste and ensuring the normal operation of the pushing process.
Drawings
FIG. 1 is a schematic diagram of interaction between a client and a server;
FIG. 2 is a first flowchart illustrating a connection processing method according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a time when the client receives the first window indication information according to the embodiment of the present invention;
FIG. 4 is a block diagram of a one-dimensional array according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a normal distribution curve according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a target time according to an embodiment of the present invention;
FIG. 7 is a second flowchart illustrating a connection processing method according to an embodiment of the present invention;
FIG. 8 is a third flowchart illustrating a connection processing method according to an embodiment of the present invention;
FIG. 9 is a first schematic structural diagram of a client according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a client according to an embodiment of the present invention.
Detailed Description
So that the manner in which the features and aspects of the embodiments of the present invention can be understood in detail, a more particular description of the embodiments of the invention, briefly summarized above, may be had by reference to the embodiments, some of which are illustrated in the appended drawings.
Fig. 1 is an interaction diagram between a client and a server, and as shown in fig. 1, a communication connection is established between the client and the server, and in an embodiment, the communication connection between the client and the server is an HTTP2.0 connection. Since the HTTP2.0 connection is implemented based on a Transmission Control Protocol (TCP), that is, the HTTP2.0 implements data Transmission based on the TCP, the establishment of the communication connection between the client and the server needs to be implemented by three handshaking operations. After the client establishes a communication connection with the server, the client may send a request to the server by using the established communication connection, for example, request data related to a certain web page, where the data requested by the client may be pictures, texts, animations, and so on. And when the server receives the request sent by the client, the server returns corresponding data to the client. The above process is a process of normal interaction between the client and the server. However, at some point in time, the server experiences resource starvation for the established communication connection, such as: the server cannot receive the request sent by the client, and cannot process the received request, in this case, the server returns to the client an indication information that the window is 0, where the size of the window represents the number of requests that the client can send without waiting for the confirmation of the server, and if the client receives the indication information that the window is 0, it indicates that the client cannot continue to generate requests to the server (as indicated by the cross in the figure), and needs to wait until the window is updated to be greater than 0. At this time, the communication connection established between the client and the server is in an unavailable state.
In order to make the communication connection available, the occurrence of a communication connection of low quality should be avoided as much as possible. One manifestation of a low quality communication connection is: the event with the window 0 always occurs, that is, the client always receives the indication information of the window 0 sent by the server, so that the current communication connection always wastes time to wait for the update of the window size. Therefore, if a communication connection is detected to continuously generate an event with a window of 0, the communication connection is timely disconnected. After the communication connection is broken, the IP of the client can be replaced to establish a new communication connection with the server again.
How to detect the event that the communication connection continuously occurs with the window of 0 needs to be detected through an index, if the index is too sensitive, disconnection and reconnection of the communication connection are frequently caused, which also reduces the utilization rate of the communication connection. Therefore, the embodiment of the present invention provides a reasonable detection index to determine whether the current communication connection has become poor and is highly likely to maintain the poor state for a future period of time, and if so, the communication connection needs to be disconnected and reestablished. If only occasional network fluctuations of the communication connection occur, no processing is done.
The detection indexes of the embodiment of the invention are as follows: for a period of time, it is detected whether the event with the window of 0 continues to occur for a certain number of times, and it is predicted that such an event is still likely to continue to occur for a future period of time.
Fig. 2 is a first schematic flowchart of a connection processing method according to an embodiment of the present invention, and as shown in fig. 2, the connection processing method includes the following steps:
step 201: the method comprises the steps that a first communication connection is established between a client and a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection.
In the embodiment of the invention, the client can be a mobile phone, a notebook, a desktop and other terminal equipment.
In the embodiment of the present invention, the first communication connection established between the client and the server may be an HTTP2.0 connection. And a first communication connection is established between the client and the server through three-way handshake. Here, one first communication connection may be established between the client and the server, or a plurality of first communication connections may be established. If a plurality of first communication connections are established between the client and the server, each first communication connection can be processed by the scheme of the embodiment of the invention.
In the embodiment of the present invention, the first window indication information refers to indication information that a window is 0, and certainly, the first window indication information is not limited to the indication information that the window is 0, and may also be indication information that the window is a certain smaller value, for example, the window is indication information that the window is less than or equal to a preset value, where the preset value is 5.
In the embodiment of the present invention, if the client receives the first window indication information sent by the server, it indicates that the client cannot send data to the server by using the first communication connection.
For example: when the client receives the indication information that the window sent by the server is 0, the client cannot send data to the server by using the first communication connection, otherwise, the server is overloaded to work, the problem of downtime is caused, or the server discards the data sent by the client.
Step 202: and counting the time when the client receives the first window indication information within a first preset time length to obtain a time set.
In the embodiment of the present invention, the starting time of the first preset time duration is T1, the ending time is T2, and T2 is greater than T1.
In an embodiment, a time point when the client receives the first window indication information for the first time is taken as a time T1, and a time set is obtained by counting the times when the first window indication information is received within M consecutive time periods from a time T1, where T1+ M is T2, and the unit of the time and the time period may be seconds, minutes, hours, and the like.
As shown in fig. 3, after the client establishes the first communication connection with the server, when the client receives the first window indication information for the first time, it records that the current time is t0(ii) a When the first window indication information is received for the second time, the current moment is recorded as t1(ii) a When the first window indication information is received for the third time, the current time is recorded as t2(ii) a When the first window indication information is received for the fourth time, the current time is recorded as t3(ii) a When the first window indication information is received for the fifth time, the current time is recorded as t4. Wherein, t0The time is the time T1 in the scheme4The time is T2 in the above scheme.
In the embodiment of the invention, the client stores each time in the time set through the array. As shown in fig. 4, fig. 4 is a structural diagram of a one-dimensional array, and the client may store the counted time into the one-dimensional array by using a pointer.
Step 203: and calculating normal distribution corresponding to the time set.
In the embodiment of the invention, based on each time in the time set, the average value and the variance value corresponding to the time set are calculated; and calculating normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, wherein the normal distribution indicates the probability parameter corresponding to each time.
For example: the time set comprises the following times: t is t0、t1、t2、t3、t4Calculating an average value (μ) corresponding to the time set by the following formula:
Figure BDA0001270559320000071
calculating a variance value (sigma) corresponding to the time set2) Obtained by the following formula:
Figure BDA0001270559320000072
calculating the normal distribution (f (t)) corresponding to the time set by the following formula:
Figure BDA0001270559320000073
fig. 5 is a schematic diagram of a normal distribution curve, and as shown in fig. 5, a probability parameter corresponding to each time may be determined by the normal distribution curve, where the probability parameter indicates a possibility that the first window indication information is received at the time.
Step 204: and when the probability parameter corresponding to the target moment is determined to be larger than or equal to the preset value based on the normal distribution, the first communication connection between the client and the server is disconnected.
In the embodiment of the invention, one or more target moments are selected from the moment T2 to the moment T3, wherein the distance between the moment T3 and the moment T2 is less than or equal to a second preset time length, and T3 is greater than T2.
As shown in fig. 6, the times when the client receives the first window indication information between time T1 and time T2 are: t is t0、t1、t2、t3、t4It may be desirable to select one or more target times, e.g. two target times T, within a relatively short time frame after time T25And t6And substituting the two moments into the formula (3) to obtain corresponding probability parameters, and then judging whether the probability parameters are greater than or equal to preset values. Here, the preset value may be a minimum value such as three thousandths, and if the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the probability that the target time receives the first window indication information is maximum, and it is considered that the first window indication information will be received.
In the embodiment of the present invention, if it is determined based on the normal distribution that the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the client will receive the first window indication information in the future, in this case, the first communication connection needs to be disconnected, and after the first communication connection is disconnected, the second communication connection may be reestablished to continue to implement message pushing between the client and the server. If the probability parameter corresponding to the target moment is smaller than the preset value, it indicates that the client will not receive the first window indication information in the future, and in this case, the first communication connection needs to be maintained.
According to the technical scheme of the embodiment of the invention, the time stamp record of the event with the occurrence window of 0 in a period of time is collected, the normal distribution curve is calculated, and whether the event with the future window of 0 still occurs is judged through the normal distribution curve, so that the communication connection is reasonably maintained.
Fig. 7 is a second flowchart illustrating a connection processing method according to an embodiment of the present invention, and as shown in fig. 7, the connection processing method includes the following steps:
step 701: the method comprises the steps that a first communication connection is established between a client and a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection.
In the embodiment of the invention, the client can be a mobile phone, a notebook, a desktop and other terminal equipment.
In this embodiment of the present invention, the first communication connection established between the client and the server may be an HTTP2.0 connection. And a first communication connection is established between the client and the server through three-way handshake. Here, one first communication connection may be established between the client and the server, or a plurality of first communication connections may be established. If a plurality of first communication connections are established between the client and the server, each first communication connection can be processed by the scheme of the embodiment of the invention.
In the embodiment of the present invention, the first window indication information refers to indication information that a window is 0, and certainly, the first window indication information is not limited to the indication information that the window is 0, and may also be indication information that the window is a certain smaller value, for example, the window is indication information that the window is less than or equal to a preset value, where the preset value is 5.
In the embodiment of the present invention, if the client receives the first window indication information sent by the server, it indicates that the client cannot send data to the server by using the first communication connection.
For example: when the client receives the indication information that the window sent by the server is 0, the client cannot send data to the server by using the first communication connection, otherwise, the server is overloaded to work, the problem of downtime is caused, or the server discards the data sent by the client.
Step 702: and counting the time when the client receives the first window indication information within a first preset time length to obtain a time set.
In the embodiment of the present invention, the starting time of the first preset time duration is T1, the ending time is T2, and T2 is greater than T1.
In an embodiment, a time point when the client receives the first window indication information for the first time is taken as a time T1, and a time set is obtained by counting the times when the first window indication information is received within M consecutive time periods from a time T1, where T1+ M is T2, and the unit of the time and the time period may be seconds, minutes, hours, and the like.
As shown in fig. 3, after the client establishes the first communication connection with the server, when the client receives the first window indication information for the first time, it records that the current time is t0(ii) a When the first window indication information is received for the second time, the current moment is recorded as t1(ii) a When the first window indication information is received for the third time, the current time is recorded as t2(ii) a When the first window indication information is received for the fourth time, the current time is recorded as t3(ii) a When the first window indication information is received for the fifth time, the current time is recorded as t4. Wherein, t0The time is the time T1 in the scheme4The time is T2 in the above scheme.
In the embodiment of the invention, the client stores each time in the time set through the array. As shown in fig. 4, fig. 4 is a structural diagram of a one-dimensional array, and the client may store the counted time into the one-dimensional array by using a pointer.
Step 703: and judging whether the number of the time points included in the time point set is greater than or equal to a threshold value, if so, executing step 705, and if not, executing step 704.
Here, if the number of times included in the time set is greater than or equal to the threshold value, it indicates that the first window indication information is frequently received within the preset duration, and it is necessary to predict whether the first window indication information is received at a future time through normal distribution.
Step 704: the first communication connection is maintained.
Here, maintaining the first communication connection means: the first communication connection is maintained.
Step 705: and calculating normal distribution corresponding to the time set.
In the embodiment of the invention, based on each time in the time set, the average value and the variance value corresponding to the time set are calculated; and calculating normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, wherein the normal distribution indicates the probability parameter corresponding to each time.
Fig. 5 is a schematic diagram of a normal distribution curve, and as shown in fig. 5, a probability parameter corresponding to each time may be determined by the normal distribution curve, where the probability parameter indicates a possibility that the first window indication information is received at the time.
Step 706: judging whether the probability parameter corresponding to the target moment is greater than or equal to a preset value or not based on the normal distribution; if yes, go to step 707; if not, step 704 is performed.
In the embodiment of the invention, one or more target moments are selected from the moment T2 to the moment T3, wherein the distance between the moment T3 and the moment T2 is less than or equal to a second preset time length, and T3 is greater than T2.
As shown in fig. 6, the times when the client receives the first window indication information between time T1 and time T2 are: t is t0、t1、t2、t3、t4It may be desirable to select one or more target times within a relatively short time period after time T2, for example, to select two target times T5And t6Substituting the two moments into the formula (3) to obtain corresponding probability parameters, and then judging whether the probability parameters are larger than or equal to preset values. Here, the preset value may be a minimum value such as three thousandths, and if the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the probability that the first window indication information is received at the target time is maximum, and it is considered that the first window indication information will be received.
Step 707: the client disconnects the first communication connection with the server.
In the embodiment of the present invention, if it is determined based on the normal distribution that the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the client will receive the first window indication information in the future, in this case, the first communication connection needs to be disconnected, and after the first communication connection is disconnected, the second communication connection may be reestablished to continue to implement message pushing between the client and the server. If the probability parameter corresponding to the target moment is smaller than the preset value, it indicates that the client will not receive the first window indication information in the future, and in this case, the first communication connection needs to be maintained.
According to the technical scheme of the embodiment of the invention, the time stamp record of the event with the occurrence window of 0 in a period of time is collected, the normal distribution curve is calculated, and whether the event with the future window of 0 still occurs is judged through the normal distribution curve, so that the communication connection is reasonably maintained.
Fig. 8 is a third schematic flowchart of a connection processing method according to an embodiment of the present invention, and as shown in fig. 8, the connection processing method includes the following steps:
step 801: the method comprises the steps that a first communication connection is established between a client and a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection.
In the embodiment of the invention, the client can be a mobile phone, a notebook, a desktop and other terminal equipment.
In this embodiment of the present invention, the first communication connection established between the client and the server may be an HTTP2.0 connection. And a first communication connection is established between the client and the server through three-way handshake. Here, one first communication connection may be established between the client and the server, or a plurality of first communication connections may be established. If a plurality of first communication connections are established between the client and the server, each first communication connection can be processed by the scheme of the embodiment of the invention.
In the embodiment of the present invention, the first window indication information refers to indication information that a window is 0, and certainly, the first window indication information is not limited to the indication information that the window is 0, and may also be indication information that the window is a certain smaller value, for example, the window is indication information that the window is less than or equal to a preset value, where the preset value is 5.
In the embodiment of the present invention, if the client receives the first window indication information sent by the server, it indicates that the client cannot send data to the server by using the first communication connection.
For example: when the client receives the indication information that the window sent by the server is 0, the client cannot send data to the server by using the first communication connection, otherwise, the server is overloaded to work, the problem of downtime is caused, or the server discards the data sent by the client.
Step 802: and counting the time when the client receives the first window indication information within a first preset time length to obtain a time set.
In the embodiment of the present invention, the starting time of the first preset time duration is T1, the ending time is T2, and T2 is greater than T1.
In an embodiment, a time point when the client receives the first window indication information for the first time is taken as a time T1, and a time set is obtained by counting the times when the first window indication information is received within M consecutive time periods from a time T1, where T1+ M is T2, and the unit of the time and the time period may be seconds, minutes, hours, and the like.
As shown in fig. 3, after the client establishes the first communication connection with the server, when the client receives the first window indication information for the first time, it records that the current time is t0(ii) a When the first window indication information is received for the second time, the current moment is recorded as t1(ii) a When the first window indication information is received for the third time, the current time is recorded as t2(ii) a When the first window indication information is received for the fourth time, the current time is recorded as t3(ii) a When the first window indication information is received for the fifth time, the current time is recorded as t4. Wherein, t0The time is the time T1 in the scheme4The time is T2 in the above scheme.
In the embodiment of the invention, the client stores each time in the time set through the array. As shown in fig. 4, fig. 4 is a structural diagram of a one-dimensional array, and the client may store the counted time into the one-dimensional array by using a pointer.
Step 803: and calculating normal distribution corresponding to the time set.
In the embodiment of the invention, based on each time in the time set, the average value and the variance value corresponding to the time set are calculated; and calculating normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, wherein the normal distribution indicates the probability parameter corresponding to each time.
Fig. 5 is a schematic diagram of a normal distribution curve, and as shown in fig. 5, a probability parameter corresponding to each time may be determined by the normal distribution curve, where the probability parameter indicates a possibility that the first window indication information is received at the time.
Step 804: determining a range with probability parameters larger than the preset value as a reference range based on the normal distribution; and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
In the embodiment of the invention, one or more target moments are selected from the moment T2 to the moment T3, wherein the distance between the moment T3 and the moment T2 is less than or equal to a second preset time length, and T3 is greater than T2.
As shown in fig. 6, the times when the client receives the first window indication information between time T1 and time T2 are: t is t0、t1、t2、t3、t4It may be desirable to select one or more target times, e.g. two target times T, within a relatively short time frame after time T25And t6And substituting the two moments into the formula (3) to obtain corresponding probability parameters, and then judging whether the probability parameters are greater than or equal to preset values. Here, the preset value may be a minimum value such as three thousandths, and if the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the probability that the target time receives the first window indication information is maximum, and it is considered that the first window indication information will be received.
Suppose that the mean and variance values for the time set are μ and σ, respectively2From the normal distribution characteristics, the probability outside the (μ -3 σ, μ +3 σ) interval is three thousandths, and is considered to be three thousandths in practiceAre unlikely events to occur. Therefore, if a certain time in the future is beyond (μ -3 σ, μ +3 σ), the client is considered to not receive the first window indication information, which of course also means that the probability that the client receives the first window indication information is less than three thousandths. On the contrary, if a certain time in the future is within (μ -3 σ, μ +3 σ), the client is considered to receive the first window indication information, which of course also means that the probability that the client receives the first window indication information is greater than or equal to three thousandths.
Step 805: and when the probability parameter corresponding to the target moment is determined to be larger than or equal to the preset value based on the normal distribution, the first communication connection between the client and the server is disconnected.
In the embodiment of the present invention, if it is determined based on the normal distribution that the probability parameter corresponding to the target time is greater than or equal to the preset value, it indicates that the client will receive the first window indication information in the future, in this case, the first communication connection needs to be disconnected, and after the first communication connection is disconnected, the second communication connection may be reestablished to continue to implement message pushing between the client and the server. If the probability parameter corresponding to the target moment is smaller than the preset value, it indicates that the client will not receive the first window indication information in the future, and in this case, the first communication connection needs to be maintained.
According to the technical scheme of the embodiment of the invention, the time stamp record of the event with the occurrence window of 0 in a period of time is collected, the normal distribution curve is calculated, and whether the event with the future window of 0 still occurs is judged through the normal distribution curve, so that the communication connection is reasonably maintained.
In addition, the embodiment of the invention also comprises the following scheme: and counting the time of each period in the preset time, and if the counted time number in each period is greater than a threshold value, disconnecting the communication connection and restarting the communication connection.
Fig. 9 is a schematic structural composition diagram of a client according to an embodiment of the present invention, as shown in fig. 9, the client includes:
a connection establishing unit 91, configured to establish a first communication connection with a server, where if the client receives first window indication information sent by the server, it indicates that the client cannot send data to the server using the first communication connection;
the counting unit 92 is configured to count, within a first preset duration, a time at which the client receives the first window indication information, so as to obtain a time set;
a processing unit 93, configured to calculate a normal distribution corresponding to the time set;
a disconnecting unit 94, configured to disconnect the first communication connection with the server when it is determined, based on the normal distribution, that the probability parameter corresponding to the target time is greater than or equal to the preset value.
Those skilled in the art will understand that the implementation functions of each unit in the client shown in fig. 9 can be understood by referring to the related description of the processing method of the foregoing connection. The functions of the units in the client shown in fig. 9 may be implemented by a program running on a processor, or may be implemented by specific logic circuits.
Fig. 10 is a schematic structural composition diagram of a client according to an embodiment of the present invention, and as shown in fig. 10, the client includes:
a connection establishing unit 101, configured to establish a first communication connection with a server, where if the client receives first window indication information sent by the server, it indicates that the client cannot send data to the server using the first communication connection;
the counting unit 102 is configured to count, within a first preset duration, a time at which the client receives the first window indication information, so as to obtain a time set;
a processing unit 103, configured to calculate a normal distribution corresponding to the time set;
a disconnection unit 104, configured to disconnect the first communication connection with the server when it is determined, based on the normal distribution, that the probability parameter corresponding to the target time is greater than or equal to the preset value.
In this embodiment of the present invention, the counting unit 102 is further configured to count a number of times included in the time set;
the processing unit 103 is further configured to calculate a normal distribution corresponding to the time set when the number of times included in the time set is greater than or equal to the threshold value.
In this embodiment of the present invention, the processing unit 103 includes:
a first calculating subunit 1031, configured to calculate, based on each time in the time set, an average value and a variance value corresponding to the time set;
a second calculating subunit 1032, configured to calculate a normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, where the normal distribution indicates a probability parameter corresponding to each time.
In this embodiment of the present invention, the processing unit 103 is further configured to determine a probability parameter corresponding to a target time based on the normal distribution; and comparing the probability parameter corresponding to the target moment with the preset value.
In this embodiment of the present invention, the processing unit 103 is further configured to determine, based on the normal distribution, a range in which a probability parameter is greater than the preset value as a reference range; and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
In the embodiment of the present invention, the starting time of the first preset duration is T1, the ending time is T2, and T2 is greater than T1;
the client further comprises: the selecting unit 105 is configured to select one or more target times between the time T2 and a time T3, where the time T3 is less than or equal to a second preset time length from the time T2, and T3 > T2.
Those skilled in the art will understand that the implementation functions of each unit in the client shown in fig. 10 can be understood by referring to the related description of the processing method of the foregoing connection. The functions of the units in the client shown in fig. 10 may be implemented by a program running on a processor, or may be implemented by specific logic circuits.
The technical schemes described in the embodiments of the present invention can be combined arbitrarily without conflict.
In the several embodiments provided in the present invention, it should be understood that the disclosed method and intelligent device may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one second processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.

Claims (13)

1. A method for processing a connection, the method comprising:
the method comprises the steps that a client-side establishes a first communication connection with a server, wherein if the client-side receives first window indication information sent by the server, the client-side indicates that the client-side cannot send data to the server by means of the first communication connection;
counting the time when the client receives the first window indication information within a first preset time length to obtain a time set;
calculating normal distribution corresponding to the time set;
when the probability parameter corresponding to the target moment determined based on the normal distribution is larger than or equal to a preset value, the first communication connection between the client and the server is disconnected; the preset value represents the probability that the client receives the first window indication information at the target moment.
2. The connection processing method according to claim 1, wherein before the calculating the normal distribution corresponding to the time set, the method further comprises:
counting the number of moments included in the moment set;
and when the number of the moments included in the moment set is greater than or equal to a threshold value, calculating normal distribution corresponding to the moment set.
3. The connection processing method according to claim 1, wherein the calculating a normal distribution corresponding to the time set includes:
calculating an average value and a variance value corresponding to the time set based on each time in the time set;
and calculating normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, wherein the normal distribution indicates the probability parameter corresponding to each time.
4. The method of processing a connection according to claim 1, further comprising:
determining probability parameters corresponding to target moments based on the normal distribution;
and comparing the probability parameter corresponding to the target moment with the preset value.
5. The method of processing a connection according to claim 3, further comprising:
determining a range with probability parameters larger than the preset value as a reference range based on the normal distribution;
and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
6. The connection processing method according to any one of claims 1 to 5, wherein the starting time of the first preset time period is T1, the ending time is T2, and T2 > T1;
the method further comprises the following steps: and selecting one or more target moments from the T2 moment to the T3 moment, wherein the distance between the T3 moment and the T2 moment is less than or equal to a second preset time length, and T3 is greater than T2.
7. A client, the client comprising:
the connection establishing unit is used for establishing a first communication connection with a server, wherein if the client receives first window indication information sent by the server, the client indicates that the client cannot send data to the server by using the first communication connection;
the counting unit is used for counting the time when the client receives the first window indication information within a first preset time length to obtain a time set;
the processing unit is used for calculating normal distribution corresponding to the time set;
a disconnection unit, configured to disconnect the first communication connection with the server when a probability parameter corresponding to the target time determined based on the normal distribution is greater than or equal to a preset value; the preset value represents the probability that the client receives the first window indication information at the target moment.
8. The client of claim 7,
the counting unit is further configured to count the number of times included in the time set;
the processing unit is further configured to calculate a normal distribution corresponding to the time set when the number of times included in the time set is greater than or equal to a threshold value.
9. The client of claim 7, wherein the processing unit comprises:
the first calculating subunit is configured to calculate, based on each time in the time set, an average value and a variance value corresponding to the time set;
and the second calculating subunit is configured to calculate a normal distribution corresponding to the time set based on the average value and the variance value corresponding to the time set, where the normal distribution indicates a probability parameter corresponding to each time.
10. The client according to claim 7, wherein the processing unit is further configured to determine a probability parameter corresponding to a target time based on the normal distribution; and comparing the probability parameter corresponding to the target moment with the preset value.
11. The client according to claim 9, wherein the processing unit is further configured to determine, based on the normal distribution, a range in which a probability parameter is greater than the preset value as a reference range; and when the target time is within the reference range, determining that the probability parameter corresponding to the target time is greater than or equal to a preset value.
12. The client according to any one of claims 7 to 11, wherein the starting time of the first preset duration is T1, the ending time is T2, and T2 > T1;
the client further comprises: the selecting unit is used for selecting one or more target moments from the T2 moment to the T3 moment, wherein the T3 moment is less than or equal to a second preset time length from the T2 moment, and T3 is greater than T2.
13. An electronic device, comprising:
a memory for storing executable instructions;
a processor for implementing the processing method of a connection of any one of claims 1 to 6 when executing executable instructions stored in the memory.
CN201710245628.1A 2017-04-14 2017-04-14 Connection processing method and client Active CN108737460B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710245628.1A CN108737460B (en) 2017-04-14 2017-04-14 Connection processing method and client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710245628.1A CN108737460B (en) 2017-04-14 2017-04-14 Connection processing method and client

Publications (2)

Publication Number Publication Date
CN108737460A CN108737460A (en) 2018-11-02
CN108737460B true CN108737460B (en) 2022-06-07

Family

ID=63924557

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710245628.1A Active CN108737460B (en) 2017-04-14 2017-04-14 Connection processing method and client

Country Status (1)

Country Link
CN (1) CN108737460B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112423398B (en) * 2020-11-24 2022-07-26 新华三技术有限公司 Method, apparatus, electronic device and medium for radio resource management
CN113692022B (en) * 2021-07-09 2024-06-11 深圳市赛云数据有限公司 Operator communication system based on empty channel pre-judgment and utilization

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1909507A (en) * 2006-07-04 2007-02-07 华为技术有限公司 Method and system for message transfer
CN103281569A (en) * 2013-04-10 2013-09-04 深圳康佳通信科技有限公司 Video transmission-oriented network bandwidth detection and prediction method and system
CN103516766A (en) * 2012-06-30 2014-01-15 北京神州泰岳软件股份有限公司 Method and system of communication between client-side and application server
CN103906130A (en) * 2014-03-18 2014-07-02 重庆邮电大学 Congestion control method with node state estimation function
CN104995899A (en) * 2013-01-11 2015-10-21 微软技术许可有限责任公司 Server load management

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6019778B2 (en) * 2012-06-07 2016-11-02 富士通株式会社 Operation monitoring device, method for determining cause event in operation monitoring device, and information communication network system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1909507A (en) * 2006-07-04 2007-02-07 华为技术有限公司 Method and system for message transfer
CN103516766A (en) * 2012-06-30 2014-01-15 北京神州泰岳软件股份有限公司 Method and system of communication between client-side and application server
CN104995899A (en) * 2013-01-11 2015-10-21 微软技术许可有限责任公司 Server load management
CN103281569A (en) * 2013-04-10 2013-09-04 深圳康佳通信科技有限公司 Video transmission-oriented network bandwidth detection and prediction method and system
CN103906130A (en) * 2014-03-18 2014-07-02 重庆邮电大学 Congestion control method with node state estimation function

Also Published As

Publication number Publication date
CN108737460A (en) 2018-11-02

Similar Documents

Publication Publication Date Title
CN104104707B (en) Webpage data update method, terminal, cache server and system
CN107315825B (en) Index updating system, method and device
CN110858843B (en) Service request processing method and device and computer readable storage medium
US9596313B2 (en) Method, terminal, cache server and system for updating webpage data
CN115004673B (en) Message pushing method, device, electronic equipment and computer readable medium
CN106790696B (en) Message transmission method and device
WO2014187220A1 (en) Electronic device, storage medium and file transferrting method
CN111343045B (en) Method and device for adjusting heartbeat frequency
WO2014187219A1 (en) Electronic device, storage medium and file transferrting method
CN109936613B (en) Disaster recovery method and device applied to server
CN108377247B (en) Message pushing method and device
US20090068989A1 (en) Method for exchanging requests between the computer application of a mobile terminal and an instantaneous messaging server
CN108880972B (en) Information processing method, server and terminal
CN112650606A (en) Message processing method, device and system, electronic equipment and storage medium
CN113347269A (en) Data updating method of industrial system, electronic equipment and storage medium
CN109194744B (en) Data transmission method and device, storage medium and monitoring equipment
CN108737460B (en) Connection processing method and client
CN109428926B (en) Method and device for scheduling task nodes
US10938773B2 (en) Method and apparatus for synchronizing contact information and medium
CN113452770B (en) Data synchronization method, device, computer equipment and storage medium
CN110071952B (en) Service call quantity control method and device
US20220015016A1 (en) Mechanism to provide updates to nb-iot devices
CN111162952A (en) Equipment fault tolerance method and device
US11212220B2 (en) Optimized reconciliation in a controller-switch network
CN112751743A (en) Message sending exception processing method, message sending device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant