WO2022267739A1 - 一种连接探测方法、客户端与服务器 - Google Patents

一种连接探测方法、客户端与服务器 Download PDF

Info

Publication number
WO2022267739A1
WO2022267739A1 PCT/CN2022/092770 CN2022092770W WO2022267739A1 WO 2022267739 A1 WO2022267739 A1 WO 2022267739A1 CN 2022092770 W CN2022092770 W CN 2022092770W WO 2022267739 A1 WO2022267739 A1 WO 2022267739A1
Authority
WO
WIPO (PCT)
Prior art keywords
connection
server
client
period
detection
Prior art date
Application number
PCT/CN2022/092770
Other languages
English (en)
French (fr)
Inventor
梁乾灯
康娇
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022267739A1 publication Critical patent/WO2022267739A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Definitions

  • the present application relates to the technical field of terminals, and in particular to a connection detection method, a client and a server.
  • a client such as a mobile terminal connects to a server (such as an application server), and then accesses content on the server.
  • a server such as an application server
  • a TCP connection or a QUIC connection is established between the client and the server, then sending and receiving emails, file transfers, instant messaging, etc. on the client depend on the TCP connection or the QUIC connection.
  • the client when the connection between the client and the server is abnormal, in order to restore the connection as soon as possible, the client will continuously detect whether the connection is restored to the server at a locally configured cycle.
  • This method of continuous detection by the client in a local cycle can easily increase the processing pressure on the server and cause the server to crash.
  • the purpose of this application is to provide a connection detection method, a client and a server, which can help alleviate the processing pressure on the server and prevent the server from collapsing due to excessive pressure.
  • a connection detection method is provided. This method is applied to the client.
  • the client is, for example, a mobile phone, a tablet computer, a notebook computer, etc., which are not limited in this embodiment of the present application.
  • the client determines that the connection with the server is abnormal; the client sends detection information to the server in a first cycle, and the detection information is used to detect whether the connection is restored; wherein, the first cycle is the same as the
  • the current traffic volume of the server is adapted and/or related to the current connection state of the connection. That is to say, in the embodiment of the present application, when the connection between the client and the server is abnormal, the period of the detection information sent by the client to the server is adapted to the current traffic of the server.
  • the client when the current business volume of the server is high, the client sends detection information at a relatively small cycle to avoid frequent sending of detection information to the server and causing the server to collapse due to excessive pressure; when the current business volume of the server is low, the client The end sends detection information at a relatively large period to ensure that the connection is restored as soon as possible.
  • connection between the client and the server may be a UDP-based connection.
  • a TCP connection a QUIC connection, etc.; or, it may also be a connection based on other protocols (different from UDP, TCP, and QUIC) that will appear as technology evolves in the future, which is not limited in this embodiment of the present application.
  • the detection information is used to detect whether the connection is restored, and may include: detecting whether at least one of the connection congestion, transmission rate, packet loss rate, etc. returns to normal.
  • the restoration of the congestion situation to normal includes that the number of packets waiting to be processed received by the server on the connection is less than a preset number.
  • Returning the transmission rate to normal includes that the transmission rate is greater than threshold 1 or within a preset range.
  • the return of the packet loss rate to normal includes that the packet loss rate is less than threshold 2 or within a preset range.
  • determining that the connection between the client and the server is abnormal includes: determining that the connection is abnormal when the connection meets at least one of the following conditions; the conditions include: The server response delay is greater than the first threshold, the data transmission rate is less than the second threshold, and the packet loss rate is greater than the third threshold.
  • the response delay of the server is long or the data transmission efficiency is low, user experience will be affected. For example, when a user uses a mobile phone (client) to search for content on the Internet, no result has been found because the response time of the server is prolonged or the data transmission efficiency is low, or the mobile phone plays online video, because the response time of the server is prolonged or the data transmission efficiency is low Compare Caton and so on.
  • a high packet loss rate will also affect user experience, such as network resources (pictures, videos, etc.) requested by users, but due to the high packet loss rate, the resources returned by the server are inaccurate or cannot be opened.
  • the client detects that the response delay of the server is large, the data transmission rate is small, and the packet loss rate is large, it determines that the connection with the server is abnormal, and can start detection to restore the connection as soon as possible , to ensure the user's network experience.
  • determining that the connection between the client and the server is abnormal includes: the network access mode of the client is changed; wherein the network access mode of the client is changed, including the following At least one: switch from wireless local area network to mobile communication network; or,
  • the network access mode of the client is switched from the WIFI network to the mobile communication network (4G network, 3G network or 5G network). If the connection is abnormal, you can start the detection to restore the connection as soon as possible to ensure the user's network experience.
  • the first period is adapted to the current traffic volume of the server, including at least one of the following: the first period is related to the current device access volume of the server; or,
  • the first period is related to the number of packets currently to be processed by the server; or,
  • the first period is related to the local running load of the server.
  • the period of the detection information sent by the client to the server is adapted to the current traffic of the server, so as to avoid the frequent traffic to the server when the current traffic of the server is high.
  • the end sends detection information, causing the server to collapse due to excessive pressure.
  • the first period is related to the current connection state of the connection, including: the current connection state of the connection includes: the number, frequency, duration, and response time of abnormal occurrences of the connection At least one of delay, transmission rate, and packet loss rate; the first period is directly proportional or inversely proportional to the current connection state.
  • the period of the detection information sent by the client to the server is adapted to the current connection state of the connection between the client and the server. For example, if the response time of the connection between the client and the server is long, the detection information will be sent in a relatively small period to avoid frequent sending of detection information to the server and cause the server to collapse due to excessive pressure; when the connection response time When it is short, the probe information can be sent at a larger cycle to restore the connection as soon as possible.
  • the method further includes: the client receiving configuration information sent by the server, where the configuration information includes at least one of the following:
  • the minimum detection period is used to indicate the minimum period for the client to send detection information
  • the first indication information is used to indicate whether the client starts backoff
  • Backoff parameter used to indicate the backoff rule
  • the maximum detection period is used to indicate the maximum period for the client to send the detection information; wherein, the minimum period and/or the maximum period are determined by the server according to the current traffic;
  • a valid connection used to indicate a valid connection for the configuration information
  • the second indication information is used to indicate whether the client uses other protocols to initiate detection, and the other protocols are different from the protocol corresponding to the connection;
  • a first protocol configured to instruct the client to send detection information based on the first protocol, where the first protocol is different from the protocol corresponding to the connection;
  • the parameters related to the first protocol are used to indicate the detection period supported by the first protocol.
  • the server can configure the detection period to the client, and can also configure at least one of whether to enable backoff mode, backoff parameters, maximum detection period, application connection, whether to configure an external detection protocol, and external detection protocol parameters. item.
  • the client does not need to calculate the detection period by itself, and the pressure on the client is less.
  • the detection period determined by the server itself is relatively accurate. Because the server knows the specific situation of the business volume of the local machine, it can determine the accurate detection period.
  • multiple connections are included between the client and the server, and the effective connection includes at least one of a specified connection, all connections, and a current connection; wherein, the current connection refers to the connection between the client and the server to transmit the configuration information. That is to say, the detection period configured from the server to the client can be applied to all connections between the client and the server, or a specified connection, or a current connection.
  • some connections can be detected using the connection detection method provided in this application, and some connections can be detected using an existing solution (that is, using The client performs detection locally periodically, regardless of the traffic volume of the server), which is not limited in this embodiment of the present application.
  • the connection includes a first connection and a second connection; the client receives the first cycle configured by the server through the first connection; the client determines the When an abnormality occurs in the second connection, a detection signal is sent to the server through the second connection in a second period, the detection signal is used to detect whether the second connection is restored, and the second period is equal to the first A period, or the second period is calculated according to the first period and a backoff parameter.
  • a first TCP connection and a second TCP connection are included between the client and the server.
  • the server configures the detection period (ie, the first period) to the client through the first TCP connection.
  • the client may apply the first period to the second TCP connection.
  • detection information may be sent on the second TCP connection according to the first period.
  • the server can indicate the detection cycle through a certain connection (such as the one with the best status or a pre-configured one), instead of indicating once for each connection, which is more efficient high.
  • the connection with the best status may be the connection with the least current traffic.
  • the connection includes a first connection and a second connection
  • the third cycle corresponding to the first connection is adapted to the service volume of the server on the first connection, and/or Or related to the current connection state of the first connection
  • the fourth period corresponding to the second connection is adapted to the traffic volume of the server on the second connection, and/or related to the second connection related to the current connection status.
  • the detection period corresponding to the first TCP connection is adapted to the traffic on the first TCP connection, and/or is related to the current connection state of the first TCP connection.
  • the detection period corresponding to the second TCP connection is adapted to the traffic on the second TCP connection, and/or is related to the current connection state of the second TCP connection. That is to say, when the client and the server have multiple connections, the detection period corresponding to each connection can be different.
  • the detection period of each connection is adapted to the traffic on the connection, and/or is compatible with the related to the current connection state of the connection. In this way, each connection has detection information adapted to the connection, and the granularity is finer.
  • a connection detection method is also provided. This method can be applied to the server side.
  • the server determines the current state, the current state includes the current traffic of the server, and/or, the current connection state of the connection between the server and the client; according to the current state, determine the first cycle, the The first period is used to indicate a period for the client to send detection information to the server.
  • determining the first cycle includes at least one of the following:
  • the first period is related to the current device access volume of the server; or,
  • the first period is related to the number of packets currently to be processed by the server; or,
  • the first period is related to the local running load of the server.
  • determining the first cycle includes:
  • the current connection state of the connection includes: at least one of the number of times, frequency, duration, and response delay, transmission rate, and packet loss rate of the connection that has occurred abnormally;
  • the first period is directly proportional or inversely proportional to the current connection state.
  • the method also includes:
  • configuration information includes at least one of the following:
  • the minimum detection period is used to indicate the minimum period for the client to send detection information
  • the first indication information is used to indicate whether the client starts backoff
  • Backoff parameter used to indicate the backoff rule
  • the maximum detection period is used to indicate the maximum period for the client to send the detection information; wherein, the minimum period and/or the maximum period are determined by the server according to the current traffic;
  • a valid connection used to indicate a valid connection for the configuration information
  • the second indication information is used to indicate whether the client uses other protocols to initiate detection, and the other protocols are different from the protocol corresponding to the connection;
  • a first protocol configured to instruct the client to send detection information based on the first protocol, where the first protocol is different from the protocol corresponding to the connection;
  • the parameters related to the first protocol are used to indicate the detection period supported by the first protocol.
  • multiple connections are included between the network device and the server, and the effective connection includes at least one of a specified connection, all connections, and a current connection; wherein, the current connection refers to the connection between the client and the server to transmit the configuration information.
  • connection includes a first connection and a second connection
  • third cycle corresponding to the first connection is adapted to the service volume of the server on the first connection, and/or or related to the current connection state of the first connection;
  • the fourth cycle corresponding to the second connection is adapted to the service volume of the server on the second connection, and/or is related to the current connection state of the second connection.
  • a client including a memory and one or more processors; wherein, the memory is used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are executed by the When the processor executes, the client executes the method provided in the first aspect above.
  • a client including modules/units for executing any one of the possible design methods of the above-mentioned first aspect or the first aspect; these modules/units can be realized by hardware, or can be executed correspondingly by hardware.
  • software implementation a processing unit is included, configured to determine that the connection between the client and the server is abnormal; a transceiver unit is configured to send detection information to the server in a first period, and the detection information is used to detect the connection Whether to restore; wherein, the first period is adapted to the current traffic volume of the server, and/or is related to the current connection state of the connection.
  • a server including a memory and one or more processors; wherein, the memory is used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are processed When executed by the server, the server is made to execute the method provided in the second aspect above.
  • a server including: modules/units for executing any one of the possible design methods of the above second aspect or the second aspect; these modules/units can be implemented by hardware, or can be implemented by hardware to execute corresponding software implementation.
  • a processing unit is included, configured to determine the current state of the server, the current state includes the current traffic of the server, and/or, the current connection state of the connection between the server and the client; the processing The unit is further configured to determine a first period according to the current state, and the first period is used to indicate a period for the client to send detection information to the server.
  • a transceiver unit may also be included, configured to send the indication information of the first period to the client.
  • a communication system including:
  • a client configured to execute the method provided in the first aspect above;
  • the server is configured to execute the method provided in the second aspect above.
  • a computer-readable storage medium includes program instructions, and when the program instructions are run on a computer, the computer is made to execute the method provided in the first aspect above.
  • a ninth aspect further provides a computer-readable storage medium, the computer-readable storage medium includes program instructions, and when the program instructions are run on a computer, the computer is made to execute the method provided in the second aspect above.
  • a computer program product including a computer program, which, when the computer program is run on a computer, causes the computer to execute the method described in the first aspect above.
  • a computer program product including a computer program, which, when the computer program is run on a computer, causes the computer to execute the method as described in the second aspect above.
  • FIG. 1 is a schematic diagram of a communication system provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a client provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a connection detection method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of different network entrance connections between the client and the server provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a display interface of a client provided by an embodiment of the present application.
  • FIG. 6 is another schematic flowchart of a connection detection method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an MPTCP connection scenario provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a connection detection method in an MPTCP connection scenario provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of an MPQUIC connection scenario provided by an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of a connection detection method in an MPQUIC connection scenario provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1 is a schematic diagram of a communication system provided by an embodiment of the present application.
  • the communication system includes a client and a server, and the client and the server are connected through a network; in other words, both the client and the server are connected to the network, and the communication between the client and the server is realized through the network .
  • the client can be a terminal device, such as a mobile phone, a tablet computer (Pad), a computer with a transceiver function, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) terminal device, an industrial control Wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation safety wireless terminals in smart cities, wireless terminals in smart homes, wearable devices, vehicle-mounted devices; and network devices, such as Layer 3 switches, routers, broadband gateways, firewalls, loads Network equipment such as equalizers.
  • a terminal device such as a mobile phone, a tablet computer (Pad), a computer with a transceiver function
  • a virtual reality (virtual reality, VR) terminal device an augmented reality (augmented reality, AR) terminal device
  • an industrial control Wireless terminals in industrial control wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation safety wireless terminals in smart cities, wireless terminals in smart homes
  • the server can also be called a server.
  • the server can serve the client.
  • the server can provide resources to the client and/or store client data.
  • the resource can be at least text, images, and videos.
  • the server may be a server or a server cluster, which is not limited in this embodiment of the present application.
  • the server may be an application server, that is, an application server that provides services for different applications in the client.
  • the client includes various types of applications, such as Huawei Changlian, Instant messaging applications such as Weibo and forums; short video applications such as Douyin and Xiaohongshu; video playback applications such as iQiyi and Tencent, etc.
  • the client uses different applications, the client establishes a connection with the application server corresponding to each application for communication. For example, assuming that the client runs the Huawei Connect app, the server is the Huawei Connect server.
  • the network includes a radio access network (Radio Access Network, RAN) and a core network (Core Network, CN).
  • the client accesses the core network through the access network, and the core network is connected to the server, so the client establishes a connection with the server.
  • Radio Access Network Radio Access Network
  • Core Network Core Network
  • connection between the client and the server can be a Transmission Control Protocol (Transmission Control Protocol, TCP) connection, or a fast UDP Internet connection (Quick UDP Internet Connection, QUIC). These two connections are briefly introduced below.
  • TCP Transmission Control Protocol
  • QUIC Fast UDP Internet Connection
  • Transport layer protocols include TCP and User Datagram Protocol (UDP), among which TCP connection provides network reliability.
  • TCP connection provides network reliability.
  • the process of the client using the TCP connection to access the server includes: the client sends a TCP request to the server, and the server feeds back a TCP response to the client in response to the TCP request.
  • TCP connections process TCP requests one by one. If the previous request or response is not processed, the next one cannot be performed.
  • This method is easy to cause head-of-line blocking (Head-of-line blocking), that is, if a request or response cannot be completed for a long time, then subsequent requests or responses will be blocked and unable to proceed.
  • Head-of-line blocking head-of-line blocking
  • the TCP protocol supports sending TCP requests continuously on a TCP connection, without waiting for the response to be processed before processing the next request.
  • This technology is called “pipelining" on the TCP connection.
  • the multi-path transmission control protocol (MPTCP) is obtained by extending the TCP protocol.
  • MPTCP multi-path transmission control protocol
  • Parallel transmission of multiple TCP connections can improve resource utilization. For example, when a user is watching a video, the client transmits data simultaneously through the TCP connections corresponding to the Wi-Fi network and the cellular network respectively. In this way, the download rate is also higher, the stuttering is reduced, and the playback is smoother.
  • connection between the client and the server may be a single TCP connection or an MPTCP connection, which is not limited.
  • QUIC is a transport layer protocol based on the UDP protocol. Compared with the TCP protocol, UDP is lighter, but also has much fewer error checks, which means that UDP is often more efficient, but not as reliable as TCP. Therefore, applications such as games and streaming media generally use the UDP protocol, while applications such as web pages, emails, and remote login use the TCP protocol.
  • QUIC supports content prioritization. Because if all requests or responses are transmitted indiscriminately, some critical or important requests may be blocked in the case of limited bandwidth. Therefore, QUIC supports setting the priority of network content. For example, QUIC can provide multiple streams The unique management and resource allocation functions provide the possibility for the priority division of different streams, where different streams correspond to different network contents.
  • QUIC multi-path Quick UDP Internet Connection
  • MPQUIC multi-path Quick UDP Internet Connection
  • the client will periodically detect whether the connection is restored to the server. Specifically, the client periodically sends detection information to the server at a locally configured period. However, when the client periodically sends detection information, it does not consider the current traffic volume of the server. Therefore, it is very likely that the client will continue to send detection information in a local cycle, which will increase the processing pressure on the server and cause the server to crash. For example, the server is currently blocked by a large number of pending packets due to an abnormal background service process. At this time, if the client frequently sends detection signals, the processing burden on the server may be further increased and the server may crash.
  • an embodiment of the present application provides a connection detection method, which may be applicable to the communication system shown in FIG. 1 .
  • the client determines that the connection with the server is abnormal, the client sends a detection signal to the server in the first cycle.
  • the first period is adapted to the current traffic volume of the server, and/or, the first period is related to the current connection state of the connection. For example, when the current business volume of the server is large, the first period is longer, so as to avoid sending detection information to the server frequently in a short period to increase the processing pressure of the server; or, when the current business volume of the server is small, the first period is shorter , so that the connection can be restored as soon as possible.
  • FIG. 2 shows a schematic structural diagram of the electronic device 100 .
  • the electronic device 100 may be a client or a server. Take the client as a mobile phone as an example.
  • Management module 141 battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, An indicator 192, a camera 193, a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) Wait.
  • application processor application processor
  • AP application processor
  • modem processor graphics processing unit
  • graphics processing unit graphics processing unit
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit, NPU
  • different processing units may be independent devices, or may be integrated in one or more processors.
  • the controller can be the nerve center and command center of the mobile phone. The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
  • the USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the mobile phone, and can also be used to transmit data between the mobile phone and peripheral devices.
  • the charging management module 140 is configured to receive a charging input from a charger.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the wireless communication function of the mobile phone can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in a mobile phone can be used to cover single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied to mobile phones.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • the wireless communication module 160 can provide applications on mobile phones including wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (wireless fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite system ( Global navigation satellite system (GNSS), frequency modulation (frequency modulation, FM), near field communication (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the mobile phone can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR techniques, etc.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • code division multiple access code division multiple access
  • CDMA broadband Code division multiple access
  • WCDMA wideband code division multiple access
  • time division code division multiple access time-division code division multiple access
  • TD-SCDMA time-division code division multiple access
  • LTE long term evolution
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a Beidou navigation satellite system (beidou navigation satellite system, BDS), a quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • Beidou navigation satellite system beidou navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the display screen 194 is used to display the display interface of the application and the like.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the mobile phone may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the mobile phone can realize shooting function through ISP, camera 193 , video codec, GPU, display screen 194 and application processor.
  • the ISP is used for processing the data fed back by the camera 193 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin color.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be located in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other image signals.
  • the mobile phone may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the mobile phone by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the storage program area can store the operating system and software codes of at least one application program (such as iQiyi application, WeChat application, etc.).
  • the storage data area can store data (such as images, videos, etc.) generated during the use of the mobile phone.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to realize expanding the storage capacity of the mobile phone.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, save pictures, videos and other files in the external memory card.
  • the mobile phone can realize the audio function through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the keys 190 include a power key, a volume key and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • the mobile phone can receive key input and generate key signal input related to user settings and function control of the mobile phone.
  • the motor 191 can generate a vibrating reminder.
  • the motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as taking pictures, playing audio, etc.) may correspond to different vibration feedback effects.
  • the indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the SIM card interface 195 is used for connecting a SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to realize contact and separation with the mobile phone.
  • the components shown in FIG. 2 do not constitute a specific limitation on the mobile phone.
  • the mobile phone in the embodiment of the present invention may include more or less components than those shown in FIG. 2 .
  • the mobile phone may further include a sensor module (not shown in the figure), and the sensor module includes a pressure sensor, a gyroscope sensor, a temperature sensor, and the like.
  • the combination/connection relationship between the components in FIG. 2 can also be adjusted and modified.
  • FIG. 3 is a schematic flowchart of a connection detection method provided in an embodiment of the present application. This method is applicable to the communication system shown in FIG. 1 . As shown in Figure 3, the flow of the method includes:
  • the client establishes a connection with the server.
  • the connection may be a TCP connection or a QUIC connection.
  • S1 may be implemented through a three-way handshake process.
  • the server If the server agrees to establish a connection, it sends an acknowledgment (acknowledge, ACK) message to the client.
  • the client receives the ACK information sent by the server, it sends an acknowledgment message to the server.
  • the service endpoint receives the confirmation message, it also enters the established (connection established) state.
  • the three-way handshake is completed, a connection is established between the client and the server. It should be noted that, the three-way handshake is used as an example for the introduction, and it may also be a four-way, more or less handshake process, which is not limited in this embodiment of the present application.
  • the first method is to determine the detection period according to the current service volume of the server.
  • the detection period is determined according to the current connection state of the connection.
  • the detection period is determined according to the current service volume of the server.
  • the current service volume of the server includes at least one of the current device access volume of the server, the number of currently pending packets, and the local running load of the server.
  • Method 1 The detection period is determined according to the current device access volume of the server.
  • the device connected to the server includes at least one device in a mobile terminal, a gateway device, a load balancing device (Load Balance, LB), a network address translation (Network Address Translation, NAT) device, and the like.
  • Load Balance Load Balance
  • NAT Network Address Translation
  • the server may store a mapping relationship between the device access amount of the server and the detection period, and when the device access amount of the server is counted, the detection period is determined based on the mapping relationship.
  • Method 2 Determine the detection period according to the number of packets currently to be processed by the server.
  • the message to be processed includes at least one of a handshake message, a detection message, a network resource request message, and the like.
  • the handshake message may be the first or second handshake request (please refer to the introduction above)
  • the network resource request refers to a request for requesting network resources, such as text, picture, video and so on.
  • Method 3 Determine the detection period according to the local operating load of the server.
  • the local running load of the server may include at least one of the local memory usage rate of the server, the running speed of the processor, the amount of running processes, the running speed of processes, the amount of running threads, the running speed of threads, etc.; wherein, the processing The processor can be a central processing unit (Central Processing Unit, CPU) or other processors.
  • CPU Central Processing Unit
  • the high local running load of the server includes: the local memory usage of the server is greater than threshold 1, the operating speed of the processor is less than threshold 2, the number of running processes is greater than threshold 3, the running speed of processes is lower than threshold 4, and the number of running threads is greater than the threshold 5.
  • the running speed of the thread is less than at least one of the thresholds 6 and the like; the specific values of the thresholds 1 to 6 are not limited in this embodiment of the application.
  • the first method can also be refined as, according to the current traffic volume of the network entrance of the server, determine the detection period corresponding to the network entrance, and the detection period corresponding to the network entrance is suitable for accessing the network Ingress client.
  • the current traffic volume of the network portal includes at least one of the current device access volume of the network portal, the number of packets currently to be processed by the network portal, and the local operating load consumed by the network portal.
  • the server includes network entrance A and network entrance B, client 1 and client 2 access the server through network entrance A, and client 3 accesses the server through network entrance B.
  • the server can count the current traffic volume of each network entrance, determine the detection period 1 according to the current traffic volume of network entrance A, and determine the detection period 2 according to the current traffic volume of network entrance B, then the Clients (that is, client 1 and client 2) send detection signals to the server in detection period 1, and clients connected to network entrance B (that is, client 3) send detection signals to the server in detection period 2.
  • client 1 and client 2 can send detection signals to network entrance A with a detection period of 1,
  • the detection period 1 is adapted to the current traffic volume of the network entrance A, so as to prevent the clients of the network entrance A (client 1 and/or client 2) from frequently sending detection signals to the network entrance A, further aggravating the situation of the network entrance A. of blockage.
  • the detection period is determined according to the current connection state of the connection.
  • the connection state includes: the number, frequency, and duration of connection abnormalities, and at least one of response delay, transmission rate, and packet loss rate.
  • the detection period is related to the current connection state of the connection.
  • the detection period is directly proportional or inversely proportional to the current connection state of the connection.
  • the shorter the detection cycle that is, when the connection has just or rarely experienced an exception, it will be detected in a shorter cycle to ensure that the connection is restored as soon as possible. Do not affect the user experience as much as possible.
  • the greater the number, frequency, or duration of connection abnormalities the shorter the detection period; that is, for connections that have frequently experienced abnormalities or have been abnormal for a long time, a shorter period of detection is used to restore the connection as soon as possible.
  • the higher the response delay or packet loss rate of the connection the shorter the detection period; generally, the higher the response delay or packet loss rate, the more obvious the network freeze, and the shorter the detection period, the faster the recovery connect.
  • the lower the response delay or packet loss rate of the connection the shorter the detection period; the lower the response delay or packet loss rate, the less obvious the network freeze, and the shorter detection period can ensure that the user experience will not be affected.
  • the connection between the client and the server includes multiple connections, such as a first connection and a second connection.
  • S2 can be refined to determine the first detection period according to the current traffic volume of the server on the first connection, and/or, the current connection state of the first connection, and determine the first detection period according to the current traffic of the server on the second connection and/or, the current connection state of the second connection determines a second detection period, and the first detection period and the second detection period may be the same or different. That is to say, in the case that there are multiple connections between the client and the server, the detection cycle corresponding to each connection can be determined with a finer granularity.
  • the detection period determined in S2 may be a value or a period range, which is not limited in this embodiment of the present application.
  • first manner and the second manner may be used alone or in combination, which is not limited in this embodiment of the present application.
  • first use the first method to determine a cycle range and then use the second method to determine a specific cycle within the range; or, first use the second method to determine a Period range, and then use the first method to determine a specific period within the range.
  • a step may also be included: determining whether to activate the detection backoff function.
  • the probe backoff function means that when the client sends a probe signal in a certain period, if it does not receive a probe feedback, it backs off to a larger period to send a probe signal, so as to avoid a large number of clients sending probe signals in the same period and causing the server to Overwhelmed and broken.
  • the backoff mode or the non-backoff mode has been locally configured on the client, for example, the backoff mode or the non-backoff mode is configured by default on the client after leaving the factory.
  • Another implementation manner is that the user can set a backoff mode or a non-backoff mode. For example, the user makes settings on the client.
  • the server indicates to the client whether to back off. For example, the server sends to the client first indication information for indicating whether to start the backoff mode. Exemplarily, when the first indication information is 1, it is used to indicate that the backoff mode needs to be activated, and when the first indication information is 0, it is used to indicate that the backoff mode does not need to be activated. It can be understood that the server may actively send the first indication information to the client, or the server may send the first indication information to the client after receiving the query information sent by the client, and the query information is used to query whether to start the backoff model.
  • a step may also be included: determining a backoff parameter.
  • the backoff parameter includes a backoff rule, such as a Fibonacci sequence backoff rule, or other backoff rules; or, the backoff parameter includes a series of backoff values, such as five parameters a, b, c, d, and e.
  • the backoff parameter can be configured locally by the client, or indicated by the server to the client, or set by the user, for example, the user sets the backoff parameter on the client, and the specific method is not limited in this embodiment of the application. . Two backoff examples are described below.
  • the backoff parameter includes a Fibonacci sequence backoff rule.
  • the back-off rule of the Fibonacci sequence means that each value is the sum of the previous two values.
  • the Fibonacci sequence is: 1, 2, 3, 5, 8, 13.... where each value is the sum of the previous two values. Therefore, the backoff process includes: starting with the minimum detection period, increasing the detection period according to the Fibonacci sequence rule.
  • the minimum detection period is 5s
  • the detection period includes: 5s, 6s, 11s, 17s, 28s.
  • the client first sends a probe signal with a detection period of 5s. If no feedback is received, it sends a detection signal with a detection period of 6s. If it still does not receive a feedback, it sends a detection period with a detection period of 11s, and so on.
  • the minimum detection period may be the detection period determined in S2, or the minimum value in the period range determined in S2.
  • the backoff parameter includes a series of backoff values, such as five parameters a, b, c, d, e (the unit may be seconds or milliseconds, etc.). Then, the client starts with the minimum detection period, and gradually increases the detection period according to the five parameters a, b, c, d, and e. For example, if the minimum detection period is 5s, then the detection period includes: 5s, 5+a s, 5+b s, 5+c s, 5+d s, 5+e s. Therefore, the client first sends a probe signal with a probe period of 5s. If no feedback is received, the client sends a probe signal with a probe period of 5+a s, and so on. Wherein, the minimum detection period may be the detection period determined in S2, or the minimum value in the period range determined in S2.
  • the client continuously increases the detection period based on the minimum detection period and the backoff parameter, and stops the backoff when the increased detection period exceeds the maximum detection period.
  • the detection period sequence includes: 5s, 6s, 11s, 17s, 28s. If the maximum detection period is 30s, then after reaching 28s, a subsequent detection period of 30s is used , will not continue to increase the detection period, because the next period of 28s is 45s, which exceeds 30s.
  • the client can always use the maximum detection period for detection. For example, after reaching 28s, if it still does not receive the detection response from the server, it will continue to use the 30s period for detection.
  • the minimum detection period may be the detection period determined in S2, or the minimum value in the period range determined in S2. If S2 determines the period range, the maximum detection period may be the maximum value in the period range determined in S2, or a period specified by the user or system default or indicated by the server that is greater than the minimum detection period.
  • a step may also be included: determining the effective connection of the detection period; or in other words, determining the connection to which the detection period is applied.
  • There may be one or more connections between the client and the server, and if there are more than one connection, then the detection period determined in S2 above is applied to at least one of the multiple connections.
  • the effective connections of the detection period are all connections.
  • the effective connection of the detection period is the current connection.
  • the current connection refers to a connection between the client and the server that is currently in an active state, or a connection that is in an inactive state, or a connection that is currently used by the client to send data to the server.
  • the effective connection of the detection period is a specified connection, and the specified connection may be one or more of multiple connections. Wherein, the specified connection may be specified locally by the client, or specified by the user, or specified by the server to the client.
  • the connection for starting the backoff mode may be further determined.
  • the connections for starting the backoff mode may be all effective connections or specified effective connections, which is not limited in this embodiment of the present application.
  • a step may also be included: determining whether an external detection protocol is configured for connection detection, wherein the external detection protocol refers to a protocol different from the current protocol.
  • the external detection protocol refers to a protocol different from the current protocol.
  • the current connection between the client and the server is a QUIC connection
  • the external detection protocol is another protocol different from the QUIC protocol, such as the Internet Control Message Protocol (Internet Control Message Protocol, ICMP), the sixth version of the Internet Control Information Protocol (Internet Control Message Protocol Version 6, ICMPv6) protocol, Bidirectional Forwarding Detection (Bidirectional Forwarding Detection, BFD) protocol, etc.
  • the client is locally configured with an external detection protocol.
  • the client is configured with an external detection protocol by default after leaving the factory.
  • the server configures the external detection protocol and notifies the client, for example, the server sends second indication information for indicating whether to configure the external detection protocol.
  • the server may also indicate to the client the specific protocol type of the external detection protocol, such as the ICMP/ICMPv6 protocol or the BFD protocol. If an external detection protocol is configured, the client can use the external detection protocol to detect connections.
  • the client creates an external detection protocol session with the server, and sends a detection signal at a detection period supported by the external detection protocol session.
  • the external detection protocol is the BFD protocol as an example
  • the client creates a BFD protocol session with the server, and sends detection signals at the detection interval supported by the BFD protocol.
  • the detection cycle supported by the external detection protocol may be configured by default by the client, or specified by the user, or instructed by the server, or stipulated in the protocol, which is not limited in this embodiment of the application. In this way, the client can use other protocols different from the current protocol for connection detection, which is more flexible.
  • the client determines that the connection with the server is abnormal.
  • the abnormal connection between the client and the server includes various scenarios.
  • Scenario 1 Determine that the connection between the client and the server is abnormal, including: when the connection between the client and the server satisfies: the response delay of the server is greater than the first threshold, the data transmission rate is less than the second threshold, and the packet loss rate When it is greater than at least one of the third thresholds, it is determined that the connection is abnormal.
  • the server response delay refers to the length of time between the first moment when the client sends out a request for network resources and the second moment when the network resources fed back by the server are received.
  • the network resource request is used to request a network resource
  • the network resource may be at least one of text, picture, and video.
  • a timer may be started, and when the timer reaches a first threshold, it is determined that the connection between the client and the server is abnormal.
  • the user uses a mobile phone (client) to search for content online, but has not found any search results (for example, the progress bar 501 used to indicate the search progress changes slowly), which affects user experience.
  • the data transmission rate affects the response delay of the server. For example, if the data transmission rate is too low, it will take a long time for the data to be sent to the peer. Therefore, in the embodiment of the present application, when the data transmission rate between the client and the server is lower than the second threshold, it is determined that the connection between the client and the server is abnormal.
  • the user uses a video playback application on the mobile phone (client) to watch a movie, for example, the user clicks on the seventh episode, and the area 502 displays that it is preparing, and the transmission rate (such as 100kb/s) and other information, the video playback is relatively slow.
  • the packet loss rate refers to the correct rate of data sent on the connection between the client and the server. If the packet loss rate is high, it will affect the accuracy of the network resources requested by the user. Therefore, in the embodiment of the present application, if the packet loss rate of the connection between the client and the server is greater than the third threshold, it is determined that the connection is abnormal.
  • the specific values of the above first threshold, second threshold and third threshold can be set by the client, set by the server, or stipulated in the protocol, or set by the user, etc. Not limited.
  • Scenario 2 It is determined that the connection between the client and the server is abnormal, including: the network access method of the client is changed. Wherein, the network access mode of the client is changed, including at least one of the following:
  • the wireless local area network may be WIFI, for example, WIFI at home or in a company.
  • WIFI wireless local area network
  • the network access mode of the client is switched from the WIFI network to the mobile communication network (4G network, 3G network or 5G network), and it is determined that the connection between the client and the server is abnormal.
  • the communication standard (or network standard) of the mobile communication network includes but is not limited to: long term evolution (long term evolution, LTE) network, global system of mobile communication (global system of mobile communication, GSM) network, code division multiple access ( code division multiple access (CDMA) network, wideband code division multiple access (WCDMA) network, universal mobile telecommunications system (UMTS), etc.
  • LTE long term evolution
  • GSM global system of mobile communication
  • CDMA code division multiple access
  • WCDMA wideband code division multiple access
  • UMTS universal mobile telecommunications system
  • the communication standard may further include: the second-generation mobile communication technology (2nd-Generation wireless telephone technology, 2G) network, the third-generation mobile communication technology (3rd-Generation wireless telephone technology, 3G) network, the fourth 4th-Generation wireless telephone technology (4G) network and 5th-Generation wireless telephone technology (5G) network, or the future N-generation mobile communication technology, where N is greater than 5.
  • 2G second-generation mobile communication technology
  • 3G third-generation mobile communication technology
  • 4G 4th-Generation wireless telephone technology
  • 5G 5th-Generation wireless telephone technology
  • the WIFI in room 1 is switched to WIFI in room 2, and it is determined that the connection between the client and the server is abnormal.
  • Connection Migration when the network access method of the client is changed, the abnormal connection between the client and the server is called Connection Migration.
  • the connection between the client and the server has a client address and a server address.
  • the client address is the address on the client that uses the connection to transmit data
  • the server address is the address on the server that uses the connection to transmit data. address.
  • the client address of the connection will change, so it is necessary to change the original client address of the connection to a new client address, that is, the connection is migrated from the original client address to New client address. Taking the network access method from WIFI to 4G as an example, the client address changes.
  • the original client address of the connection cannot continue to be used and needs to be migrated to a new client. address.
  • the client address includes but is not limited to IP address and port tuple, and the tuple can be a two-tuple, four-tuple or more tuples and the like.
  • the execution sequence between S2 and S3 is not limited in this application. If S2 is executed first and then S3 is executed, that is, before the connection between the client and the server is abnormal, the real-time determination of the detection cycle is started. For example, S2 is executed periodically in a certain period. When , use the latest detection period determined before this time for detection. If S3 is executed first and then S2 is executed, that is, the detection cycle is determined after the connection between the client and the server is abnormal.
  • One possible implementation method is that the client perceives the service volume of the server in real time. When the connection is abnormal, the client determines the detection period according to the service volume of the server perceived before the abnormality occurs or determines the detection period according to the current connection status.
  • the client sends a probe signal to the server in the first period.
  • S4 includes at least steps S41 and S42.
  • S41 the client sends the detection signal 1 to the server at the first moment, and if no detection feedback is received before the second moment, sends the detection signal 2 to the server at the second moment, and the interval between the first moment and the second moment
  • the duration between is the first cycle.
  • the first period may be the detection period determined in S2, or any period within the period range determined in S2 (for example, the minimum value within the period range).
  • the detection feedback from the server is still not received before the third moment, the detection signal 3 is sent to the server at the third moment, and the duration between the third moment and the second moment is the second period, and the second period and The first period may be the same or different, for example, if the backoff rule is activated, the second period may be a period calculated according to the first period and the backoff parameter. The second period may be the same as or different from the first period.
  • the detection signal is used to detect whether the connection is restored, or whether the server address of the connection is reachable.
  • the detection signal may carry the connection identifier of the connection, and the connection identifier may be a connection ID, a subflow identifier, and the like.
  • the connection identifier may be a subflow identifier
  • the subflow identifier may be an address identifier of the subflow
  • the address identifier includes an IP and a port binary group, dual-ported IP, and dual-ported quadruple, etc. or more.
  • the connection identifier may be a connection ID (connection ID).
  • the detection signal may be at least one of a PATH_CHALLENGE frame, a NEW_CONNECTION_ID frame, a PADDING frame, and a Sync frame.
  • the server sends detection feedback to the client segment.
  • the detection feedback is used to indicate that the connection is restored; or, the server address of the connection is reachable.
  • the sounding feedback may be a PATH_RESPONSE frame and an ACK frame.
  • the client when the connection between the client and the server is abnormal, the client sends a detection signal to the server in the first cycle, and the first cycle is adapted to the current traffic of the server to avoid frequent sending
  • the detection signal causes the server to crash due to excessive traffic.
  • S2 in FIG. 3 can be executed by the server or by the client. If executed by the client, it may include that the client perceives the current traffic of the server (which can be sensed in real time), and then determines the detection period according to the current traffic of the server and/or the current connection state of the connection. Among them, there are many ways for the client to perceive the current traffic of the server. For example, the client sends a query request to the server in real time to request the current traffic of the server, or the client responds according to the response delay of the server, At least one of the transmission rate and the packet loss rate determines the current traffic volume of the server.
  • the server determines the detection cycle according to the current traffic of the server and/or the current connection state of the connection, and then sends it to the client.
  • the specific content will be introduced in FIG. 6 below.
  • FIG. 6 is another schematic flowchart of the connection detection method provided by the embodiment of the present application.
  • the process includes S1 to S5.
  • S1, S3-S5 are the same as those of S1, S3-S5 in FIG. 3 , so details are not repeated here.
  • S2 includes S21 to S23.
  • the server determines the detection period according to the current traffic and/or the current connection state of the connection.
  • the method of determining the detection period by the server is the same as the method of determining the detection period in S2 in Figure 3 above, specifically, including the first method and the second method, the first method is based on the current traffic volume of the server To determine the detection period, the second method is to determine the detection period according to the current connection status between the server and the client. In order to save space, it will not be repeated here.
  • the server generates configuration information according to the detection period.
  • the configuration information includes at least one of the following information 1 to information 7:
  • the minimum detection period may be the detection period determined in step S21.
  • First indication information used to indicate whether to activate the backoff mode. Exemplarily, when the first indication information is 1, it is used to indicate that the backoff mode needs to be activated, and when the first indication information is 0, it is used to indicate that the backoff mode does not need to be activated.
  • the backoff parameter includes a backoff rule, such as a Fibonacci sequence backoff rule or other backoff rules; or, the backoff parameter includes a series of backoff values, such as five parameters a, b, c, d, and e. It can be understood that, when the first indication information is 0, the configuration information may not include the backoff parameter, and when the first indication information is 1, the configuration information includes the backoff parameter.
  • a backoff rule such as a Fibonacci sequence backoff rule or other backoff rules
  • the backoff parameter includes a series of backoff values, such as five parameters a, b, c, d, and e.
  • the maximum detection period is used to indicate the maximum period that the client can achieve. For example, when the client continuously increases the detection period based on the minimum detection period and backoff parameters, when the increased detection period reaches the maximum detection period, it stops backing off.
  • connection refers to the effective connection of the configuration information. If there are multiple connections between the client and the server, the information five may be used to indicate that configuration information may be applied to at least one of the multiple connections.
  • the effective connection of the configuration information is all connections.
  • the effective connection of the configuration information is the current connection.
  • the current connection refers to the connection between the client and the server that is currently in the active state, or the connection that is in the inactive state, or the current connection between the client and the server.
  • mode C the effective connection of the configuration information is the designated connection.
  • the specified connection may be at least one of multiple connections between the client and the server.
  • the fifth message may also carry the connection identifier of the specified connection.
  • the connection identifier may be any identifier that can uniquely identify the connection, such as a connection ID, and may also be a port address of the connection, and the port address includes a port quadruple or quintuple, and the like.
  • Second indication information for indicating whether to configure an external detection protocol. Exemplarily, when the second indication information is 1, it is used to indicate that the external detection protocol is configured, and when the second indication information is 0, it is used to indicate that the external detection protocol is not configured. In some embodiments, information six may also indicate the specific protocol type of the configured external detection protocol, for example, ICMP/ICMPv6 protocol or BFD protocol.
  • Information seven refers to parameters related to information six. For example, information six indicates that the configured external detection protocol is the ICMP protocol, then information seven may include the detection period corresponding to the ICMP protocol. If information six indicates that the configured external detection protocol is the BFD protocol, then information seven may include the detection period corresponding to the BFD protocol.
  • the server sends configuration information to the client.
  • the server may actively send configuration information to the client, or passively send configuration information to the client, for example, when the server receives a configuration information query request sent by the client, it feeds back configuration information to the client.
  • S23 may be performed during the handshake phase, or during data transmission after the handshake.
  • the server sends configuration information to the client after receiving the first handshake request, and the configuration information may be carried in the ACK information in response to the first handshake request.
  • the process of the handshake phase please refer to the previous introduction.
  • Take the execution of S23 after the handshake is completed as an example.
  • the client detects that the connection between the client and the server is abnormal (such as the first abnormality), it will send a probe to the server at the local configuration cycle (regardless of the client's business volume).
  • the server after the server sends a probe feedback to the client in response to the probe signal, it can also send configuration information to the client. After that, when the connection between the client and the server is abnormal again, the second solution can be used to configure Probe at the detection cycle indicated by the information.
  • the scheme in which the client uses the detection period determined according to the client traffic volume as the detection scheme is called the first detection scheme
  • the scheme in which the client uses the detection period determined according to the client traffic volume as the detection scheme is The second detection method. Either of the two detection schemes can be selected for use, or a switch button is set on the client, and the switch between the first detection scheme and the second detection scheme can be realized through the switch button.
  • connection detection method provided in the embodiment of the present application may be applicable to a multi-connection scenario.
  • the multi-connection means that there are multiple connections between the client and the server, such as MPTCP connection and MPQUIC connection.
  • the following uses MPTCP connection scenarios and MPQUIC connection scenarios as examples to introduce.
  • FIG. 7 is a schematic diagram of an MPTCP connection scenario provided by the embodiment of the present application.
  • the first TCP connection may be that the client uses Wi-Fi network resources to perform data transmission with the server
  • the second TCP connection may be that the client uses LTE network resources to perform data transmission with the server.
  • the first TCP connection and the second TCP connection are different TCP subflows under the same TCP connection, or, the first TCP connection and the second TCP connection are different TCP connections.
  • the MPTCP layer on the server side decomposes the TCP flow into two TCP sub-flows and then transmits them to the server independently through two TCP connections.
  • the server After receiving the two TCP sub-flows, the server combines and sends the two TCP sub-flows. to the application layer. This method of parallel transmission of multiple TCP substreams improves data transmission efficiency.
  • FIG. 8 is a schematic flowchart of a connection detection method in an MPTCP connection scenario provided by an embodiment of the present application. This method can be applied to the MPTCP connection scenario shown in FIG. 7 . As shown in Figure 8, the method flow includes:
  • the client establishes a first TCP connection with the server.
  • the client establishes a second TCP connection with the server.
  • the connection identifier corresponding to the first TCP connection may be TCP subflow identifier 1
  • the connection identifier corresponding to the TCP connection may be TCP subflow identifier 1.
  • Flow ID 2 The TCP subflow identifier can include a subflow address (Address) or a subflow address ID (Address ID), wherein the subflow address can be a port address, and the port address can be a port two-tuple, four-tuple or more Group.
  • the server determines the detection period according to the current traffic and/or the current connection state.
  • the server generates configuration information according to the detection period.
  • the configuration information includes the minimum detection period, the first indication information used to indicate whether to start the backoff mode, the backoff parameter, the maximum detection period, the connection of the application, the second indication information used to indicate whether to configure the external detection protocol, and the external detection protocol at least one of the parameters etc.
  • the configuration information please refer to the description of S2 in FIG. 6 , and details will not be repeated.
  • the server sends the configuration information to the client through the first TCP connection.
  • the server After the server generates the configuration information, it can select a TCP connection to send the configuration information to the client.
  • the selected TCP connection can be any one of multiple TCP connections, or a TCP connection currently undergoing data transmission, or , currently active TCP connections, etc.
  • the configuration information can refer to the following table 1:
  • the kind field is used to indicate MPTCP.
  • Length is used to indicate the length of the configuration information, that is, the number of occupied bytes.
  • the Subtype field is used to indicate that the information is configuration information, such as indicating that the information is a PATH_DETECT_CTRL frame.
  • the F field is used to indicate the application to the connection, for example, 0 is used to indicate all sub-streams; 1 is used to indicate the current sub-stream; 2 is used to indicate the specified sub-stream. r: reserved bit, default is 0.
  • the sub-flow identification field includes a sub-flow identification, and the sub-flow identification may be a port address or a sub-flow address ID of a sub-flow, and the port address of a sub-flow may be a port and an IP binary, a double Ended IP and Dual Ended Port Quadruple and so on.
  • the Probe Period field is used to indicate the minimum detection period. It can be understood that the configuration information shown in Table 1 above may also include more or less information, such as indication information on whether to start backoff, backoff rules, whether to configure an external detection protocol, external detection protocol parameters and so on.
  • the client determines that the second TCP connection is abnormal.
  • the client sends a detection signal to the server on the second TCP connection according to the first period indicated by the configuration information.
  • S807 may at least include S807A and S807B.
  • S807A the client sends the detection signal 1 to the server at the first moment, if no detection feedback is received before the second moment, execute S807B, that is, sends the detection signal 2 to the server at the second moment, the first moment and the second The duration between the two moments is the first cycle.
  • the first period may be the detection period indicated in the configuration information, or any period within the period range indicated in the configuration information. It should be understood that if the detection feedback from the server is still not received before the third moment, the detection signal 3 is sent to the server at the third moment, and the duration between the third moment and the second moment is the second period, and the second period and The first period may be the same or different.
  • the configuration information indicates to start the backoff mode
  • the first period may also be the minimum detection period
  • the second period may be a period calculated according to the backoff rule and the first period.
  • the detection signal may be a Sync frame or another frame, which is not limited in this embodiment of the present application.
  • the client receives the probe response on the second TCP connection, recovers the state of the second TCP connection, and may resend service data on the second TCP connection.
  • the detection feedback may be a PATH_DETECT_CTRL frame.
  • the client receives the configuration information sent by the server from the first TCP connection, and when the second TCP connection is abnormal, it can use the detection period indicated by the configuration information to perform detection.
  • connection is included between the client and the server, and each connection corresponds to a connection identifier, and the connection identifier is a connection ID (Connection ID, CID).
  • connection ID Connection ID
  • Connection1 corresponds to CID1
  • Connection2 corresponds to CID2, and so on.
  • CID can uniquely identify a connection.
  • FIG. 10 is a schematic flowchart of a connection detection method in an MPQUIC connection scenario provided by an embodiment of the present application. This method can be applied to the MPQUIC connection scenario shown in FIG. 9 . As shown in Figure 10, the process includes:
  • the client establishes a first QUIC connection with the server.
  • the client establishes a second QUIC connection with the server.
  • the server determines the detection period according to the current traffic and/or the current connection state.
  • the server generates configuration information according to the detection period.
  • the configuration information includes the minimum detection period, the first indication information used to indicate whether to start the backoff mode, the backoff parameter, the maximum detection period, the connection of the application, the second indication information used to indicate whether to configure the external detection protocol, and the external detection protocol at least one of the parameters etc.
  • the configuration information please refer to the description of S2 in FIG. 6 , and details will not be repeated.
  • the configuration information may be a PATH_DETECT_CTRL frame.
  • the definition of the PATH_DETECT_CTRL frame can be referred to as follows:
  • Type(i) TBD1 (for example, 0x3f)
  • Treatmenting Mode(i) // is used to indicate the retreat mode, for example, 0 means no retreat, 1 means retreat according to the Fibonacci sequence rule, it is understandable that when it is 0, the maxPP(i) parameter may not be included.
  • applied connection flag(i), // used to indicate the applied connection for example, 0 is all connections of the current session; 1 is the current connection; 2 is the specified connection;
  • the applied connection flag(i) is 2
  • the applied connection id list contains the connection ID, which is used to indicate the specified connection.
  • the server sends configuration information to the client through the first QUIC connection.
  • the client determines that the second QUIC connection is abnormal.
  • S1007 the client sends a probe signal to the server over the second QUIC connection at the probe period indicated by the configuration information.
  • S1007 includes S1007A and S1007B.
  • S1007A the client sends the detection signal 1 to the server through the second QUIC connection at the first moment.
  • S1007B is that the client sends the detection signal 2 to the server through the second QUIC connection at the second moment.
  • the duration between the first moment and the second moment is the first cycle.
  • the detection signal may be a PATH_CHALLENGE frame.
  • the client receives the probe response through the second QUIC connection.
  • the probe response may be a PATH_RESPONSE frame.
  • a single connection can be understood as including a connection between the client and the server, for example, it can be a single TCP connection or a single QUIC connection.
  • the application layer can decide whether to start the detection.
  • the application layer can start the detection function by itself.
  • the application layer can use the technical solution provided by the embodiment of the present application to start detection; when the technical solution provided by the embodiment of the present application is applicable to multiple connections, the protocol layer can Use the technical solutions provided by the embodiments of this application to start detection.
  • FIG. 11 shows an electronic device 1100 provided by this application.
  • the electronic device 1100 may be the aforementioned client or server.
  • an electronic device 1100 may include: one or more processors 1101; one or more memories 1102; a communication interface 1103, and one or more computer programs 1104, and each of the above devices may communicate through one or more bus 1105 connection.
  • the one or more computer programs 1104 are stored in the memory 1102 and configured to be executed by the one or more processors 1101, the one or more computer programs 1104 include instructions.
  • the instructions included in the one or more computer programs 1104 are used to execute the related steps of the client as in the above corresponding embodiments.
  • the communication interface 1103 is used to realize the communication between the client and other devices (such as the server), for example, the communication interface may be a transceiver.
  • the instructions included in the one or more computer programs 1104 are used to execute the relevant steps of the server in the above corresponding embodiments.
  • the communication interface 1103 is used to realize the communication between the server and other devices (such as the client), for example, the communication interface may be a transceiver.
  • the method provided in the embodiments of the present application is introduced from the perspective of an electronic device (such as a server or a client) as an execution subject.
  • the electronic device may include a hardware structure and/or a software module, and realize the above-mentioned functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether one of the above-mentioned functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.
  • the terms “when” or “after” may be interpreted to mean “if” or “after” or “in response to determining" or “in response to detecting ".
  • the phrases “in determining” or “if detected (a stated condition or event)” may be interpreted to mean “if determining" or “in response to determining" or “on detecting (a stated condition or event)” or “in response to detecting (a stated condition or event)”.
  • relational terms such as first and second are used to distinguish one entity from another, without limiting any actual relationship and order between these entities.
  • references to "one embodiment” or “some embodiments” or the like in this specification means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically stated otherwise.
  • the terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless specifically stated otherwise.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present invention will be generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media.
  • the available medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, a Solid State Disk (SSD)).
  • a magnetic medium for example, a floppy disk, a hard disk, or a magnetic tape
  • an optical medium for example, DVD
  • a semiconductor medium for example, a Solid State Disk (SSD)

Abstract

该方法适用于客户端时,客户端确定与服务端之间的连接异常;以第一周期向所述服务端发送探测信息,所述探测信息用于探测所述连接是否恢复;其中,所述第一周期与所述服务端当前业务量适配,和/或,与所述连接的当前连接状态相关。通过这种方式,客户端在向服务端发送探测信息时考虑到了服务端的业务压力,避免服务端压力过大导致崩溃。

Description

一种连接探测方法、客户端与服务器
相关申请的交叉引用
本申请要求在2021年06月25日提交中国专利局、申请号为202110713070.1、申请名称为“一种连接探测方法、客户端与服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端技术领域,尤其涉及一种连接探测方法、客户端与服务器。
背景技术
客户端(比如移动终端)连接到服务端(比如应用服务器),进而访问服务端内容。示例性的,客户端与服务端之间建立TCP连接或QUIC连接,那么客户端上的电子邮件收发、文件传输、即时通信等依赖于TCP连接或QUIC连接。
目前,当客户端与服务端之间的连接异常时,为了尽快恢复连接,客户端会以本地配置的周期不断向服务端探测连接是否恢复。这种客户端以本地周期不断探测的方式,容易增大服务端处理压力导致服务器崩溃。
发明内容
本申请的目的在于提供了一种连接探测方法、客户端与服务器,有助于缓解服务端的处理压力,避免服务端压力过大而崩溃。
第一方面,提供一种连接探测方法。该方法应用于客户端。所述客户端比如手机、平板电脑、笔记本电脑等等,本申请实施例不作限定。客户端确定与服务端之间的连接异常;客户端以第一周期向所述服务端发送探测信息,所述探测信息用于探测所述连接是否恢复;其中,所述第一周期与所述服务端当前业务量适配,和/或,与所述连接的当前连接状态相关。也就是说,本申请实施例中,客户端与服务端之间的连接异常时,客户端向服务端发送的探测信息的周期与服务端当前业务量适配。比如,服务端当前业务量较高时,客户端以较小的周期发送探测信息,避免频繁地向服务端发送探测信息导致服务端压力过大而崩溃;服务端当前业务量较少时,客户端以较大的周期发送探测信息,保证连接尽快恢复。
其中,客户端与服务端之间的连接可以是基于UDP的连接。比如,TCP连接、QUIC连接等等;或者,还可以是未来随着技术的演进出现的基于其它协议(与UDP、TCP、QUIC不同的协议)的连接,本申请实施例对此不作限定。
其中,探测信息用于探测连接是否恢复,可以包括:探测所述连接的拥塞情况、传输速率、丢包率等中的至少一项是否恢复正常。其中,拥塞情况恢复正常包括服务端在所述连接上接收的等待处理的报文数量小于预设数量。传输速率恢复正常包括服传输速率大于阈值1或处于预设范围内。丢包率恢复正常包括丢包率小于阈值2或处于预设范围内。
在一种可能的设计中,确定所述客户端与服务端之间的连接异常,包括:当所述连接满足如下条件中的至少一种时,确定所述连接异常;所述条件包括:所述服务端响应时延 大于第一阈值、数据传输速率小于第二阈值、丢包率大于第三阈值。示例性的,当服务端响应时延较长或数据传输效率较低时,会影响用户体验。比如,用户使用手机(客户端)上网搜索内容,因为服务端响应时延长或数据传输效率低,一直未搜索到结果,或者手机播放在线视频,因为服务端响应时延长或数据传输效率低,视频比较卡顿等等。同理,丢包率较大也会影响用户体验,比如用户请求的网络资源(图片、视频等),但是因为丢包率较高,导致服务端返回的资源不准确或无法打开。本申请实施例中,当客户端检测到服务端的响应时延较大、数据传输速率较小、丢包率较大时,确定与服务端之间的连接异常,可以启动探测,以尽快恢复连接,保证用户的网络体验。
在一种可能的设计中,确定所述客户端与服务端之间的连接异常,包括:所述客户端的网络接入方式发生更改;其中,所述客户端的网络接入方式发生更改,包括如下至少一种:由无线局域网切换为移动通信网络;或者,
由移动通信网络的第一通信制式切换到第二通信制式;或者,
由第一局域网切换到第二局域网。
示例性的,用户携带客户端从家里出门之后,客户端的网络接入方式由WIFI网络切换到移动通信网络(4G网络、3G网络或5G网络),此时客户端检测到与服务端之间的连接异常,可以启动探测,以尽快恢复连接,保证用户网络体验。
在一种可能的设计中,所述第一周期与所述服务端当前业务量适配,包括如下至少一项:所述第一周期与所述服务端当前设备接入量相关;或者,
所述第一周期与所述服务端当前待处理报文数量相关;或者,
所述第一周期与所述服务端本地运行负载相关。
也就是说,客户端与服务端之间的连接异常时,客户端向服务端发送的探测信息的周期与服务端当前业务量适配,避免服务端当前业务量较高时,频繁的向服务端发送探测信息,导致服务端压力过大而崩溃。
在一种可能的设计中,所述第一周期与所述连接的当前连接状态相关,包括:所述连接的当前连接状态包括:所述连接发生过异常的次数、频率、时长、以及响应时延、传输速率、丢包率中的至少一项;所述第一周期与所述当前连接状态呈正比或反比。
也就是说,客户端与服务端之间的连接异常时,客户端向服务端发送的探测信息的周期与客户端与服务端之间的连接的当前连接状态适配。比如,客户端与服务端之间的连接的响应时长较长,则以较小的周期发送探测信息,避免频繁的向服务端发送探测信息导致服务端压力过大而崩溃;当连接的响应时间较短时,可以以较大的周期发送探测信息,以使连接尽快恢复。
在一种可能的设计中,所述方法还包括:所述客户端接收所述服务端发送的配置信息,所述配置信息中包括如下至少一项:
最小探测周期,用于指示所述客户端发送探测信息的最小周期;
第一指示信息,用于指示所述客户端是否启动退避;
退避参数,用于指示退避规则;
最大探测周期,用于指示所述客户端发送探测信息的最大周期;其中,所述最小周期和/或所述最大周期是所述服务端根据当前业务量确定的;
生效的连接,用于指示对所述配置信息生效的连接;
第二指示信息,用于指示所述客户端是否使用其它协议发起探测,所述其它协议与所 述连接对应的协议不同;
第一协议,用于指示所述客户端基于所述第一协议发送探测信息,所述第一协议与所述连接对应的协议不同;
第一协议相关参数,用于指示所述第一协议所支持的探测周期。
也就是说,服务端可以向客户端配置探测周期,还可以配置是否启动退避模式、退避参数、最大探测周期、应用的连接、是否配置外置检测协议、外置检测协议参数等中的至少一项。这样的话,客户端无需自行计算探测周期,客户端压力较小。而且,服务端自行确定的探测周期是比较准确的。因为服务器清楚本机的业务量的具体情况,所以可以确定出准确的探测周期。
在一种可能的设计中,所述客户端与所述服务端之间包括多条连接,所述生效的连接包括指定连接、所有连接、当前连接中的至少一项;其中,所述当前连接是指所述客户端与所述服务端传输所述配置信息的连接。也就是说,服务端向客户端配置的探测周期可以适用于客户端与服务端之间的所有连接,或指定连接,或当前连接。换言之,对于客户端与服务端之间包括多条连接的场景,部分连接(如,指定连接或当前连接)可以使用本申请提供的连接探测方法进行探测,部分连接可以使用现有方案(即以客户端本地周期进行探测不考虑服务端业务量)进行探测,本申请实施例不作限定。
在一种可能的设计中,所述连接包括第一连接和第二连接;所述客户端通过所述第一连接接收所述服务端配置的所述第一周期;所述客户端确定所述第二连接发生异常时,以第二周期通过所述第二连接向所述服务端发送探测信号,所述探测信号用于探测所述第二连接是否恢复,所述第二周期等于所述第一周期,或所述第二周期是根据所述第一周期和退避参数计算出的。
示例性的,假设客户端与服务端之间包括第一TCP连接和第二TCP连接。服务端通过第一TCP连接向客户端配置探测周期(即第一周期)。客户端可以将第一周期应用到第二TCP连接。比如,当第二TCP连接异常时,可以根据第一周期在第二TCP连接上发送探测信息。这样,客户端与服务端具有多条连接时,服务端通过某一条连接(比如状态最好的一条或预先配置好的一条)指示探测周期即可,不需要通过每条连接指示一次,效率较高。其中,状态最好的一条连接可以是当前业务量最少的一条连接。
在一种可能的设计中,所述连接包括第一连接和第二连接,所述第一连接对应的第三周期与所述服务端在所述第一连接上的业务量适配,和/或与所述第一连接的当前连接状态相关;所述第二连接对应的第四周期与所述服务端在所述第二连接上的业务量适配,和/或与所述第二连接的当前连接状态相关。
示例性的,假设客户端与服务端之间包括第一TCP连接和第二TCP连接。第一TCP连接对应的探测周期与第一TCP连接上的业务量适配,和/或与第一TCP连接的当前连接状态相关。第二TCP连接对应的探测周期与第二TCP连接上的业务量适配,和/或与第二TCP连接的当前连接状态相关。也就是说,客户端与服务端具有多条连接时,每条连接对应的探测周期可以不同,具体的,每条连接的探测周期与该条连接上的业务量适配,和/或与该条连接的当前连接状态相关。这样的话,针对每条连接具有适配于该连接的探测信息,粒度较细。
第二方面,还提供一种连接探测方法。该方法可应用于服务端。服务端确定当前状态,所述当前状态包括所述服务端当前业务量,和/或,所述服务器与客户端之间的连接的当前 连接状态;根据所述当前状态,确定第一周期,所述第一周期用于指示所述客户端向所述服务端发送探测信息的周期。
在一种可能的设计中,根据所述当前状态,确定第一周期,包括如下至少一项:
所述第一周期与所述服务端当前设备接入量相关;或者,
所述第一周期与所述服务端当前待处理报文数量相关;或者,
所述第一周期与所述服务端本地运行负载相关。
在一种可能的设计中,根据所述当前状态,确定第一周期,包括:
所述连接的当前连接状态包括:所述连接发生过异常的次数、频率、时长、以及响应时延、传输速率、丢包率中的至少一项;
所述第一周期与所述当前连接状态呈正比或反比。
在一种可能的设计中,所述方法还包括:
向所述客户端发送配置信息,所述配置信息中包括如下至少一项:
最小探测周期,用于指示所述客户端发送探测信息的最小周期;
第一指示信息,用于指示所述客户端是否启动退避;
退避参数,用于指示退避规则;
最大探测周期,用于指示所述客户端发送探测信息的最大周期;其中,所述最小周期和/或所述最大周期是所述服务端根据当前业务量确定的;
生效的连接,用于指示对所述配置信息生效的连接;
第二指示信息,用于指示所述客户端是否使用其它协议发起探测,所述其它协议与所述连接对应的协议不同;
第一协议,用于指示所述客户端基于所述第一协议发送探测信息,所述第一协议与所述连接对应的协议不同;
第一协议相关参数,用于指示所述第一协议所支持的探测周期。
在一种可能的设计中,所述网络设备与所述服务端之间包括多条连接,所述生效的连接包括指定连接、所有连接、当前连接中的至少一项;其中,所述当前连接是指所述客户端与所述服务端传输所述配置信息的连接。
在一种可能的设计中,所述连接包括第一连接和第二连接,所述第一连接对应的第三周期与所述服务端在所述第一连接上的业务量适配,和/或与所述第一连接的当前连接状态相关;
所述第二连接对应的第四周期与所述服务端在所述第二连接上的业务量适配,和/或与所述第二连接的当前连接状态相关。
第三方面,还提供一种客户端,包括存储器和一个或多个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述处理器执行时,使得所述客户端执行如上述第一方面提供的方法。
第四方面,还提供一种客户端,包括执行上述第一方面或者第一方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。比如,包括处理单元,用于确定所述客户端与服务端之间的连接异常;收发单元,用于以第一周期向所述服务端发送探测信息,所述探测信息用于探测所述连接是否恢复;其中,所述第一周期与所述服务端当前业务量适配,和/或,与所述连接的当前连接状态相关。
第五方面,还提供一种服务器,包括存储器和一个或多个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述处理器执行时,使得所述服务器执行如上述第二方面提供的方法。
第六方面,还提供一种服务器,包括:执行上述第二方面或者第二方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。比如,包括处理单元,用于确定所述服务器当前状态,所述当前状态包括所述服务端当前业务量,和/或,所述服务器与客户端之间的连接的当前连接状态;所述处理单元还用于根据所述当前状态,确定第一周期,所述第一周期用于指示所述客户端向所述服务端发送探测信息的周期。可选的,还可以包括收发单元,用于向客户端发送第一周期的指示信息。
第七方面,还提供一种通信系统,包括:
客户端,用于执行如上述第一方面提供的方法;
服务器,用于执行如上述第二方面提供的方法。
第八方面,还提供一种计算机可读存储介质,所述计算机可读存储介质包括程序指令,当所述程序指令在计算机上运行时,使得所述计算机执行如上述第一方面提供的方法。
第九方面,还提供一种计算机可读存储介质,所述计算机可读存储介质包括程序指令,当所述程序指令在计算机上运行时,使得所述计算机执行如上述第二方面提供的方法。
第十方面,还提供一种计算机程序产品,包括计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行如上述第一方面所述的方法。
第十一方面,还提供一种计算机程序产品,包括计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行如上述第二方面所述的方法。
以上第二方面至第十一方面的有益效果,请参见第一方面的有益效果,不重复赘述。
附图说明
图1为本申请一实施例提供的通信系统的示意图;
图2为本申请一实施例提供的客户端的结构示意图;
图3为本申请一实施例提供的连接探测方法的一种流程示意图;
图4为本申请一实施例提供的客户端与服务端不同网络入口连接的示意图;
图5为本申请一实施例提供的客户端的显示界面的示意图;
图6为本申请一实施例提供的连接探测方法的另一种流程示意图;
图7为本申请一实施例提供的MPTCP连接场景的示意图;
图8为本申请一实施例提供的MPTCP连接场景下连接探测方法的流程示意图;
图9为本申请一实施例提供的MPQUIC连接场景的示意图;
图10为本申请一实施例提供的MPQUIC连接场景下连接探测方法的流程示意图;
图11为本申请一实施例提供的电子设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指 示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。此外,在本申请实施例中,“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
图1为本申请实施例提供的通信系统的示意图。所述通信系统中包括客户端与服务端,客户端与服务端之间通过网络连接;或者说,客户端与服务端均接入网络,通过所述网络实现客户端与服务端之间的通信。
客户端可以是终端设备,诸如手机(mobile phone)、平板电脑(Pad)、带收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、可穿戴设备、车载设备;和网络设备,例如三层交换机、路由器、宽带网关、防火墙、负载均衡器等网络设备。
服务端,也可以称为服务器,服务端可以是为客户端服务,比如服务端可以向客户端提供资源,和/或保存客户端数据等,所述资源可以是文字、图像、视频中的至少一种。服务端可以是一个服务器,也可以是服务器集群,本申请实施例不作限定。服务端可以是应用服务器,即为客户端中不同应用提供服务的应用服务器。应理解,客户端中包括各种类型的应用(application),诸如,华为畅连、
Figure PCTCN2022092770-appb-000001
等即时通信应用;微博、论坛等社交网络;抖音、小红书等短视频应用;爱奇艺、腾讯等视频播放类应用,等等。当客户端使用不同应用时,客户端与各个应用所对应的应用服务器建立连接进行通信。比如,假设客户端运行华为畅连应用,那么服务端是华为畅连服务器。
示例性的,如图1所示,所述网络中包括无线接入网(Radio Access Network,RAN)和核心网(Core Network,CN)。客户端通过接入网接入到核心网,核心网与服务端连接,所以客户端与服务端建立连接。
其中,客户端与服务端之间的连接可以是传输控制协议(Transmission Control Protocol,TCP)连接,或,快速UDP互联网连接(Quick UDP Internet Connection,QUIC)。下面分别对这两种连接进行简单的介绍。
一、TCP连接
传输层协议包括TCP和用户数据报协议(User Datagram Protocol,UDP),TCP连接作为其中一种,提供了网络可靠性。其中,客户端使用TCP连接访问服务端的过程包括:客户端向服务端发送TCP请求,服务器响应该TCP请求向客户端反馈TCP响应。最初的TCP协议中,TCP连接是一个一个处理TCP请求的,如果前一个请求或者响应没有处理完成,则不能进行下一个。这种方式容易造成队头阻塞(Head-of-line blocking),即,如果某个请求或响应迟迟无法完成,那么后续的请求或响应则堵塞无法进行。
为了解决这个问题,TCP协议支持在一个TCP连接上连续发送TCP请求,不用等到收取响应后再处理下一个请求,这种技术被称为TCP连接上的“流水线”(pipelining)。这 种方式虽然它可以在一个TCP连接上连续请求,但是所有的响应必须按照请求发送的顺序来按序处理,因此某个响应处理较慢时,会阻塞其后的所有响应。
随着网络需求的增涨,需要传输的数据量增加,在单个TCP连接无法满足网络需求的情况下,通过对TCP协议扩展得到了多路径传输控制协议(multi path transmission control protocol,MPTCP),利用多条TCP连接的并行传输可以提高资源的利用率。例如,用户在观看视频时,客户端通过Wi-Fi网络和蜂窝网络分别对应的TCP连接同时传输数据,这样,下载速率也更高、卡顿变少、播放更流畅。
在本申请实施例中,客户端与服务端之间的连接可以是单TCP连接,也可以是MPTCP连接,对此不作限定。
二、QUIC连接
QUIC是基于UDP协议的一种传输层协议。与TCP协议相比,UDP更为轻量,但是错误校验也要少得多,这意味着UDP往往效率更高,但是可靠性比不上TCP。所以,通常游戏、流媒体等应用采用UDP协议,而网页、邮件、远程登录等应用采用TCP协议。
QUIC支持内容优先级设置。因为如果无差别地传输所有请求或响应,在带宽有限的情况下,一些关键或重要请求可能会被阻塞,因此,QUIC支持对网络内容的优先级进行设置,比如,QUIC可以提供对多个流的管理和资源分配功能,为不同流的优先级的划分提供了可能,其中不同流对应不同网络内容。
为了解决网络需求日益增大的问题,在QUIC的基础上提出的把传输时所使用的一条物理链路扩展到多条物理链路的协议,即多路径快速UDP互联网连接(multi path Quick UDP Internet Connection,MPQUIC),利用多条QUIC连接的并行传输可以提高资源的利用率。
目前,客户端与服务器之间的连接(TCP连接或QUIC连接)可能会存在异常,比如,连接超时。这种情况下,客户端会周期性的向服务端探测连接是否恢复,具体的,客户端以本地配置的周期,周期性的向服务端发送探测信息。但是,客户端周期性的发送探测信息时,并未考虑服务端当前业务量大小,所以,很有可能客户端以本地周期不断发送探测信息会导致服务端处理压力增大,导致服务端崩溃。比如,服务端当前因为后台服务进程异常导致大量待处理报文阻塞,这时如果客户端频繁发送探测信号,可能进一步加重服务端处理负担导致服务端崩溃。
鉴于此,本申请实施例提供一种连接探测方法,该方法可以适用于图1所示的通信系统。其中,客户端确定与服务端之间的连接异常时,客户端以第一周期向服务端发送探测信号。其中,第一周期是与服务端当前业务量适配的,和/或,第一周期是与所述连接的当前连接状态相关。比如,服务端当前业务量较大时,第一周期较长,避免以短周期频繁的向服务端发送探测信息加重服务端处理压力;或者,服务端当前业务量较小时,第一周期较短,以使尽快恢复连接。
下面介绍本申请实施例相关的设备。
图2示出了电子设备100的结构示意图。电子设备100可以是客户端或服务器。以客户端是手机为例,如图2所示,手机可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块 170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是手机的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为手机充电,也可以用于手机与外围设备之间传输数据。充电管理模块140用于从充电器接收充电输入。电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
手机的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。天线1和天线2用于发射和接收电磁波信号。手机中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在手机上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
无线通信模块160可以提供应用在手机上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无 线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得手机可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
显示屏194用于显示应用的显示界面等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,手机可以包括1个或N个显示屏194,N为大于1的正整数。
手机可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,手机可以包括1个或N个摄像头193,N为大于1的正整数。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行手机的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,以及至少一个应用程序(例如爱奇艺应用,微信应用等)的软件代码等。存储数据区可存储手机使用过程中所产生的数据(例如图像、视频等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展手机的存 储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将图片,视频等文件保存在外部存储卡中。
手机可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。手机可以接收按键输入,产生与手机的用户设置以及功能控制有关的键信号输入。马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和手机的接触和分离。
可以理解的是,图2所示的部件并不构成对手机的具体限定。本发明实施例中的手机可以包括比图2中更多或更少的部件。比如,手机中还可以包括传感器模块(图中未示出),所述传感器模块包括压力传感器、陀螺仪传感器、温度传感器等等。此外,图2中的部件之间的组合/连接关系也是可以调整修改的。
下面以客户端是手机为例,结合附图介绍本申请实施例提供的技术方案。
请参见图3,为本申请实施例提供的连接探测方法的流程示意图。该方法适用于图1所示的通信系统。如图3所示,该方法的流程包括:
S1,客户端与服务端建立连接。所述连接可以是TCP连接或QUIC连接。
示例性的,S1可以通过三次握手过程实现。一种可能的实现方式包括:第一次握手:客户端向服务端发送第一握手请求,第一握手请求中携带标志位SYN=1,初始序号seq=x。其中,标志位SYN设置为1,用于指示客户端进入SYN-sent状态。序号seq=x是客户端随机生成的,在后续握手过程中使用。第二次握手:服务端点接收到第一握手请求之后,从第一握手请求中的标志位SYN=1得知客户端请求建立连接。若服务端同意建立连接,则向客户端发送确认(acknowledge,ACK)信息,在ACK消息中标志位SYN=1,确认号ack=x+1,随机产生一个序号seq=y。其中,标志位SYN=1用于指示服务端进入SYN-received状态,确认号是服务端根据第一握手请求中的seq=x生成的,服务端随机产生一个值seq=y,在后续握手过程中使用。第三次握手,客户端接收到服务端发送的ACK信息之后,向服务端发送确认信息,所述确认信息中包括确认号ack=y+1,序号seq=x+1,客户端进入established(已建立连接)状态。当服务端点接收到确认信息后,也进入established(已建立连接)状态。三次握手完成后,客户端与服务端之间建立连接。需要说明的是,前面以三次握手为例进行介绍,还可以是四次、更多或更少次握手过程,本申请实施例对此不作限定。
S2,根据服务端当前业务量,和/或,所述连接的当前连接状态确定探测周期。
具体来说,包括两种方式:第一种方式,根据服务端当前业务量确定探测周期。第二种方式,根据所述连接的当前连接状态确定探测周期。下面分别介绍这两种实现方式。
第一种方式,根据服务端当前业务量确定探测周期。其中,所述服务端当前业务量包括服务端当前设备接入量、当前待处理报文数量、以及服务端本地运行负载中的至少一项。
方式一,根据服务端当前设备接入量,确定探测周期。
其中,连接到服务端的设备包括移动终端、网关设备、负载均衡设备(Load Balance,LB)、网络地址转换(Network Address Translation,NAT)设备等中的至少一种设备。当连接到服务端的设备数量较高时,探测周期较长;当连接到服务端的设备数量较少时,探测周期较短。示例性的,服务端中可以存储服务端的设备接入量与探测周期之间的映射关系,当统计出服务端的设备接入量时,基于该映射关系,确定探测周期。
方式二,根据服务端当前待处理报文数量,确定探测周期。
其中,待处理报文包括握手报文、探测报文、网络资源请求报文等中的至少一种。其中,握手报文可以是第一次或第二次握手请求(请参见前文介绍),网络资源请求是指用于请求网络资源的请求,所述网络资源比如文字、图片、视频等等。当待处理报文数量较多时,确定较长的探测周期,以缓解阻塞情况。当待处理报文数量较少时,确定较短的探测周期,以及时恢复与客户端之间的连接。
方式三,根据服务端本地运行负载,确定探测周期。
其中,服务端本地运行负载可以包括服务端本地内存占用率、处理器运行速率、运行的进程量、进程运行速率、运行的线程量、线程运行速率等中的至少一项;其中,所述处理器可以是中央处理器(Central Processing Unit,CPU)或其他处理器。当本地运行负载较高时,确定的探测周期较长,当本地运行负载较低时,确定的探测周期较短。其中,服务端本地运行负载较高包括:服务端本地内存占用率大于阈值1、处理器运行速率小于阈值2、运行的进程量大于阈值3、进程运行速率小于阈值4、运行的线程量大于阈值5、线程运行速率小于阈值6等中的至少一项;其中,阈值1至阈值6的具体取值,本申请实施例不作限定。
进一步的,第一种方式还可以细化为,根据服务端的网络入口的当前业务量,确定所述网络入口对应的探测周期,所述网络入口对应的探测周期,适用于接入到所述网络入口的客户端。其中,网络入口的当前业务量包括网络入口当前设备接入量、网络入口当前待处理报文数量、以及网络入口所消耗的本地运行负载中的至少一项。示例性的,请参见图4,服务端包括网络入口A和网络入口B,客户端1和客户端2通过网络入口A接入服务端,客户端3通过网络入口B接入服务端。因此,服务端可以统计各个网络入口的当前业务量,根据网络入口A的当前业务量确定出探测周期1,根据网络入口B的当前业务量确定出探测周期2,那么接入到网络入口A的客户端(即客户端1和客户端2)以探测周期1向服务端发送探测信号,接入到网络入口B的客户端(即客户端3)以探测周期2向服务端发送探测信号。举例来说,当网络入口A出现异常(比如堵塞、服务升级等等)导致该网络入口A对应的连接异常时,客户端1和客户端2可以以探测周期1向网络入口A发送探测信号,该探测周期1是与网络入口A的当前业务量适配的,避免网络入口A的客户端(客户端1和/或客户端2)频繁地向网络入口A发送探测信号,进一步加剧网络入口A的堵塞情况。
第二种方式,根据所述连接的当前连接状态确定探测周期。其中,连接状态包括:连接发生过异常的次数、频率、时长、以及响应时延、传输速率、丢包率中的至少一项。示例性的,探测周期与所述连接的当前连接状态相关。比如,探测周期与所述连接的当前连接状态呈正比或反比。
作为一种示例,连接发生过异常的次数、频率或时长越小,探测周期越短;也就是说,连接刚发生异常或者很少发生异常时,以较短的周期探测,保证尽快恢复连接,尽可能不 影响用户体验。或者,连接发生过异常的次数、频率或时长越大,探测周期越短;也就是说,对于经常发生异常或者异常很久的连接,以较短的周期探测,以尽快恢复连接。
作为另一种示例,连接的响应时延或丢包率越高,探测周期越短;一般,响应时延或丢包率越高网络卡顿越明显,以较短的周期探测,可以尽快恢复连接。或者,连接的响应时延或丢包率越低,探测周期越短;响应时延或丢包率越低网络卡顿越不明显,以较短的周期探测,可以保证用户体验不受影响。
在一些实施例中,客户端与服务端之间的连接包括多条,比如第一连接和第二连接。这种情况下,S2可以细化为,根据服务端在第一连接上的当前业务量,和/或,所述第一连接的当前连接状态确定第一探测周期,根据服务端在第二连接上的当前业务量,和/或,所述第二连接的当前连接状态确定第二探测周期,第一探测周期和第二探测周期可以相同或不同。也就是说,在客户端与服务端之间存在多条连接的情况下,可以确定每条连接对应的探测周期,粒度更细。
可选的,S2中确定的探测周期可以是一个值,也可以是一个周期范围,本申请实施例不作限定。
上述第一种方式和第二种方式可以单独使用,也可以结合使用,本申请实施例不作限定。比如,第一种方式和第二种方式结合时,先使用第一种方式确定一个周期范围,然后使用第二种方式在该范围内确定一个具体周期;或者,先使用第二种方式确定一个周期范围,然后使用第一种方式在该范围内确定一个具体周期。
可选的,S2之后,还可以包括步骤:确定是否启动探测退避功能。探测退避功能是指当客户端以某个周期发送探测信号之后如果未收到探测反馈则退避到一个更大的周期发送探测信号,以避免大量客户端以同样的周期集中发送探测信号导致服务端压力过大而崩溃。一种方式为,客户端本地已配置退避模式或非退避模式,比如客户端出厂之后默认配置了退避模式或非退避模式。另一种实现方式为,用户可以设置退避模式或非退避模式。比如,用户在客户端上进行设置。又一种实现方式为,服务端向客户端指示是否退避。比如,服务端向客户端发送用于指示是否启动退避模式的第一指示信息。示例性的,第一指示信息为1时,用于指示需要启动退避模式,第一指示信息为0时,用于指示不需要启动退避模式。可以理解的是,服务端可以主动向客户端发送第一指示信息,或者,服务端接收到客户端发送的查询信息之后向客户端发送第一指示信息,所述查询信息用于查询是否启动退避模式。
可选的,在确定需要退避后,还可以包括步骤:确定退避参数。退避参数包括退避规则,比如斐波那契数列退避规则、或者其他退避规则;或者,退避参数包括一系列的退避值,比如a,b,c,d,e五个参数。可以理解的是,退避参数可以是客户端本地配置好的,或者,服务端向客户端指示的,或者,用户设置的,比如用户在客户端上设置退避参数,具体方式本申请实施例不作限定。下面介绍两个退避示例。
示例1,退避参数包括斐波那契数列退避规则。其中,斐波那契数列退避规则是指每个数值是前两个数值之和。比如,斐波那契数列为:1、2、3、5、8、13…。其中,每个数值是前两个数值的和。因此,退避过程包括:以最小探测周期开始,按照斐波那契数列规则增大探测周期。比如最小探测周期是5s,那么按照斐波那契数列规则,探测周期包括:5s、6s、11s、17s、28s。那么客户端先以探测周期5s发送探测信号,如果未接收到反馈,以6s为探测周期发送探测信号,如果仍然未接收到反馈,以11s为探测周期发送探测周期, 以此类推。其中,最小探测周期可以是S2中确定的探测周期,或者是S2中确定的周期范围中的最小值。
示例2,退避参数包括一系列的退避值,比如a,b,c,d,e五个参数(单位可以是秒或毫秒等)。那么,客户端以最小探测周期开始,按照a,b,c,d,e五个参数逐渐增大探测周期。比如,最小探测周期是5s,那么探测周期包括:5s、5+a s、5+b s、5+c s、5+d s、5+e s。因此客户端先以探测周期5s发送探测信号,如果未收到反馈,以5+a s为探测周期发送探测信号,以此类推。其中,最小探测周期可以是S2中确定的探测周期,或者是S2中确定的周期范围中的最小值。
在一些实施例中,客户端基于最小探测周期和退避参数,不断增大探测周期时,当增大后的探测周期超过最大探测周期时,停止退避。举例来说,根据最小探测周期和斐波那契数列规则确定出探测周期序列包括:5s、6s、11s、17s、28s,如果最大探测周期是30s,那么达到28s之后,后续使用30s的探测周期,不会继续增大探测周期,因为28s的下一个周期是45s,超过了30s。达到最大探测周期之后,客户端可以一直使用最大探测周期进行探测,比如达到28s之后,如果仍然未收到服务端的探测响应,则继续使用30s这一周期进行探测。上面的退避过程中提到的最小探测周期和最大探测周期。在一种实施例中,最小探测周期可以是S2中确定的探测周期,或者是S2中确定的周期范围中的最小值。如果S2确定的是周期范围,最大探测周期可以是S2中确定的周期范围中的最大值,或者,是用户指定或系统默认或服务端指示的、大于最小探测周期的一个周期。
可选的,S2之后,还可以包括步骤:确定探测周期的生效连接;或者说,确定探测周期应用到的连接。客户端与服务端之间可以包括一条或多条连接,如果有多条连接,那么上面S2中确定的探测周期应用到多条连接中的至少一条。一种方式为,探测周期的生效连接是所有连接。另一种方式为,探测周期的生效连接是当前连接。所述当前连接是指客户端与服务端之间当前处于激活(active)态的连接,或者,处于未激活(inactive)态的连接,或者,客户端当前向服务端发送数据使用的连接。又一种方式为,探测周期的生效连接是指定连接,所述指定连接可以是多条连接中的一条或多条。其中,指定连接可以是客户端本地默认指定好的,或者,用户指定的,或者,服务端向客户端指定的。
可以理解的是,在确定探测周期的生效连接之后,还可以进一步确定启动退避模式的连接。比如,生效连接有M条,其中的至少一条可以启动退避模式,然后以探测周期为最小探测周期进行退避。其中,启动退避模式的连接可以是所有生效连接,或者指定的生效连接,本申请实施例不作限定。
可选的,S2之后,还可以包括步骤:确定是否配置了外置检测协议用于探测连接,其中,所述外置检测协议是指与当前协议不同的协议。比如,当前客户端与服务端之间的连接是QUIC连接,那么外置检测协议是与QUIC协议不同的其它协议,比如互联网控制消息协议(Internet Control Message Protocal,ICMP)、第六版互联网控制信息协议(Internet Control Message Protocol Version 6,ICMPv6)协议、双向转发检测(Bidirectional Forwarding Detection,BFD)协议等等。一种可实现方式为,客户端本地配置了外置检测协议,比如,客户端出厂之后默认配置了外置检测协议。另一种可实现方式为,用户可以配置外置检测协议,比如,用户可以在客户端侧配置外置检测协议。又一种实现方式为,服务端配置外置检测协议并通知客户端,比如服务端发送用于指示是否配置外置检测协议的第二指示信息。示例性的,第二指示信息为1时,用于指示配置外置检测协议,第二指示信息为0时, 用于指示未配置外置检测协议。可以理解的是,服务端发送的第二指示信息是1时,服务端还可以向客户端指示外置检测协议的具体协议类型,比如是ICMP/ICMPv6协议、还是BFD协议。如果配置了外置检测协议,那么客户端可以使用外置检测协议探测连接。具体的,客户端创建与服务端之间的外置检测协议会话,以所述外置检测协议会话所支持的探测周期发送探测信号。以外置检测协议是BFD协议为例,客户端创建与服务端之间的BFD协议会话,以BFD协议所支持的探测周期发送探测信号。其中,外置检测协议所支持的探测周期可以是客户端默认配置好的,或者,用户指定的,或者,服务端指示的,或者,协议中规定的,本申请实施例不作限定。这种方式中,客户端可以使用与当前协议不同的其它协议进行连接探测,比较灵活。
S3,客户端确定与服务端之间的连接异常。
在本申请实施例中,客户端与服务端之间的连接异常包括多种场景。
场景一、确定客户端与服务端之间的连接异常,包括:当客户端与服务端之间的连接满足:服务端响应时延大于第一阈值、数据传输速率小于第二阈值、丢包率大于第三阈值中的至少一项时,确定连接异常。
服务端响应时延是指客户端发出网络资源请求的第一时刻到接收到服务端反馈的网络资源的第二时刻之间的时长。其中,网络资源请求用于请求网络资源,所述网络资源可以是文字、图片、视频中的至少一种。本申请实施例中,客户端发出网络资源请求之后,可以启动计时器,当计时器达到第一阈值时,确定客户端与服务端之间的连接异常。示例性的,请参见图5中的(a),用户使用手机(客户端)上网搜索内容,但是一直未搜索到结果(比如用于指示搜索进度的进度条501变化缓慢),影响用户体验。
数据传输速率影响服务端响应时延,比如,数据传输速率太低,数据需要较长时间才能发送至对端。因此,本申请实施例中,当客户端与服务端之间的数据传输速率小于第二阈值时,确定客户端与服务端之间的连接异常。示例性的,请参见图5中的(b),用户使用手机(客户端)上的视频播放类应用观看电影,比如,用户点击第7集,区域502中显示正在准备、以及传输速率(如100kb/s)等信息,视频播放比较卡顿。
丢包率是指客户端与服务端之间的连接上发送数据的正确率,如果丢包率较高,会影响用户请求的网络资源的准确性。因此,本申请实施例中,如果客户端与服务端之间的连接的丢包率大于第三阈值,则确定所述连接异常。
上面第一阈值、第二阈值和第三阈值的具体取值,可以是客户端设置的,服务端设置的,或协议中规定的,或者,用户设置的,等等,本申请实施例对此不作限定。
场景二、确定客户端与服务端之间的连接异常,包括:客户端的网络接入方式发生更改。其中,所述客户端的网络接入方式发生更改,包括如下至少一项:
(1)由无线局域网切换为移动通信网络。
无线局域网可以是WIFI,比如,家里或公司的WIFI。示例性的,用户携带客户端从家里出门之后,客户端的网络接入方式由WIFI网络切换到移动通信网络(4G网络、3G网络或5G网络),确定客户端与服务端之间的连接异常。
(2)由移动通信网络的第一通信制式切换到第二通信制式。
移动通信网络的通信制式(或称为网络制式)包括但不限定于:长期演进(long term evolution,LTE)网络、全球移动通讯系统(global system of mobile communication,GSM)网络、码分多址(code division multiple access,CDMA)网络、宽带码分多址(wideband code  division multiple access,WCDMA)网络、通用移动通信系统(universal mobile telecommunications system,UMTS)等。以LTE为例,通信制式还可以进一步包括:第二代移动通信技术(2nd-Generation wireless telephone technology,2G)网络、第三代移动通信技术(3rd-Generation wireless telephone technology,3G)网络、第四代移动通信技术(4th-Generation wireless telephone technology,4G)网络以及第五代移动通信技术(5th-Generation wireless telephone technology,5G)网络,或者,未来第N代移动通信技术,N大于5。
示例性的,客户端从4G切换到3G,或者,从5G切换到4G时,确定客户端与服务端之间的连接异常。
(3)由第一局域网切换到第二局域网。
示例性的,用户从房间1进入房间2,那么从房间1的WIFI切换为房间2的WIFI,确定客户端与服务端之间的连接异常。
需要说明的是,当客户端的网络接入方式发生更改而导致客户端与服务端之间的连接异常的现象被称为连接迁移(Connection Migration)。简单来说,客户端与服务端之间的连接具有客户端地址和服务端地址,客户端地址即客户端上使用该连接传输数据的地址,服务端地址即服务端上使用该连接传输数据的地址。当客户端的网络接入方式发生更改时,所述连接的客户端地址会发生变化,所以需要将该连接的原来的客户端地址更改为新的客户端地址,即连接从原客户端地址迁移到新客户端地址。以网络接入方式由WIFI更改为4G为例,客户端地址发生变化,对于客户端与服务端之间的连接来说,该连接原来的客户端地址无法继续使用,需要迁移到新的客户端地址上。其中,客户端地址包括但不限定于IP地址和端口多元组,所述多元组可以是二元组、四元组或更多元组等等。
需要说明的是,上述S2和S3之间的执行顺序本申请不作限定。如果先执行S2后执行S3,即客户端与服务端之间的连接发生异常之前,就开始实时的确定探测周期,比如以一定的周期、周期性的执行S2,当在某个时刻确定连接异常时,使用在该时刻之前最新确定出的探测周期进行探测。如果先执行S3后执行S2,即客户端与服务端之间的连接发生异常之后,再确定探测周期。一种可实现方式为,客户端实时的感知服务端的业务量,当连接异常时,客户端根据发生异常之前所感知到的服务端的业务量确定探测周期或根据当前连接状态确定探测周期。
S4,客户端以第一周期向服务端发送探测信号。
具体地,S4至少包括步骤S41和S42。其中,S41,客户端在第一时刻向服务端发送探测信号1,如果在第二时刻之前未收到探测反馈,在第二时刻向服务端发送探测信号2,第一时刻与第二时刻之间的时长为第一周期。其中,第一周期可以是S2中确定出的探测周期,或者是S2中确定出的周期范围内的任一周期(比如周期范围内的最小值)。应理解,如果在第三时刻之前仍然未收到服务端的探测反馈,在第三时刻向服务端发送探测信号3,第三时刻与第二时刻之间的时长为第二周期,第二周期与第一周期可以相同或不同,比如,如果启动退避规则,第二周期可以是根据第一周期和退避参数计算出的周期。第二周期与第一周期可以相同或不同。
可选的,探测信号用于探测所述连接是否恢复,或,所述连接的服务端地址是否可达。应理解,探测信号中可以携带所述连接的连接标识,所述连接标识可以是连接ID、子流标识等。比如,如果客户端与服务端之间的连接是TCP连接,那么所述连接标识可以是子流 标识,所述子流标识可以是子流的地址标识,所述地址标识包括IP和端口二元组、双端IP和双端口四元组等或更多元组。如果客户端与服务端之间的连接是QUIC连接,所述连接标识可以是连接ID(connection ID)。
示例性的,探测信号可以是PATH_CHALLENGE帧、NEW_CONNECTION_ID帧、PADDING帧、Sync帧中的至少一种。
S5,服务端向客户段发送探测反馈。
可选的,所述探测反馈用于指示所述连接恢复;或者,所述连接的服务端地址可达。
示例性的,探测反馈可以是PATH_RESPONSE帧、ACK帧。
因此,上面的实施例中,在客户端与服务端之间的连接异常时,客户端以第一周期向服务端发送探测信号,第一周期与服务端当前的业务量适配,避免频繁发送探测信号导致服务端业务量过大而崩溃。
需要说明的是,图3中S2可以由服务端执行也可以由客户端执行。如果是客户端执行,可以包括客户端感知服务端当前业务量(可以实时的感知),然后根据服务端当前业务量和/或所述连接的当前连接状态确定探测周期。其中,客户端感知服务端当前业务量的方式有多种,比如,客户端实时的向服务端发送用于请求查询服务端当前业务量的查询请求,或者,客户端根据服务端的响应时延、传输速率、丢包率中的至少一项确定服务端当前业务量。示例性的,服务端的响应时延越长、传输速率越低、或丢包率越高、代表服务端的业务量越大。如果由服务端执行,就是服务端根据服务端当前业务量和/或所述连接的当前连接状态确定探测周期,然后下发给客户端,具体内容将在下文图6中介绍。
请参见图6,为本申请实施例提供的连接探测方法的另一种流程示意图。所述流程包括S1至S5。其中,S1、S3-S5的实现原理与图3中的S1、S3-S5的实现原理相同,所以此处不重复赘述。下面重点介绍S2。S2包括S21至S23。
S21,服务端根据当前业务量和/或连接的当前连接状态确定探测周期。
其中,服务端确定探测周期的方式与前面图3中S2中确定探测周期的方式的原理相同,具体地,包括第一种方式和第二种方式,第一种方式是根据服务端当前业务量确定探测周期,第二种方式是根据服务端与客户端当前连接状态确定探测周期,为了节省篇幅,不在此重复赘述。
S22,服务端根据探测周期,生成配置信息。
其中,配置信息包括如下信息一至信息七中的至少一种:
信息一、最小探测周期。最小探测周期可以是步骤S21确定出的探测周期。
信息二、用于指示是否启动退避模式的第一指示信息。示例性的,第一指示信息为1时,用于指示需要启动退避模式,第一指示信息为0时,用于指示不需要启动退避模式。
信息三、退避参数。退避参数包括退避规则,比如斐波那契数列退避规则或者其他退避规则;或者,退避参数包括一系列的退避值,比如a,b,c,d,e五个参数。可以理解的是,当第一指示信息为0时,配置信息中可以不包括退避参数,当第一指示信息为1时,配置信息中包括退避参数。
信息四、最大探测周期。最大探测周期用于指示客户端能够达到的最大周期,比如,客户端基于最小探测周期和退避参数,不断增大探测周期时,当增大后的探测周期达到最大探测周期时,停止退避。
信号五、应用的连接。应用的连接是指配置信息的生效连接。如果客户端与服务端之间有多条连接,信息五可以用于指示的所述多条连接中的至少一个连接可以应用配置信息。方式A,配置信息的生效连接是所有连接。方式B,配置信息的生效连接是当前连接,当前连接是指客户端与服务端之间当前处于激活(active)态的连接,或者,处于未激活(inactive)态的连接,或者,客户端当前向服务端发送数据使用的连接,或者,服务端向客户端发送配置信息时,用于承载所述配置信息的连接。方式C,配置信息的生效连接是指定连接。指定连接可以是客户端与服务端之间的多条连接中的至少一条。
示例性的,信息五是指示信息1(比如00)时,确定配置信息的生效连接是所有连接,信息五是指示信息2(比如01)时,确定配置信息的生效连接是当前连接,信息五是指示信息3(比如11)时,确定配置信息的生效连接是指定连接。当配置信息的生效连接是当前连接或指定连接时,信息五中还可以携带指定连接的连接标识。其中,连接标识可以是能够唯一标识连接的任何标识,比如连接ID,还可以是连接的端口地址,所述端口地址包括端口四元组或五元组等等。
信息六、用于指示是否配置外置检测协议的第二指示信息。示例性的,第二指示信息为1时,用于指示配置外置检测协议,第二指示信息为0时,用于指示未配置外置检测协议。在一些实施例中,信息六中还可以指示配置的外置检测协议的具体协议类型,比如,是ICMP/ICMPv6协议、还是BFD协议。
信息七,外置检测协议参数。信息七是指与信息六的相关参数。比如信息六指示配置了外置检测协议是ICMP协议,那么信息七中可以包括ICMP协议对应的探测周期。如果信息六指示配置了外置检测协议是BFD协议,那么信息七中可以包括BFD协议对应的探测周期。
S23,服务端向客户端发送配置信息。
示例性的,服务端可以主动向客户端发送配置信息,或者被动向客户端发送配置信息,比如,服务端接收到客户端发送的配置信息查询请求时,向客户端反馈配置信息。
可选的,S23可以在握手阶段执行,或者,握手之后进行数据传输时执行。以S23在握手阶段执行为例,例如服务端接收到第一次握手请求之后向客户端发送配置信息,所述配置信息可以携带在响应于第一次握手请求的ACK信息中。其中,握手阶段的过程请参见前文介绍。以S23在握手完成之后执行为例,客户端在检测到客户端与服务端之间的连接发生异常(比如首次异常)时,以本地配置周期(不考虑客户端业务量)向服务端发送探测信号,服务端响应于该探测信号向客户端发送探测反馈后,还可以向客户端发送配置信息,之后,客户端与服务端之间的连接再次发生异常时,可以使用第二种方案以配置信息所指示的探测周期进行探测。
可选的,如果使用客户端本地配置周期(不考虑客户端业务量)进行探测的方案称为第一种探测方案,将客户端使用根据客户端业务量确定出的探测周期进行探测的方案作为第二种探测方式。两种探测方案可以选择其中任意一种使用,或者,客户端上设置切换按键,通过该切换按键实现第一种探测方案和第二种探测方案的切换。
本申请实施例提供的连接探测方法(比如图3或图6的流程图)可以适用于多连接场景。所述多连接是指客户端与服务端之间包括多条连接,比如MPTCP连接和MPQUIC连接等等。下文以MPTCP连接场景和MPQUIC连接场景为例进行介绍。
一、MPTCP连接场景。
请参见图7,为本申请实施例提供的MPTCP连接场景的示意图。如图7,客户端与服务端之间包括两条TCP连接,即第一TCP连接和第二TCP连接。其中,第一TCP连接可以是客户端使用Wi-Fi网络资源与服务端进行数据传输,第二TCP连接可以是客户端使用LTE网络资源与服务端进行数据传输。在一些实施例中,第一TCP连接和第二TCP连接是同一个TCP连接下的不同TCP子流(subflow),或者,第一TCP连接和第二TCP连接是不同的TCP连接。下文以第一TCP连接和第二TCP连接是同一个TCP连接下的不同TCP子流为例介绍的。具体的,服务端的MPTCP层将TCP流分解成两个TCP子流后通过两个TCP连接分别独立传输至服务端,服务端接收到两个TCP子流之后,将这两个TCP子流合并发送给应用层。这种多个TCP子流并行传输的方式,提升数据传输效率。
请参见图8,为本申请实施例提供的MPTCP连接场景下的连接探测方法的流程示意图。该方法可以适用于图7所示的MPTCP连接场景。如图8所示,所述方法流程包括:
S801,客户端与服务端建立第一TCP连接。
S802,客户端与服务端建立第二TCP连接。
以第一TCP连接和第二TCP连接是同一个TCP连接下的不同TCP子流为例,第一TCP连接对应的连接标识可以是TCP子流标识1,TCP连接对应的连接标识可以是TCP子流标识2。TCP子流标识可以包括子流地址(Address)或子流地址ID(Address ID),其中,子流地址可以是端口地址,所述端口地址可以是端口二元组、四元组或更多元组。
S803,服务端根据当前业务量,和/或,当前连接状态确定探测周期。
其中,服务端确定探测周期的原理与图3中S2的实现原理相同,不重复赘述。
S804,服务端根据探测周期,生成配置信息。
其中,服务端生成配置信息的过程与图6中S2的原理相同,在此不重复赘述。配置信息包括最小探测周期、用于指示是否启动退避模式的第一指示信息、退避参数、最大探测周期、应用的连接、用于指示是否配置外置检测协议的第二指示信息、外置检测协议参数等中的至少一项。关于配置信息的介绍请参见图6中的S2的描述,不重复赘述。
S805,服务端通过第一TCP连接向客户端发送所述配置信息。
服务端生成配置信息之后,可以选择一条TCP连接向客户端下发配置信息,所述选择的一条TCP连接可以是多条TCP连接中任意一条,或者,是当前正在进行数据传输的TCP连接,或者,当前处于激活态的TCP连接,等等。
示例性的,所述配置信息可以参见下表1:
Figure PCTCN2022092770-appb-000002
其中,kind字段用于指示MPTCP。Length用于指示配置信息的长度,即占用的字节数。Subtype字段用于指示该信息是配置信息,比如指示该信息是PATH_DETECT_CTRL帧。E字段为0,用于指示需要向发送端反馈,E=1,表示发送端已收到。F字段用于指示应用到连接,例如0用于指示所有子流;1用于指示当前子流;2用于指示指定子流。r:保留位,默认为0。当F字段为2时,子流标识字段中包括子流标识,所述子流标识可以是子流的端口地址或子流地址ID,子流的端口地址可以是端口和IP二元组、双端IP和双端端口四元组等等。Probe Period字段,用于指示最小探测周期。可以理解的是,上表1所示的配置信息中还可以包括更多或更少的信息,比如还可以包括是否启动退避的指示信 息、退避规则、是否配置外置检测协议,外置检测协议参数等等。
S806,客户端确定第二TCP连接异常。
S807,客户端根据所述配置信息所指示的第一周期在第二TCP连接上向服务端发送探测信号。
示例性的,S807至少可以包括S807A和S807B。S807A,客户端在第一时刻向服务端发送探测信号1,如果在第二时刻之前未收到探测反馈,执行S807B,即,在第二时刻向服务端发送探测信号2,第一时刻与第二时刻之间的时长为第一周期。其中,第一周期可以是配置信息中所指示的探测周期,或者,配置信息所指示的周期范围内的任一周期。应理解,如果在第三时刻之前仍然未收到服务端的探测反馈,在第三时刻向服务端发送探测信号3,第三时刻与第二时刻之间的时长为第二周期,第二周期与第一周期可以相同或不同,比如,配置信息中指示启动退避模式的话,那么第一周期还可以是最小探测周期,第二周期可以是根据退避规则和第一周期计算出的周期。
示例性的,探测信号可以是Sync帧或其他帧,本申请实施例不作限定。
S808,客户端在第二TCP连接上接收到探测响应,恢复第二TCP连接状态,可以在第二TCP连接上重新发送业务数据。
示例性的,探测反馈可以是PATH_DETECT_CTRL帧。
也就是说,客户端从第一TCP连接接收到服务端发送的配置信息,当第二TCP连接异常时,可以使用所述配置信息所指示的探测周期进行探测。
二、MPQUIC连接场景。
请参见9,为本申请实施例提供的MPQUIC连接场景的示意图。如图9所示,客户端与服务端之间包括多条连接(Connection),每一条连接对应一个连接标识,所述连接标识为连接ID(Connection ID,CID)。示例性的,Connection1对应CID1,Connection2对应CID2,等等。在MPQUIC场景中CID可以唯一的标识一个连接。
请参见图10,为本申请实施例提供的MPQUIC连接场景下的连接探测方法的流程示意图。该方法可以适用于图9所示的MPQUIC连接场景。如图10所示,所述流程包括:
S1001,客户端与服务端建立第一QUIC连接。
S1002,客户端与服务端建立第二QUIC连接。
S1003,服务端根据当前业务量,和/或,当前连接状态确定探测周期。
其中,服务端确定探测周期的原理与图3中S2的实现原理相同,不重复赘述。
S1004,服务端根据探测周期,生成配置信息。
其中,服务端生成配置信息的过程,与图6中S2的原理相同,在此不重复赘述。配置信息包括最小探测周期、用于指示是否启动退避模式的第一指示信息、退避参数、最大探测周期、应用的连接、用于指示是否配置外置检测协议的第二指示信息、外置检测协议参数等中的至少一项。关于配置信息的介绍请参见图6中的S2的描述,不重复赘述。
示例性的,配置信息可以是PATH_DETECT_CTRL 帧。所述PATH_DETECT_CTRL 帧的定义可以参考如下:
PATH_DETECT_CTRL Frame{
Type(i)=TBD1(例如,0x3f)
minPP(i),//用于描述最小探测周期;
retreating Mode(i),//用于指示退避模式,例如0为不退避,1为斐波那契数列规则退 避,可以理解的是,当为0时,可以不包含maxPP(i)参数。
[maxPP(i)],//用于描述最大探测周期;
applicated connection flag(i),//用于指示应用到的连接,例如0为当前会话的所有连接;1为当前连接;2为指定连接;
[applicated connection id list(…)],//用于指示指定连接的连接ID。当applicated connection flag(i)为2时,applicated connection id list中包含连接ID,该连接ID用于指示指定连接。
S1005,服务端通过第一QUIC连接向客户端发送配置信息。
S1006,客户端确定第二QUIC连接异常。
S1007,客户端所述配置信息所指示的探测周期在第二QUIC连接上向服务端发送探测信号。例如,S1007包括S1007A和S1007B,S1007A为客户端在第一时刻通过第二QUIC连接向服务器发送探测信号1。S1007B为客户端在第二时刻通过第二QUIC连接向服务器发送探测信号2。第一时刻与第二时刻之间的时长为第一周期。
示例性的,所述探测信号可以是PATH_CHALLENGE帧。
S1008,客户端通过第二QUIC连接接收探测响应。
示例性的,所述探测响应可以是PATH_RESPONSE帧。
需要说明的是,本申请实施例提供的技术方案还可以适用于单连接。单连接可以理解为客户端与服务端之间包括一条连接,比如,可以是单TCP连接或单QUIC连接。一般,客户端与服务端之间存在单连接时,如果连接异常,那么会话断开,应用层会感知到连接异常,那么,应用层可以决定是否启动探测。当客户端与服务端之间存在多连接时,如果多连接中某个连接异常,整个会话不会断开,所以应用层不会感知到该连接异常,所以,协议层可以自行启动探测功能。因此,当本申请实施例提供的技术方案适用于单连接时,应用层可以使用本申请实施例提供的技术方案启动探测,当本申请实施例提供的技术方案适用于多连接时,协议层可以使用本申请实施例提供的技术方案启动探测。
基于相同的构思,图11所示为本申请提供的一种电子设备1100。该电子设备1100可以是前文中的客户端或者服务器。如图11所示,电子设备1100可以包括:一个或多个处理器1101;一个或多个存储器1102;通信接口1103,以及一个或多个计算机程序1104,上述各器件可以通过一个或多个通信总线1105连接。其中该一个或多个计算机程序1104被存储在上述存储器1102中并被配置为被该一个或多个处理器1101执行,该一个或多个计算机程序1104包括指令。
示例性的,当电子设备1100是前文中的客户端时,所述一个或多个计算机程序1104中包括的指令用于执行如上面相应实施例中客户端的相关步骤。通信接口1103用于实现客户端与其他设备(比如服务端)的通信,比如通信接口可以是收发器。
示例性的,当电子设备1100是前文中的服务端时,所述一个或多个计算机程序1104中包括的指令用于执行如上面相应实施例中服务端的相关步骤。通信接口1103用于实现服务端与其他设备(比如客户端)的通信,比如通信接口可以是收发器。
上述本申请提供的实施例中,从电子设备(例如服务端或客户端)作为执行主体的角度对本申请实施例提供的方法进行了介绍。为了实现上述本申请实施例提供的方法中的各 功能,电子设备可以包括硬件结构和/或软件模块,以硬件结构、软件模块、或硬件结构加软件模块的形式来实现上述各功能。上述各功能中的某个功能以硬件结构、软件模块、还是硬件结构加软件模块的方式来执行,取决于技术方案的特定应用和设计约束条件。
以上实施例中所用,根据上下文,术语“当…时”或“当…后”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。另外,在上述实施例中,使用诸如第一、第二之类的关系术语来区份一个实体和另一个实体,而并不限制这些实体之间的任何实际的关系和顺序。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。在不冲突的情况下,以上各实施例的方案都可以组合使用。
需要指出的是,本专利申请文件的一部分包含受著作权保护的内容。除了对专利局的专利文件或记录的专利文档内容制作副本以外,著作权人保留著作权。

Claims (20)

  1. 一种连接探测方法,其特征在于,应用于客户端,包括:
    确定所述客户端与服务端之间的连接异常;
    以第一周期向所述服务端发送探测信息,所述探测信息用于探测所述连接是否恢复;
    其中,所述第一周期与所述服务端当前业务量适配,和/或,与所述连接的当前连接状态相关。
  2. 根据权利要求1所述的方法,其特征在于,确定所述客户端与服务端之间的连接异常,包括:
    当所述连接满足如下条件中的至少一种时,确定所述连接异常;
    所述条件包括:所述服务端响应时延大于第一阈值、数据传输速率小于第二阈值、丢包率大于第三阈值。
  3. 根据权利要求1所述的方法,其特征在于,确定所述客户端与服务端之间的连接异常,包括:所述客户端的网络接入方式发生更改;
    其中,所述客户端的网络接入方式发生更改,包括如下至少一种:
    由无线局域网切换为移动通信网络;或者,
    由移动通信网络的第一通信制式切换到第二通信制式;或者,
    由第一局域网切换到第二局域网。
  4. 根据权利要求1-3任一所述的方法,其特征在于,所述第一周期与所述服务端当前业务量适配,包括如下至少一项:
    所述第一周期与所述服务端当前设备接入量相关;或者,
    所述第一周期与所述服务端当前待处理报文数量相关;或者,
    所述第一周期与所述服务端本地运行负载相关。
  5. 根据权利要求1-4任一所述的方法,其特征在于,所述第一周期与所述连接的当前连接状态相关,包括:
    所述连接的当前连接状态包括:所述连接发生过异常的次数、频率、时长、以及响应时延、传输速率、丢包率中的至少一项;
    所述第一周期与所述当前连接状态呈正比或反比。
  6. 根据权利要求1-5任一所述的方法,其特征在于,所述方法还包括:
    所述客户端接收所述服务端发送的配置信息,所述配置信息中包括如下至少一项:
    最小探测周期,用于指示所述客户端发送探测信息的最小周期;
    第一指示信息,用于指示所述客户端是否启动退避;
    退避参数,用于指示退避规则;
    最大探测周期,用于指示所述客户端发送探测信息的最大周期;其中,所述最小周期和/或所述最大周期是所述服务端根据当前业务量确定的;
    生效的连接,用于指示对所述配置信息生效的连接;
    第二指示信息,用于指示所述客户端是否使用其它协议发起探测,所述其它协议与所述连接对应的协议不同;
    第一协议,用于指示所述客户端基于所述第一协议发送探测信息,所述第一协议与所述连接对应的协议不同;
    第一协议相关参数,用于指示所述第一协议所支持的探测周期。
  7. 根据权利要求6所述的方法,其特征在于,所述客户端与所述服务端之间包括多条连接,所述生效的连接包括指定连接、所有连接、当前连接中的至少一项;其中,所述当前连接是指所述客户端与所述服务端传输所述配置信息的连接。
  8. 根据权利要求1-7任一所述的方法,其特征在于,所述连接包括第一连接和第二连接;所述方法还包括:
    所述客户端通过所述第一连接接收所述服务端配置的所述第一周期;
    所述客户端确定所述第二连接发生异常时,以第二周期通过所述第二连接向所述服务端发送探测信号,所述探测信号用于探测所述第二连接是否恢复,所述第二周期等于所述第一周期,或所述第二周期是根据所述第一周期和退避参数计算出的。
  9. 根据权利要求1-8任一所述的方法,其特征在于,所述连接包括第一连接和第二连接,所述第一连接对应的第三周期与所述服务端在所述第一连接上的业务量适配,和/或与所述第一连接的当前连接状态相关;
    所述第二连接对应的第四周期与所述服务端在所述第二连接上的业务量适配,和/或与所述第二连接的当前连接状态相关。
  10. 一种连接探测方法,其特征在于,应用于服务端,包括:
    确定所述服务器当前状态,所述当前状态包括所述服务端当前业务量,和/或,所述服务器与客户端之间的连接的当前连接状态;
    根据所述当前状态,确定第一周期,所述第一周期用于指示所述客户端向所述服务端发送探测信息的周期。
  11. 根据权利要求10所述的方法,其特征在于,根据所述当前状态,确定第一周期,包括如下至少一项:
    所述第一周期与所述服务端当前设备接入量相关;或者,
    所述第一周期与所述服务端当前待处理报文数量相关;或者,
    所述第一周期与所述服务端本地运行负载相关。
  12. 根据权利要求11所述的方法,其特征在于,根据所述当前状态,确定第一周期,包括:
    所述连接的当前连接状态包括:所述连接发生过异常的次数、频率、时长、以及响应时延、传输速率、丢包率中的至少一项;
    所述第一周期与所述当前连接状态呈正比或反比。
  13. 根据权利要求10-12任一所述的方法,其特征在于,所述方法还包括:
    向所述客户端发送配置信息,所述配置信息中包括如下至少一项:
    最小探测周期,用于指示所述客户端发送探测信息的最小周期;
    第一指示信息,用于指示所述客户端是否启动退避;
    退避参数,用于指示退避规则;
    最大探测周期,用于指示所述客户端发送探测信息的最大周期;其中,所述最小周期和/或所述最大周期是所述服务端根据当前业务量确定的;
    生效的连接,用于指示对所述配置信息生效的连接;
    第二指示信息,用于指示所述客户端是否使用其它协议发起探测,所述其它协议与所述连接对应的协议不同;
    第一协议,用于指示所述客户端基于所述第一协议发送探测信息,所述第一协议与所述连接对应的协议不同;
    第一协议相关参数,用于指示所述第一协议所支持的探测周期。
  14. 根据权利要求13所述的方法,其特征在于,所述客户端与所述服务端之间包括多条连接,所述生效的连接包括指定连接、所有连接、当前连接中的至少一项;其中,所述当前连接是指所述客户端与所述服务端传输所述配置信息的连接。
  15. 根据权利要求10-14任一所述的方法,其特征在于,所述连接包括第一连接和第二连接,所述第一连接对应的第三周期与所述服务端在所述第一连接上的业务量适配,和/或与所述第一连接的当前连接状态相关;
    所述第二连接对应的第四周期与所述服务端在所述第二连接上的业务量适配,和/或与所述第二连接的当前连接状态相关。
  16. 一种客户端,其特征在于,包括存储器和一个或多个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述处理器执行时,使得所述客户端执行如权利要求1至9中任一项所述的方法。
  17. 一种服务器,其特征在于,包括存储器和一个或多个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述处理器执行时,使得所述服务器执行如权利要求10至15中任一项所述的方法。
  18. 一种通信系统,其特征在于,包括:
    客户端,用于执行如权利要求1至9中任一项所述的方法;
    服务器,用于执行如权利要求10至15任一项所述的方法。
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括程序指令,当所述程序指令在计算机上运行时,使得所述计算机执行如权利要求1至9任一项所述的方法。
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括程序指令,当所述程序指令在计算机上运行时,使得所述计算机执行如权利要求10至15任一项所述的方法。
PCT/CN2022/092770 2021-06-25 2022-05-13 一种连接探测方法、客户端与服务器 WO2022267739A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110713070.1A CN115529255A (zh) 2021-06-25 2021-06-25 一种连接探测方法、客户端与服务器
CN202110713070.1 2021-06-25

Publications (1)

Publication Number Publication Date
WO2022267739A1 true WO2022267739A1 (zh) 2022-12-29

Family

ID=84544065

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092770 WO2022267739A1 (zh) 2021-06-25 2022-05-13 一种连接探测方法、客户端与服务器

Country Status (2)

Country Link
CN (1) CN115529255A (zh)
WO (1) WO2022267739A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07152706A (ja) * 1993-11-30 1995-06-16 Fuji Xerox Co Ltd ネットワーク・コンピュータ
CN104993951A (zh) * 2015-06-12 2015-10-21 上海斐讯数据通信技术有限公司 一种网络设备信息传送方法
CN107249136A (zh) * 2017-06-07 2017-10-13 北京潘达互娱科技有限公司 网络连接方法及装置
CN110753198A (zh) * 2018-07-24 2020-02-04 杭州海康威视数字技术股份有限公司 存储图像数据的方法和装置
CN112433908A (zh) * 2020-10-29 2021-03-02 苏州浪潮智能科技有限公司 确定检测服务器的间隔时间的方法、系统、设备及介质

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005236813A (ja) * 2004-02-20 2005-09-02 Ntt Docomo Inc ネットワーク装置の制御装置及び通信システム並びに異常検出方法
CN103685241A (zh) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 一种维持tcp长连接的自适应心跳方法及其系统
US20170223698A1 (en) * 2014-10-15 2017-08-03 Huaning Niu Ul traffic control method in tightly integrated wifi/lte
EP3879885A1 (en) * 2015-02-03 2021-09-15 Telefonaktiebolaget Lm Ericsson (Publ) Supporting real-time traffic steering between a first and a second communication network
CN106303702A (zh) * 2015-06-11 2017-01-04 阿里巴巴集团控股有限公司 连接状态检测方法、装置和智能电视系统
US10275301B2 (en) * 2015-09-29 2019-04-30 International Business Machines Corporation Detecting and analyzing performance anomalies of client-server based applications
CN106817267B (zh) * 2015-11-27 2020-05-19 华为技术有限公司 一种故障检测方法和设备
CN114363116A (zh) * 2018-04-08 2022-04-15 华为技术有限公司 监测业务质量的方法和装置
CN110324202B (zh) * 2019-05-31 2021-06-22 厦门网宿有限公司 一种探测线路质量的方法和装置
CN111193769A (zh) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 恢复长连接的方法、系统、装置、电子设备及存储介质
CN112235155B (zh) * 2020-09-24 2022-09-02 交控科技股份有限公司 协同编队业务通信环境的性能测试方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07152706A (ja) * 1993-11-30 1995-06-16 Fuji Xerox Co Ltd ネットワーク・コンピュータ
CN104993951A (zh) * 2015-06-12 2015-10-21 上海斐讯数据通信技术有限公司 一种网络设备信息传送方法
CN107249136A (zh) * 2017-06-07 2017-10-13 北京潘达互娱科技有限公司 网络连接方法及装置
CN110753198A (zh) * 2018-07-24 2020-02-04 杭州海康威视数字技术股份有限公司 存储图像数据的方法和装置
CN112433908A (zh) * 2020-10-29 2021-03-02 苏州浪潮智能科技有限公司 确定检测服务器的间隔时间的方法、系统、设备及介质

Also Published As

Publication number Publication date
CN115529255A (zh) 2022-12-27

Similar Documents

Publication Publication Date Title
US10693969B2 (en) Electronic device using logical channels for communication
US9036517B2 (en) Methods and apparatus for establishing a tunneled direct link setup (TDLS) session between devices in a wireless network
WO2021057429A1 (zh) 一种数据传输方法及电子设备
EP4135405A1 (en) Channel switching method, and electronic device and storage medium
CN109088799B (zh) 一种客户端接入方法、装置、终端以及存储介质
WO2016112728A1 (zh) 一种数据传输的方法、网络服务器、用户终端及系统
WO2021098533A1 (zh) 一种连接建立方法及终端设备
CN112291366B (zh) 数据传输方法、装置、存储介质及电子设备
US20140149603A1 (en) Apparatus and method of enabling to transceive data using a plurality of heterogeneous networks selectively through a fixed host address
EP4156766A1 (en) Data packet sending method and apparatus
WO2023065931A1 (zh) 一种电子设备的充电方法及电子设备
EP4216501A1 (en) Method for switching channels, electronic device, and storage medium
WO2021179990A1 (zh) 一种应用服务器的访问方法及终端
WO2022143508A1 (zh) 一种近场中传输数据的方法、设备及系统
US20220286731A1 (en) Multimedia apparatus and cast method
CN112583822A (zh) 通信设备及通信方法
WO2022267739A1 (zh) 一种连接探测方法、客户端与服务器
EP4247060A1 (en) Communication configuration method and apparatus
WO2022001639A1 (zh) 通信方法、移动设备及路由设备
CN117278542A (zh) 资源访问方法和终端设备
WO2023030386A1 (zh) 一种数据传输方法、电子设备和装置
EP4354917A1 (en) Data processing method and electronic device
CN117135682B (zh) 获取发送速率的方法、第一电子设备及存储介质
WO2023273464A1 (zh) 一种数据传输方法和电子设备
RU2802678C1 (ru) Способ переключения каналов, электронное устройство и носитель хранения данных

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22827237

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE