WO2018145481A1 - Method and device for transmitting packet - Google Patents

Method and device for transmitting packet Download PDF

Info

Publication number
WO2018145481A1
WO2018145481A1 PCT/CN2017/105870 CN2017105870W WO2018145481A1 WO 2018145481 A1 WO2018145481 A1 WO 2018145481A1 CN 2017105870 W CN2017105870 W CN 2017105870W WO 2018145481 A1 WO2018145481 A1 WO 2018145481A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
mfl
tcp connection
link state
state information
Prior art date
Application number
PCT/CN2017/105870
Other languages
French (fr)
Chinese (zh)
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 WO2018145481A1 publication Critical patent/WO2018145481A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/36Flow control; Congestion control by determining packet size, e.g. maximum transfer unit [MTU]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • 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/0823Errors, e.g. transmission errors
    • H04L43/0829Packet loss
    • 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/0852Delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/36Flow control; Congestion control by determining packet size, e.g. maximum transfer unit [MTU]
    • H04L47/365Dynamic adaptation of the packet size
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/166IP fragmentation; TCP segmentation

Definitions

  • the present invention relates to the field of communications, and more particularly to a method and apparatus for transmitting a message.
  • SSL Secure Sockets Layer
  • TLS Transport Layer Security
  • SSL/TLS Data encryption (Encryption) technology ensures that data is not intercepted and eavesdropped during transmission over the network.
  • the SSL/TLS protocol is located between the TCP/IP protocol and various application layer protocols to provide security support for data communication.
  • SSL is a layer protocol between the application layer and the TCP/IP (Transmission Control Protocol/Internet Protocol) layer.
  • the application data needs to be processed by the SSL layer before the data can pass through the TCP/IP layer. Send it out.
  • the application data is processed in units of TLS records (SSL Record), and the TLS record size has a specification limit.
  • SSL Record TLS records
  • the SSL protocol divides the application data according to the TLS record.
  • the SSL protocol stack compresses each MAC address, adds a MAC address, encrypts and decrypts the data, and so on.
  • the encrypted data is sent to the TCP interface in turn.
  • the embodiments of the present invention provide a method and a device for transmitting a message, which can adjust the specification of the TLS record more flexibly according to the network environment, reduce the delay of acquiring data by the application layer, and make the data transmission more smooth. .
  • An embodiment of the present invention provides a method for sending a message, where the method includes: sending, by the sending end of the first TCP connection, the first packet of the first TCP connection, where the first TCP connection is the largest.
  • the slice length MFL is a first value
  • the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and the specification of the TLS record of the first packet is the first.
  • the value of the link state information of the first TCP connection is changed, the link state information is used to indicate the transmission performance of the TCP connection; and the sender is changed according to the change of the link state information. Adjusting the MFL of the first TCP connection to a second value; the sending end sends the second packet of the first TCP connection to the opposite end of the first TCP connection, and the MFL of the second packet Is the second value.
  • the TCP connection is any TCP connection that uses the TLS layer to process data.
  • the link state information includes at least one of a round trip delay RTT, a congestion window CWND, and a packet loss ratio.
  • the sender may send the peer end of the sender to the first TCP connection, that is, the device represented by the destination address in the TCP packet corresponding to the first packet. Alternatively, it may be transmitted to an I/O (input/output) device of a physical machine corresponding to the transmitting end.
  • I/O input/output
  • the MFL ranges from 1300 Bytes to greater than or equal to 16 KB.
  • the sending by the sending end, adjusting the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating the range of values of the MFL The probability that the packet corresponding to the multiple values is successfully sent; the MFL of the TCP connection is adjusted to the second value of the plurality of values, and the probability that the packet corresponding to the second value is successfully sent is The maximum value of the probability that the packet corresponding to the multiple values is successfully transmitted.
  • the sending by the sending end, adjusting the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating a probability that the packet of the first TCP connection is successfully sent; if the probability is increased, adjusting the MFL of the first TCP connection to a second value, where the second value is greater than the first value a value; the MFL of the first TCP connection is adjusted to a second value if the probability is reduced, wherein the second value is less than the first value.
  • the link state information includes a round-trip delay RTT
  • the sending end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including Resetting, in the case of the RTT, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; if the RTT is decreased, The MFL of the first TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
  • the MFL is pre-set with a value range
  • the link state information includes a round-trip delay RTT
  • the sending end uses the first TCP according to the change of the link state information.
  • Adjusting the connected MFL to a second value comprising: adjusting, when the RTT is increased, and the first value is less than a maximum value of the value range, adjusting the MFL of the first TCP connection to Binary value, the second value is half of the first value; in a case where the RTT is decreased, and the first value is greater than a minimum value of the value range, the first TCP is The connected MFL is adjusted to a second value, the second value being twice the first value; in the case where the RTT is increased, and the first value is a maximum value in the range of values Or, if the RTT is decreased, and the first value is a minimum value of the value range, adjusting the MFL of the first TCP connection to a second value, the second value Equal to the first value.
  • the MFL is pre-set with a value range
  • the MFL is pre-set with a value range
  • the link state information includes a congestion window CWND
  • the change according to the link state information is performed.
  • Adjusting, by the sending end, the MFL of the first TCP connection to a second value including: adjusting, when the CWND is increased, the MFL of the first TCP connection to a second value, the second value
  • the first value is less than or equal to; in the case that the CWND is decreased, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
  • the MFL is pre-set with a value range
  • the link state information includes a congestion window CWND
  • the sending end connects the first TCP according to the change of the link state information.
  • Adjusting the MFL to the second value including: adjusting, in the case that the CWND is increased, the MFL of the first TCP connection to a second value, where the second value is the CWND and the first TCP a product of a maximum message length MSS of the connection, and a smaller value of the first value, wherein, in a case where the product is smaller than a minimum value of the value range, the second value is the a minimum value in the range of values; adjusting the MFL of the first TCP connection to a second value, where the CWND is decreased, the second value being the CWND connected to the first TCP a product of a maximum message length MSS, and a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is
  • the determining the link state information of the first TCP connection is changed, including: detecting link state information of the first TCP connection when receiving a packet or sending a packet, Determining that the link state information changes; or detecting the link state information of the first TCP connection at a preset time or according to a preset time interval to determine that the link state information changes.
  • the link state information may be periodically detected according to a preset time or a preset time interval.
  • the sender is a terminal or a network device (such as a server), and the terminal or network device can also receive The terminal receives the data. That is to say, the determination of the link state information may be triggered in the form of an event trigger, for example, the event is that a message is received or a message is to be sent. It should be understood that when a message is received or a message is sent, it is indicated that the sender detects the received message or determines that the message is to be sent, due to the running process of the device (for example, the execution of the program or task). The delay should be tolerated.
  • a method for sending a message involves adjusting a size of a TLS record, and the method uses the MFL as a specification of the TLS record, based on the link information of the TCP connection corresponding to the TLS.
  • the value of the MFL is adjusted so that the specification of the TLS record can be flexibly adjusted according to the link state of the TCL connection, which reduces the delay of obtaining data by the application layer, and makes the data transmission smoother, thereby improving the communication performance.
  • the embodiment of the present invention further provides an apparatus for transmitting a message, where the apparatus includes a sending module, where the sending module is configured to send the first packet of the first TCP connection, the first TCP connection.
  • the maximum fragment length MFL is a first value
  • the MFL represents a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and the specification of the TLS record of the first packet is a first value
  • an adjustment module configured to determine a change in link state information of the first TCP connection, where the link state information is used to indicate a transmission performance of the TCP connection
  • the adjustment module is further configured to: Adjusting, according to the change of the link state information, the MFL of the first TCP connection to a second value
  • the sending module is further configured to send the first TCP connection to a peer end of the first TCP connection a second packet, where the MFL of the second packet is the second value.
  • the device is a device corresponding to the above method, please refer to the foregoing description of the method for explaining various implementations, descriptions and beneficial effects of the device.
  • the embodiment of the present invention further provides a device, configured to send a message
  • the device includes: a processing circuit, a communication interface, and a storage medium, where the storage medium stores a protocol stack program, and the communication interface
  • the processor is configured to implement the methods in the implementations of the first aspect by executing instructions in the storage medium.
  • a storage medium for storing program code for implementing the method of the implementations of the first aspect.
  • FIG. 1 is a schematic diagram of a process of processing application data through an SSL layer according to an embodiment of the present invention
  • FIG. 2 is a simplified block diagram of a communication system according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a transmitting end according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a method according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a device according to an embodiment of the present disclosure.
  • FIG. 6 is a structural diagram of another apparatus of a transmitting end according to an embodiment of the present invention.
  • the embodiment of the invention provides a method and a device for transmitting a message, and the following will be combined with the drawings in the embodiment of the present invention.
  • the technical solutions in the embodiments of the present invention are clearly and completely described. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
  • the CWND congestion window refers to the maximum number of data packets that can be sent at the source end of the data transmission in the case of congestion control. It should be understood that the congestion window is abbreviated as cwnd or CWND. For example, in some code, use cwnd to indicate.
  • Transport layer security (TLS), a communication security protocol used to protect data transfers between clients and/or server applications.
  • the protocol is located between the application layer and the TCP/IP stack.
  • the Message Authentication Code is a small piece of inspection information used to verify the integrity of a message.
  • Head of Line blocking (HoL), a phenomenon that limits transmission performance. Some packets caused by, for example, out-of-order transmission or HTTP piplining are caused by other data packets (for example, other data). Packet loss needs to be retransmitted) Delayed reporting to the application layer. It should be understood that the head blocking is abbreviated as HoL or HOL.
  • RTT Round-trip Time
  • RTT Round Trip Time
  • tcp_info_struct a parameter in the tcp_info structure (tcp_info_struct), which is used to describe the performance of the TCP connection, the RTT changes.
  • MFL Maximum fragment length
  • MSS a parameter in the tcp_info structure (tcp_info_struct), which is used to describe the size of the largest fragment of the TCP payload.
  • MAC Message Authentication Code
  • GSM Global System of Mobile communication
  • CDMA Code Division Multiple Access
  • TDSCDMA Time Division-Synchronous Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • GPRS General Packet Radio Service
  • LTE Long Term Evolution
  • SDN Software Defined Network
  • Wireless Sensor Network etc.
  • TLS is an upgraded version of SSL, so the industry sometimes uses SSL to represent TLS.
  • SSL provides at least one of the following services for communication in the network: authenticating the user and the server, ensuring that the data can be sent to the correct destination (such as a client or server); encrypting the data to prevent the data from being stolen during transmission; maintaining The integrity of the data to ensure that the data is not altered during transmission.
  • TLS is a fundamental protocol included in the operating environment in many commercial deployments. Almost half of Internet traffic is protected by TLS. However, its design does not consider how to effectively use low-latency or low-bandwidth types of networks, such as wireless and telecommunications networks.
  • FIG. 1 shows the processing procedure of the application data through the TLS layer.
  • application data is processed in units of TLS records.
  • the TLS layer fragments the application data in units of TLS records, assuming that the data is divided into n slices, the data length of the preceding n-1 fragments, and TLS.
  • the length of the record specification is the same.
  • the length of the nth slice data may generally be less than the length of one TLS record specification.
  • the TLS protocol stack compresses, adds MAC, encrypts and decrypts each record, and finally sends the encrypted data to the TCP interface for transmission.
  • the amount of data transmitted by the TLS protocol through tcp is strongly related to the amount of data of the TLS record. If the TLS record specification is larger, the packet sent by a tcp will be larger, if the TLS record specification The smaller, the smaller the packet sent by a tcp.
  • the TCP protocol requires strict data transmission in order, that is, for a group of data, when a Transport Protocol Data Unit (TPDU) is lost, the subsequent data unit can only wait for the TPDU that has been lost. After retransmission and reception, this set of data will be reported to the application layer.
  • This is the blocking problem of the head (of the head-of-line) of TCP.
  • TPDU Transport Protocol Data Unit
  • a packet is processed by the TLS layer, and the data stream is sequentially included as data 1 to data 4.
  • the peer needs to wait until the source retransmits the data 3 and receives the data 3, that is, After the data in the packet is received, the data 1 to 4 are parsed, and the parsed data is delivered to the application layer.
  • the receiving end After receiving the packet, the receiving end processes the TLS layer between the application layer and the TCP protocol layer, specifically encrypting and decrypting the application data and processing the MAC address. For example, in the decryption process, when a TLS record is received, the record is decrypted in the TLS protocol stack, and the MAC address is verified after successful decryption.
  • the TLS decryption process will fail because TLS does not receive a complete TLS record (the TLS can also be configured with no encryption mode, but in this mode, the MAC check of the data When the data is also verified to fail, the TLS decryption and verification will succeed only when the data of the entire TLS record is complete, and the decrypted data can be successfully sent to the application layer for processing.
  • the TLS mechanism even if the receiver receives 15k data in a record (for example, this record specification is 16k, 1k data loss during transmission), the application layer data cannot be processed at this time, and this time, the HoL problem will be suffered. Only after the lost packet is retransmitted, the TLS can decrypt the data normally after the entire recorded data is received, and the waiting time is a large delay.
  • TLS record specifications for communication.
  • Section 6.2.1 of the TLS standard document RFC5246 states that the specification of a TLS record cannot exceed 2 ⁇ 14 bytes (16 KB).
  • OpenTLS is the industry's most widely used open source code for implementing TLS. In the OpenTLS implementation, the TLS record size defaults to 16KB, and the size cannot be adjusted.
  • Mbedtls implements the TLS layer function, widely used, in the Mbedtls open source code implementation, gives the user the right to configure the specifications of the TLS record, the user is configured during the business initialization phase, not easy to configure Change, that is to say, once the specification of the TLS record is determined, it will be used in the subsequent communication process. If the specification of the TLS record needs to be adjusted, the user can re-initialize the service to reconfigure the specifications of the TLS record. It is only possible to start the business, and this process requires manual participation. It should be understood that the larger the specification of the TSL record, the more data is included in the record, and the easier it is to lose data in the transmission. Users can choose to configure the following five TLS record specifications for user configuration: 512 bytes, 1024 bytes, 2048 bytes, 4096 bytes, 8192 bytes, and 16384 bytes.
  • the above usage may bring a variety of problems. For example, if the link condition is too poor, if the TLS record size is too large, the network delay will be too large and the head of the network will be blocked. If the TLS record size is too small, the network throughput and utilization will be too low. waste.
  • the size of the TLS record is 16K, the packet loss rate is 5%, and the total delay is 67.4828414s;
  • the size of the TLS record is 1.5K, the packet loss rate is 0.1%, and the total delay is 13.1105458s.
  • the specification (size) of the TLS record is 1.5K, the packet loss rate is 5%, and the total delay is 78.5495714s.
  • FIG. 2 is a simplified block diagram of a communication system 100 according to an embodiment of the present invention.
  • the communication system 100 is only used as an application scenario of the present invention, and should not be construed as limiting the application scenario of the present invention.
  • the communication system comprises: a terminal 10, a server 20 and a network 30; wherein the terminal 10 is connected through an access device, such as a WLAN (Wireless Local Area Network), or a cellular network.
  • the ingress accesses the network 30 and establishes a connection with the server 20 based on a specific network protocol.
  • the server 20 transmits data, such as a video stream, to the terminal 10 using the established connection according to the request of the terminal 10.
  • a terminal a device that provides voice and/or data connectivity to a user, including a wireless terminal or a wired terminal.
  • the wireless terminal can be a handheld device with wireless connectivity, or other processing device connected to a wireless modem.
  • the wireless terminal can be a mobile phone (or "cellular" phone) or a computer with a mobile terminal.
  • the wireless terminal can also be a portable, pocket, handheld, computer built-in or in-vehicle mobile device.
  • the wireless terminal can be part of a mobile station (mobile station) or user equipment (English: user equipment, UE for short).
  • the term "data packet" in the specification and claims of the present invention and the above-mentioned drawings is the basic unit of network transmission, data organized in a certain format.
  • a packet can be divided into a header and a payload, where the header contains the necessary data transmission process.
  • Information such as address information, flag bits, etc.
  • the payload also known as the data portion, contains the content of the data being sent.
  • Network 30 may include a public network, a private network, a portion of the Internet, and/or any combination thereof. For the sake of brevity, other portions of network 30 have not been described.
  • Server 20 can be an application server, a server proxy, a data center server or a gateway.
  • a communication system can generally include fewer or more components than those shown in FIG. 2, and FIG. 2 only shows Components that are more relevant to implementations disclosed by embodiments of the present invention.
  • FIG. 2 shows Components that are more relevant to implementations disclosed by embodiments of the present invention.
  • a communication system can include any number of terminals and servers.
  • FIG. 3 shows the main components of the transmitting end of the embodiment of the present invention.
  • the transmitting end may be a server or a terminal. The following is a description of the sending end as a server.
  • the transmitting end includes a processor 201, a memory 202, and a network card (network). Interface card, NIC) 203.
  • the executable 202 is stored in the memory 202, and the executable program 21 includes an operating system and an application.
  • the processor 201 can execute the executable program 21 in the memory 202 to implement a particular function.
  • the server 20 and the terminal 10 include a protocol stack 204 and a protocol stack 11, respectively.
  • the protocol stack 204 After the data packet is processed by the protocol stack 204, it is sent to the terminal 10 through the transmitting circuit 231 of the network card 203.
  • the receiving circuit 232 receives the data packet of the application 12 running on the terminal 10 and transmits it to the protocol stack 204 for processing.
  • the protocol stack can be implemented by a suitable combination of software, hardware and/or firmware.
  • the protocol stack 204 and the protocol stack 11 include a TCP/IP (Transmission Control Protocol/Internet Protocol) protocol stack
  • TCP/IP protocol stack refers to a protocol stack implemented by a protocol family defined by the TCP/IP reference model.
  • the protocol family includes two core protocols: TCP (Transmission Control Protocol) and IP (Internet Protocol).
  • TCP Transmission Control Protocol
  • IP Internet Protocol
  • the protocol family contains protocols that are classified into five abstract "layers": The physical layer, the link layer, the network layer, the transport layer, and the application layer are all defined in the prior art, and are not described in detail in the embodiments of the present invention.
  • the SSL layer 13 is only schematically depicted in the terminal in FIG. In the server, the SSL layer can also exist. It should also be understood that in the prior art, the SSL layer in the upper layer cannot know the information of the lower layer (for example, the link state information of the TCP connection, and may include a round trip delay RTT, a congestion window CWND, etc.).
  • an adjustment module is deployed under the application layer above the TCP protocol layer, and the module can detect the link state of the TCP connection, thereby adjusting the MFL according to the link state of the connection, so that the MFL flexibly Match the link status of the network connection and improve the performance of the TCP connection, such as transmission delay.
  • this module is used at the origin of the data. Since the TCP connection is used for transmitting data, the data may be transmitted between the network devices or between the network device and the terminal, and the network device may be the server described above, or may be other devices in the network that can run the application layer. device. In a TCP connection, a network device or a terminal may be the origin of data.
  • the adjustment module can be a set of programs inserted in the TLS layer, or a thread, process, or container for implementing the above functions. This application file does not limit the specific implementation of the adjustment module.
  • the solution described in the present application provides a method for adjusting the size of a TLS record, which is based on information of a TCP layer (for example, tcp_info_struct), and the information of these TCP layers can be in actual communication process.
  • a TCP layer for example, tcp_info_struct
  • the method uses at least one of the RTTVAR or CWND parameters to adjust the specifications of the TLS record. It learns from the delay of TCP data, specifications, or changes in the congestion window, so that the length of the packet can be changed multiple times. Therefore, the length of the packet can match the TCP window. In this way, the bottleneck of HoL due to larger size packets can be overcome to some extent.
  • the default MFL record specification can be maintained during the handshake process. Once the handshake process is completed, the TLS record specification can be adjusted according to RTTVAR during the application data transmission process.
  • server 20 may include fewer or more components than those shown in FIG. 3, and FIG. 3 only shows more relevant to the various implementations disclosed in the embodiments of the present invention. component.
  • SSL is based on the TCP protocol for data transmission, between the receiving end and the originating end of the data transmission (that is, the client and the server), it is necessary to establish a TCP link first, that is, Three-way handshake (TCP Handshake).
  • TCP Handshake Three-way handshake
  • SSL handshake including Client/Server key exchange, Cert/Key/Cipher spec Negotiation and Exchange, and Handshake Complete.
  • Client/Server key exchange Client/Server key exchange
  • Cert/Key/Cipher spec Negotiation and Exchange and Handshake Complete.
  • the client and server need to complete the SSL link establishment.
  • the TLS record specifications are not dynamically adjusted during this phase.
  • the sender configures the default MFL.
  • the sender sends the data to the receiver using the default MFL.
  • the connection will always use the MFL to fragment the application data.
  • the transmitting end adjusts the size of the MFL, so that the transmitting end can use the adjusted MFL fragment data. Adjusting the MFL can be considered as the function of the above adjustment module. In other words, the specification of the TLS record is equal to the MFL. Adjusting the value of MFL is to adjust the specifications of the TLS record.
  • the present application describes a method for transmitting a message, the method comprising: sending, by the sending end of the first TCP connection, the first packet of the first TCP connection, the maximum fragment length of the first TCP connection
  • the MFL is a first value
  • the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and a specification of the TLS record of the first packet is the first value
  • the MFL of the first TCP connection is adjusted to a second value; the sending end sends the second packet of the first TCP connection to the opposite end of the first TCP connection, where the MFL of the second packet is the Two values.
  • the first TCP connection is a TCP connection.
  • the method for transmitting a message which involves adjusting a size of a TLS record
  • the specifications can be flexibly adjusted according to the link state of the TCL connection, which reduces the delay of obtaining data by the application layer, and makes the data transmission smoother, thereby improving the communication performance.
  • the link state information includes at least one of a round trip delay RTT, a congestion window CWND, and a packet loss ratio.
  • the value range of the MFL is greater than or equal to 1300 Bytes and less than or equal to 16 KB.
  • the transmitting end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating a probability that the packet of the first TCP connection is successfully sent; if the probability is increased, adjusting the MFL of the first TCP connection to a second value, where the second value is greater than the first value a value; the MFL of the first TCP connection is adjusted to a second value if the probability is reduced, wherein the second value is less than the first value.
  • the link state information includes a round-trip delay RTT
  • the sending end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including Resetting, in the case of the RTT, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; if the RTT is decreased, The MFL of the first TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
  • the MFL is pre-set with a value range
  • the link state information includes a round-trip delay RTT
  • the sending end uses the first TCP according to the change of the link state information.
  • Adjusting the connected MFL to a second value comprising: adjusting, when the RTT is increased, and the first value is less than a maximum value of the value range, adjusting the MFL of the first TCP connection to Binary value, the second value is half of the first value; in a case where the RTT is decreased, and the first value is greater than a minimum value of the value range, the first TCP is The connected MFL is adjusted to the second a value, the second value being twice the first value; in the case where the RTT is increased, and the first value is a maximum value in the value range, or, in the RTT And decreasing, and if the first value is a minimum value in the value range, adjusting the MFL of the first TCP connection to a second value, the second value being equal to the first value.
  • the link state can be measured by rtt later, so that the rtt change affects the relevant paragraph of the MFL change.
  • the MFL is pre-set with a value range
  • the link state information includes a congestion window CWND
  • the sending end connects the first TCP according to the change of the link state information.
  • Adjusting the MFL to a second value comprising: adjusting, when the CWND is increased, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; in the CWND In the case of a decrease, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
  • the MFL is pre-set with a value range
  • the link state information includes a congestion window CWND
  • the sending end connects the first TCP according to the change of the link state information.
  • Adjusting the MFL to the second value including: adjusting, in the case that the CWND is increased, the MFL of the first TCP connection to a second value, where the second value is the CWND and the first TCP a product of a maximum message length MSS of the connection, and a smaller value of the first value, wherein, in a case where the product is smaller than a minimum value of the value range, the second value is the a minimum value in the range of values; adjusting the MFL of the first TCP connection to a second value, where the CWND is decreased, the second value being the CWND connected to the first TCP a product of a maximum message length MSS, and a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is
  • the link state can be measured by CWND in the following text, so that the CWND change affects the relevant paragraph of the MFL change.
  • the determining the link state information of the first TCP connection is changed, including: detecting, when receiving a packet or sending a packet, link state information of the first TCP connection, Determining that the link state information changes; or detecting link state information of the first TCP connection according to a preset time or a preset time interval to determine that the link state information changes.
  • the scheme of the present application can be considered to measure the link state to dynamically adjust the MFL according to the link state.
  • the main logic of its implementation is as follows:
  • the link state is measured using the probability P (i.e., P x (L)), where P x (L) represents the probability that a packet of data amount X is transmitted successfully in the case where the link state is L.
  • P x (L) should actually be P(X, L), which is a binary function related to X and L, but for the convenience of analysis, one of the two variables is often fixed, and another variable is discussed.
  • P x (L) is used to represent the MFL, that is, the size of TLS record used to identify the TLS record.
  • the probability of successfully transmitting the data packet indicates that the data packet is successfully transmitted from the originating end to the receiving end at one time without any problems such as packet loss or retransmission.
  • P x (L) is related to link state L, and L can be measured by factors such as round trip delay (RTT), loss rate, congestion window (CWND), etc. L is larger, indicating link status. The worse, so P x (L) will be smaller accordingly. Specifically, follow the rules below
  • the adjustment module can trigger adjustments P x (L) in a number of ways.
  • it can be an event trigger mechanism.
  • the sending end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer
  • the current link state is detected.
  • the link state may also be saved.
  • the originating end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer
  • a link state change for example, detecting RTT, loss rate, and CWND
  • the transmitting end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer, it indicates that the sending end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer. Or a short period of time after the above events occur (it should be understood that the delay due to program execution, or processing delay can be tolerated).
  • a timer mechanism can also be used to trigger.
  • the time threshold may be set, and when the timer runs beyond the time threshold, the current link state is detected and compared with the previously recorded link state. (It should be understood that, in the case that the timer expires, Record the detected link status). Then, when the link state change is detected (for example, at least one of the RTT, the loss rate, and the CWND is detected to change), according to the above rule, the relationship between the preset link state and the P is used to adjust the P. The value of x (L), and restart the timer to wait for the next timeout, and then detect the link state.
  • the adjustment module can adjust the value of the MFL based on the change in P x (L).
  • X in P x (L) represents the amount of data of the packet. Since the data packet is encapsulated using MFL specifications, so in the case where P x (L) takes a value, which is P x (L) corresponding to the value of X is a value corresponding to the MFL P x (L) .
  • the Maximum Transmission Unit (MTU) in the TCP protocol is generally 1500 bytes (Byte). Because SSL encrypts data, it needs to fill data and add MAC to a record. The operation is such that the original data size before the 1500-byte (TCP) data is encrypted is about 1300 bytes (Byte), so the minimum Min_MFL is 1300 bytes (Byte); (2) The maximum specified in the SSL RFC The TLS record is 16 KB (Byte), so the maximum Max_MFL is taken as 16 KB (Byte).
  • the adjustment module can use a variety of methods to adjust the MFL based on P x (L).
  • the MFL matching the current link state can be taken from P x (L).
  • the range of values of X is: ⁇ 1300, 2k, 3k, 4k, 5k, 6k, 7k, 8k, 9k, 10k, 11k, 12k, 13k, 14k, 15k, 16k ⁇ , it should be understood that 2k means 2KB, 3k means 3KB, 4k means 4KB, and the rest 5k to 16k are similar. .
  • an exponential relationship adjustment can be used, that is, the MFL changes exponentially with a change in P x (L). For example, when L changes to cause P x (L) to become larger, MFL is adjusted to twice the original value of MFL; when L changes to cause P x (L) to become small, MFL is adjusted to the original value of MFL. One; when there is no change in P, there is no change in MFL. It should be understood that the range of the MFL is always within the preset range, that is, [1300 bytes, 16384 bytes].
  • the MFL can be adjusted in a progressive manner.
  • P x (L) becomes small
  • the range of the MFL is always within the preset range, that is, [1300 bytes, 16384 bytes].
  • the probability of successful data transmission can be considered from the perspective of the amount of data (or the number of data). That is to say, the specification of the TLS record (indicated by S, that is, the MFL) can also be adjusted in the following manner. It is assumed that Pr_s(K) is the probability that data K is successfully transmitted in a TLS record, and that the data arranged before the data K in the TLS record has been successfully transmitted.
  • the data K can be understood as the number of the TCP data of the data at the receiving end is K. It should be understood by those skilled in the art that the actual size refers to the size of the data included from the data numbered 1 to the data K.
  • the unit of K is KB.
  • K 1, that is, Pr_s(K) can be considered as the probability of successful transmission of 1Kb of data.
  • the meaning of Pr_s(K) is P x (L) as described above, and K can be regarded as X in P x (L).
  • the specification (S) of the TLS record can be expressed by K, where Pr_s(K) is related to at least one of the RTT, the loss rate, and the congestion window (cwnd).
  • a change in CWND causes a change in Pr_s(K). For example, if cwnd increases, Pr_s(K) decreases.
  • a change in the packet loss rate also causes a change in Pr_s(K). For example, if the packet loss rate increases, Pr_s(K) decreases. That is, S will change with Pr_s(K), and Pr_s(K) will vary with link quality parameters such as RTT, loss rate, and congestion window (cwnd).
  • Pr_s(K) decreases, S also decreases.
  • Pr_s(K) can be made to take the corresponding value of K of the maximum value.
  • curr_mfl is the maximum fragment length (MFL) used for current data transmission.
  • default_mfl is the default value of MFL. For example, it can be 16K.
  • max_mfl is the maximum value that MFL can increase to.
  • d) min_mfl is the minimum value that the MFL can be reduced to.
  • new_mfl is the new value of the MFL to be set for data transmission.
  • curr_rtt is estimated from tcp_info, the current value of rtt.
  • g) prev_rtt is the previous value of rtt, which is estimated during the last message transmission.
  • curr_cwnd is the current value of cwnd estimated from tcp_info.
  • prev_cwnd is the previous value of cwnd, which is estimated during the last message transmission.
  • MSS is the value of the largest segment estimated from tcp_info.
  • the link state is measured by rtt such that the rtt change affects the MFL change.
  • MFL has a preset initial value, and the range of MFL is limited to ⁇ 1300, 2k, 4k, 8k, 16k ⁇ . It should be understood that 2k represents 2KB, 4k represents 4KB, and the remaining 8k, 16k are similar.
  • the MFL is reduced to half of the original value (that is, the value before the change of rtt) (but for the MFL is 2k, due to the value range limitation, MFL The value is reduced to 1300 bytes.
  • the MFL When the rtt is detected to be small, indicating that the link condition is good, the MFL is expanded to twice the original value (but for the MFL is 1300 bytes, due to the value range limitation, The MFL is expanded to 2k); if the TCP link status is detected to have other changes or if the TCP link status is not detected to change, the MFL size is maintained.
  • the C language design code is as follows:
  • curr_mfl is set to default_mfl, that is, a preset value is set to the MFL, max_mfl is set to 16 KB, and min_mfl is 1300 Byte.
  • the link state is measured by cwnd, such that the cwnd change affects the MFL change.
  • cwnd the link state
  • it can be designed to estimate the current cwnd value according to the trigger condition (such as timing). If the cwnd value is found to change, then the MFL is assigned a new value, that is, the original value of the MFL is increased or decreased (ie, Cwnd The value before this change, which is curr_mfl).
  • curr_mfl is set to default_mfl, that is, a preset value is first set to the MFL
  • max_mfl is set to 16 KB
  • min_mfl 1300 Byte.
  • MSS can be introduced to control changes in MFL values along with cwnd. It can be implemented with the following code:
  • the MFL size is maintained.
  • the solution described in the present application provides a method for transmitting a message, which involves adjusting a size of a TLS record, and the method uses the MFL as a specification of the TLS record, based on the chain of the TCP connection corresponding to the TLS.
  • the road information adjusts the value of the MFL so that the specification of the TLS record can be flexibly adjusted according to the link state of the TCL connection, so that the data transmission is smoother, thereby improving the communication performance.
  • the present application describes a device 500 for transmitting a message
  • the device 500 includes a sending module 501 and an adjusting module 502, wherein the sending module 501 is configured to send the first TCP connection.
  • a first packet, a maximum fragment length MFL of the first TCP connection is a first value, and the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, where The specification of the TLS record of a message is the first value;
  • the adjusting module 502 is configured to determine that link state information of the first TCP connection changes, the link state information For indicating the transmission performance of the TCP connection; and adjusting the MFL of the first TCP connection to a second value according to the change of the link state information; the sending module 501 is further configured to connect to the first TCP connection Sending, by the terminal, the second packet of the first TCP connection, where the MFL of the second packet is the second value.
  • the adjusting module 502 is configured to determine that the link state information of the first TCP connection changes when the device receives the packet or sends a packet.
  • the adjusting module 502 is configured to periodically determine that the link state information of the first TCP connection changes at a preset time or according to a preset time interval.
  • the link state information includes at least one of a round trip delay RTT, a congestion window CWND, an average congestion window, and a packet loss ratio.
  • the value range of the MFL is greater than or equal to 1300 Bytes and less than or equal to 16 KB.
  • the sending device may send, to the first TCP connection, the opposite end (that is, the receiving end) of the transmitting end, that is, the device represented by the destination address in the TCP packet corresponding to the first packet.
  • the sending device may send, to the first TCP connection, the opposite end (that is, the receiving end) of the transmitting end, that is, the device represented by the destination address in the TCP packet corresponding to the first packet.
  • it may be transmitted to an I/O (input/output) device of a physical machine corresponding to the transmitting end.
  • the device is a device corresponding to the method embodiment described above. Therefore, regarding various implementations, specific implementation details, and related technical effects of the device, please refer to the foregoing description. In particular, how to adjust the MFL according to the change of the link state information, please refer to the various implementations described above.
  • the adjustment module can be understood as being located between the application layer and the TCP protocol layer, and the adjustment module can be a process or a thread, or can be a piece of executable code.
  • the present application provides an apparatus for transmitting a message, which involves adjusting a size of a TLS record.
  • the apparatus uses the MFL as a specification of the TLS record, and adjusts the MFL based on the link information of the TCP connection corresponding to the TLS.
  • the value of the TLS record can be flexibly adjusted according to the link state of the TCL connection, so that the data transmission is smoother, thereby improving the communication performance.
  • the transmitting end and the receiving end described in the foregoing method embodiments can be implemented by any device having data transceiving capability.
  • the sender can be a terminal or a server.
  • the transmitting device 300 includes a processing circuit 302, and a communication interface 304 and a storage medium 320 connected thereto.
  • the adjustment module mentioned above, and the method for sending a message mentioned above, may be implemented by the processing circuit 302 executing a program in the storage medium 320, which should be understood to involve sending or receiving other devices to other devices.
  • the information processing circuit 302 needs to execute a program in the storage medium 320 to invoke the communication interface 304.
  • Processing circuitry 302 is used to process data, control data access and storage, issue commands, and control other devices to perform operations. Processing circuitry 302 may be implemented as one or more processors, one or more controllers, and/or other structures that may be used to execute a program or the like. Processing circuitry 302 may specifically include at least one of a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic component.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a general purpose processor may include a microprocessor, as well as any conventional processor, controller, microcontroller, or state machine.
  • Processing circuit 302 can also be implemented as a computing component, such as a combination of a DSP and a microprocessor.
  • the storage medium 306 may include a computer readable storage medium such as a magnetic storage device (eg, a hard disk, a floppy disk, a magnetic strip), an optical storage medium (eg, a digital versatile disk (DVD)), a smart card, a flash memory device, a random access memory. (RAM), read only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), registers, and any combination thereof.
  • Storage medium 306 can be coupled to processing circuitry 302 such that processing circuitry 302 can read information and write information to storage medium 306.
  • storage medium 306 can be integrated into processing circuit 302, or storage medium 306 and processing circuit 302 can be separate.
  • Communication interface 304 may include circuitry and/or programs to enable two-way communication between user device 300 and one or more wireless network devices (eg, servers). Communication interface 304 can be coupled to one or more antennas (not shown in FIG. 6) and includes at least one receiving circuit 316 and/or at least one transmitting circuit 318. In one embodiment, communication interface 304 may be implemented in whole or in part by a wireless modem.
  • processing circuit 302 is adapted to execute protocol stack program 320 stored in storage medium 306 to implement some or all of the steps of the above method embodiments.
  • the apparatus 500 is a device that can transmit a TCP message processed through the TLS protocol layer, and may be, for example, a terminal or a network device.
  • the apparatus 500 can also be implemented by the transmitting device shown in FIG.
  • the sending module 501 can execute the program in the storage medium 320 by the processing circuit 302 to invoke the communication interface 304.
  • the adjusting module 502 can execute the program execution in the storage medium 320 by the processing circuit 302.
  • the TCP/IP protocol stack or the like mentioned above may be stored in the storage medium 320.

Abstract

Provided in embodiments of the present invention are a method and device for transmitting a packet, where a transmitting end of a first TCP connection transmits a first packet of the first TCP connection, the transmitting end determines that a change occurs in link state information of the first TCP connection, the link state information is used for expressing the transmission performance of the TCP connection; an MFL of the first TCP connection is adjusted to a second value on the basis of the change in the link state information; the transmitting end transmits a second packet of the first TCP connection to the correspondent end, and the specification of a TLS record of the second packet is the second value. As such, the specification of the TLS record can be flexibly adjusted on the basis of the network environment, thus allowing increased smoothness in the transmission of data.

Description

一种发送报文的方法及装置Method and device for transmitting message 技术领域Technical field
本发明涉及通信领域,更具体的涉及一种发送报文的方法及装置。The present invention relates to the field of communications, and more particularly to a method and apparatus for transmitting a message.
背景技术Background technique
人们的生活现在已经越来越离不开互联网,与此同时,隐私和安全问题日益重要。加密一直都是保护用户通讯隐私的重要特性。SSL(Secure Sockets Layer安全套接层)和TLS(Transport Layer Security,传输层安全)协议就是当前使用非常广泛的协议,事实上,TLS是SSL的升级版本,故业界有时也使用SSL表示TLS。根据国外部分研究机构的数据显示,已有接近60%的网络流量采用SSL/TLS进行加密保护。SSL/TLS用以保障在Internet上数据传输的安全,利用数据加密(Encryption)的技术,可确保数据在网络上的传输过程中不会被截取及窃听。SSL/TLS协议位于TCP/IP协议与各种应用层协议之间,为数据通讯提供安全支持。People's lives are now increasingly inseparable from the Internet, while privacy and security issues are increasingly important. Encryption has always been an important feature to protect the privacy of user communications. SSL (Secure Sockets Layer) and TLS (Transport Layer Security) protocols are widely used protocols. In fact, TLS is an upgraded version of SSL, so the industry sometimes uses SSL to represent TLS. According to data from some foreign research institutions, nearly 60% of network traffic has been encrypted with SSL/TLS. SSL/TLS is used to secure data transmission over the Internet. Data encryption (Encryption) technology ensures that data is not intercepted and eavesdropped during transmission over the network. The SSL/TLS protocol is located between the TCP/IP protocol and various application layer protocols to provide security support for data communication.
SSL是介于应用层和TCP/IP(Transmission Control Protocol/Internet Protocol传输控制协议/因特网互联协议)层之间的一层协议,应用数据需要先经过SSL层的处理,数据才能通过TCP/IP层发送出去。而在经过SSL层处理的过程中,以TLS记录(SSL Record)为单位处理应用数据,TLS记录大小有规格限制。当应用数据大小超过TLS记录规格的时候,SSL协议会对应用数据按照TLS记录为单位进行分片,分片完成后,SSL协议栈对每个记录进行压缩、添加MAC、加解密处理等,最后将加密的数据依次调用TCP接口发送出去。SSL is a layer protocol between the application layer and the TCP/IP (Transmission Control Protocol/Internet Protocol) layer. The application data needs to be processed by the SSL layer before the data can pass through the TCP/IP layer. Send it out. In the process of processing through the SSL layer, the application data is processed in units of TLS records (SSL Record), and the TLS record size has a specification limit. When the application data size exceeds the TLS record specification, the SSL protocol divides the application data according to the TLS record. After the fragmentation is completed, the SSL protocol stack compresses each MAC address, adds a MAC address, encrypts and decrypts the data, and so on. The encrypted data is sent to the TCP interface in turn.
然而现有技术中,使用的TLS记录的规格是固定的,无法适应多变的网络环境,从而引发例如应用层获取数据的时延较长等问题。However, in the prior art, the specifications of the TLS records used are fixed and cannot adapt to the changing network environment, thereby causing problems such as a long delay in acquiring data by the application layer.
发明内容Summary of the invention
有鉴于此,本发明实施例提供了一种发送报文的方法及装置,能够根据网络环境更灵活地调整TLS记录的规格,减小了应用层获取数据的时延,使得数据的传输更加流畅。In view of this, the embodiments of the present invention provide a method and a device for transmitting a message, which can adjust the specification of the TLS record more flexibly according to the network environment, reduce the delay of acquiring data by the application layer, and make the data transmission more smooth. .
本发明实施例的一个实施例中提供一种发送报文的方法,该方法包括:第一TCP连接的发送端发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;所述发送端确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息用于表示TCP连接的传输性能;根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值;所述发送端向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。An embodiment of the present invention provides a method for sending a message, where the method includes: sending, by the sending end of the first TCP connection, the first packet of the first TCP connection, where the first TCP connection is the largest. The slice length MFL is a first value, and the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and the specification of the TLS record of the first packet is the first The value of the link state information of the first TCP connection is changed, the link state information is used to indicate the transmission performance of the TCP connection; and the sender is changed according to the change of the link state information. Adjusting the MFL of the first TCP connection to a second value; the sending end sends the second packet of the first TCP connection to the opposite end of the first TCP connection, and the MFL of the second packet Is the second value.
应理解,该TCP连接为任意使用TLS层处理数据的TCP连接。其中,所述链路状态信息包括往返时延RTT,拥塞窗口CWND和丢包率中的至少一种。It should be understood that this TCP connection is any TCP connection that uses the TLS layer to process data. The link state information includes at least one of a round trip delay RTT, a congestion window CWND, and a packet loss ratio.
应理解,该发送端可以向该第一TCP连接中,该发送端的对端发送,也就是该第一报文对应的TCP报文中的目的地址所表示的设备。也可以是认为是向该发送端对应的物理机的I/O(input/output)设备发送。It should be understood that the sender may send the peer end of the sender to the first TCP connection, that is, the device represented by the destination address in the TCP packet corresponding to the first packet. Alternatively, it may be transmitted to an I/O (input/output) device of a physical machine corresponding to the transmitting end.
一种实现方式下,,所述MFL的取值范围为大于等于1300Byte,且小于等于16KB。In an implementation manner, the MFL ranges from 1300 Bytes to greater than or equal to 16 KB.
一种实现方式下,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:使用变化后的所述链路状态信息,计算所述MFL取值范围内 的多个值所对应的报文发送成功的概率;将所述一TCP连接的MFL调整为所述多个值中的第二值,所述第二值对应的报文发送成功的概率为所述多个值所对应的报文发送成功的概率中的最大值。In an implementation manner, the sending, by the sending end, adjusting the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating the range of values of the MFL The probability that the packet corresponding to the multiple values is successfully sent; the MFL of the TCP connection is adjusted to the second value of the plurality of values, and the probability that the packet corresponding to the second value is successfully sent is The maximum value of the probability that the packet corresponding to the multiple values is successfully transmitted.
一种实现方式下,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:使用变化后的所述链路状态信息,计算所述第一TCP连接的报文发送成功的概率;在所述概率增大的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值大于第一值;在所述概率减小的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值小于第一值。In an implementation manner, the sending, by the sending end, adjusting the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating a probability that the packet of the first TCP connection is successfully sent; if the probability is increased, adjusting the MFL of the first TCP connection to a second value, where the second value is greater than the first value a value; the MFL of the first TCP connection is adjusted to a second value if the probability is reduced, wherein the second value is less than the first value.
一种实现方式下,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述RTT增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述RTT减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In an implementation manner, the link state information includes a round-trip delay RTT, and the sending end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including Resetting, in the case of the RTT, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; if the RTT is decreased, The MFL of the first TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
一种实现方式下,所述MFL预设有取值范围,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述RTT增大,且所述第一值小于所述取值范围中的最大值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的一半;在所述RTT减小,且所述第一值大于所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的两倍;在所述RTT增大,且所述第一值为所述取值范围中的最大值的情况下,或者,在所述RTT减小,且所述第一值为所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值等于所述第一值。In an implementation manner, the MFL is pre-set with a value range, the link state information includes a round-trip delay RTT, and the sending end uses the first TCP according to the change of the link state information. Adjusting the connected MFL to a second value, comprising: adjusting, when the RTT is increased, and the first value is less than a maximum value of the value range, adjusting the MFL of the first TCP connection to Binary value, the second value is half of the first value; in a case where the RTT is decreased, and the first value is greater than a minimum value of the value range, the first TCP is The connected MFL is adjusted to a second value, the second value being twice the first value; in the case where the RTT is increased, and the first value is a maximum value in the range of values Or, if the RTT is decreased, and the first value is a minimum value of the value range, adjusting the MFL of the first TCP connection to a second value, the second value Equal to the first value.
一种实现方式下,所述MFL预设有取值范围,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In an implementation manner, the MFL is pre-set with a value range, and the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the change according to the link state information is performed. Adjusting, by the sending end, the MFL of the first TCP connection to a second value, including: adjusting, when the CWND is increased, the MFL of the first TCP connection to a second value, the second value The first value is less than or equal to; in the case that the CWND is decreased, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
一种实现方式下,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较小值,其中,在所述乘积小于所述取值范围中的最小值的情况下,所述第二值为所述取值范围中的最小值;在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较大值,其中,在所述乘积大于所述取值范围中的最大值的情况下,所述第二值为所述取值范围中的最大值。In an implementation manner, the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the sending end connects the first TCP according to the change of the link state information. Adjusting the MFL to the second value, including: adjusting, in the case that the CWND is increased, the MFL of the first TCP connection to a second value, where the second value is the CWND and the first TCP a product of a maximum message length MSS of the connection, and a smaller value of the first value, wherein, in a case where the product is smaller than a minimum value of the value range, the second value is the a minimum value in the range of values; adjusting the MFL of the first TCP connection to a second value, where the CWND is decreased, the second value being the CWND connected to the first TCP a product of a maximum message length MSS, and a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is the value The maximum value in the range.
在一种实现方式下,所述确定所述第一TCP连接的链路状态信息发生变化,包括:在接收到报文或者发送报文时,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化;或者,在预设的时刻或者根据预设的时间间隔,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化。另一方面,可以根据预设的时刻或者预设的时间间隔,周期性地检测该链路状态信息。In an implementation manner, the determining the link state information of the first TCP connection is changed, including: detecting link state information of the first TCP connection when receiving a packet or sending a packet, Determining that the link state information changes; or detecting the link state information of the first TCP connection at a preset time or according to a preset time interval to determine that the link state information changes. On the other hand, the link state information may be periodically detected according to a preset time or a preset time interval.
应理解,发送端是终端或者网络设备(如服务器),该终端或者网络设备也可以作为接收 端接收数据。也就是说,可以以事件触发的形式来触发对链路状态信息的确定,例如该事件为接收到报文或者将要发送报文。应当理解,这里所述的接收到报文或者发送报文时,是表示该发送端检测到接收到报文或者确定将要发送报文,由于设备的运行过程(例如程序或者任务的执行)而产生的时延是应当容忍的。It should be understood that the sender is a terminal or a network device (such as a server), and the terminal or network device can also receive The terminal receives the data. That is to say, the determination of the link state information may be triggered in the form of an event trigger, for example, the event is that a message is received or a message is to be sent. It should be understood that when a message is received or a message is sent, it is indicated that the sender detects the received message or determines that the message is to be sent, due to the running process of the device (for example, the execution of the program or task). The delay should be tolerated.
在本发明实施例中,提供了一种发送报文的方法,其中涉及调整TLS记录的规格(size),该方法使用MFL作为TLS记录的规格,基于该TLS对应的TCP连接的链路信息,调整MFL的值,从而使得TLS记录的规格能够根据TCL连接的链路状态灵活地调整,减小了应用层获得数据的时延,使得数据的传输更加流畅,从而提高了通信的性能。In the embodiment of the present invention, a method for sending a message is provided, which involves adjusting a size of a TLS record, and the method uses the MFL as a specification of the TLS record, based on the link information of the TCP connection corresponding to the TLS. The value of the MFL is adjusted so that the specification of the TLS record can be flexibly adjusted according to the link state of the TCL connection, which reduces the delay of obtaining data by the application layer, and makes the data transmission smoother, thereby improving the communication performance.
另一方面,本发明实施例中还提供一种发送报文的装置,该装置包括发送模块,所述发送模块用于发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;调整模块,所述调整模块用于确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息用于表示TCP连接的传输性能;所述调整模块还用于根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值;所述发送模块还用于向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。On the other hand, the embodiment of the present invention further provides an apparatus for transmitting a message, where the apparatus includes a sending module, where the sending module is configured to send the first packet of the first TCP connection, the first TCP connection. The maximum fragment length MFL is a first value, and the MFL represents a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and the specification of the TLS record of the first packet is a first value; an adjustment module, configured to determine a change in link state information of the first TCP connection, where the link state information is used to indicate a transmission performance of the TCP connection; the adjustment module is further configured to: Adjusting, according to the change of the link state information, the MFL of the first TCP connection to a second value; the sending module is further configured to send the first TCP connection to a peer end of the first TCP connection a second packet, where the MFL of the second packet is the second value.
由于该装置是上述方法对应的装置,故该装置的各种实现方式、说明及有益效果的阐述,请参照前文对方法的说明。Since the device is a device corresponding to the above method, please refer to the foregoing description of the method for explaining various implementations, descriptions and beneficial effects of the device.
第三方面,本发明实施例中还提供一种设备,用于发送报文,所述设备包括:处理电路、通信接口和存储介质,所述存储介质中存储有协议栈程序,所述通信接口用于通过执行所述存储介质中的程序与其他设备收发信息,所述处理器用于通过运行所述存储介质中的指令,以实现第一方面中各实现方式中的方法。In a third aspect, the embodiment of the present invention further provides a device, configured to send a message, where the device includes: a processing circuit, a communication interface, and a storage medium, where the storage medium stores a protocol stack program, and the communication interface For transmitting and receiving information with other devices by executing a program in the storage medium, the processor is configured to implement the methods in the implementations of the first aspect by executing instructions in the storage medium.
第四方面,还提供一种存储介质,该存储介质用于存储用于实现第一方面中各实现方式中的方法的程序代码。In a fourth aspect, there is also provided a storage medium for storing program code for implementing the method of the implementations of the first aspect.
由于第三方面、第四方面与第一方面的方法对应,故该第三方面、第四方面的各种实现方式、说明及有益效果的阐述,请参照前文对方法的说明。Since the third aspect and the fourth aspect correspond to the method of the first aspect, please refer to the foregoing description of the method for explaining the various implementation manners, descriptions, and beneficial effects of the third aspect and the fourth aspect.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the embodiments will be briefly described below, and those skilled in the art can, without any creative work, Other drawings can be obtained from these figures.
图1为本发明实施例涉及的通过SSL层对应用数据的处理过程的示意图;1 is a schematic diagram of a process of processing application data through an SSL layer according to an embodiment of the present invention;
图2为本发明实施例提供的一种通信系统的简化框图;2 is a simplified block diagram of a communication system according to an embodiment of the present invention;
图3为本发明实施例提供的一种发送端的结构示意图;FIG. 3 is a schematic structural diagram of a transmitting end according to an embodiment of the present disclosure;
图4为本发明实施例提供的一种方法示意图;4 is a schematic diagram of a method according to an embodiment of the present invention;
图5为本发明实施例提供的一种装置的结构示意图;FIG. 5 is a schematic structural diagram of a device according to an embodiment of the present disclosure;
图6为本发明实施例提供的另一种发送端的装置结构图。FIG. 6 is a structural diagram of another apparatus of a transmitting end according to an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种发送报文的方法及装置,下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、完整地描述。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The embodiment of the invention provides a method and a device for transmitting a message, and the following will be combined with the drawings in the embodiment of the present invention. The technical solutions in the embodiments of the present invention are clearly and completely described. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
以下为本发明实施例涉及的一些技术名词:The following are some technical terms involved in the embodiments of the present invention:
拥塞窗口(CWND congestion window),指TCP数据传输中,数据的源端在拥塞控制情况下一次最多能发送的数据包的数量。应理解,拥塞窗口简写为cwnd或者CWND都是可以的。例如在某些代码中,使用cwnd来表示。The CWND congestion window refers to the maximum number of data packets that can be sent at the source end of the data transmission in the case of congestion control. It should be understood that the congestion window is abbreviated as cwnd or CWND. For example, in some code, use cwnd to indicate.
传输层安全协议(Transport layer security,TLS),一种通信安全协议,用于保护在客户端和/或服务器的应用程序之间的数据传输。该协议位于应用层和TCP/IP协议栈之间。Transport layer security (TLS), a communication security protocol used to protect data transfers between clients and/or server applications. The protocol is located between the application layer and the TCP/IP stack.
消息认证码(Message Authentication Code,MAC),是一小段用于验证消息的完整性的检查信息。The Message Authentication Code (MAC) is a small piece of inspection information used to verify the integrity of a message.
队头阻塞(Head of Line blocking,HoL),一种限制传输性能的现象,由于例如由无序传输或者HTTP流水线(piplining)的多重请求,引起的一些数据包被其他数据包(例如该其他数据包丢失需要重传)延迟上报给应用层的现象。应理解,队头阻塞简写为HoL或者HOL都可以。Head of Line blocking (HoL), a phenomenon that limits transmission performance. Some packets caused by, for example, out-of-order transmission or HTTP piplining are caused by other data packets (for example, other data). Packet loss needs to be retransmitted) Delayed reporting to the application layer. It should be understood that the head blocking is abbreviated as HoL or HOL.
RTT(Round-trip Time),往返时延。表示发送端从发送数据开始,到接收到接收端发送的对应该数据的接收确认信息(如ACK或者NACK)的过程,经历的时延。应理解,在一种实现方式下,接收端收到数据后便立即发送该数据对应的确认信息,其中,“立即”应理解为包括接收端从接收到数据直至发送确认消息的必要的处理时间。应理解,往返时延简写为RTT或者rtt都可以。例如在某些代码中,使用rtt表示。RTT (Round-trip Time), round trip delay. It indicates the delay experienced by the transmitting end from the time of transmitting data to the process of receiving the receiving confirmation information (such as ACK or NACK) corresponding to the data sent by the receiving end. It should be understood that, in an implementation manner, the receiving end immediately sends the acknowledgement information corresponding to the data, and the “immediately” should be understood to include the necessary processing time from the receiving end to receiving the acknowledgement message. . It should be understood that the round trip delay can be abbreviated as RTT or rtt. For example, in some code, use rtt.
RTTVAR,tcp_info结构(tcp_info_struct)中的一个参数,该参数用于描述TCP连接的性能中,RTT的变化。RTTVAR, a parameter in the tcp_info structure (tcp_info_struct), which is used to describe the performance of the TCP connection, the RTT changes.
最大片段长度(maximum fragment length,MFL),一个参数,用于描述能够用于传输数据的最大的TLS记录的规格(size)。Maximum fragment length (MFL), a parameter used to describe the size of the largest TLS record that can be used to transfer data.
MSS,tcp_info结构(tcp_info_struct)中的一个参数,该参数用于描述TCP有效载荷的最大片段的规格(size)。MSS, a parameter in the tcp_info structure (tcp_info_struct), which is used to describe the size of the largest fragment of the TCP payload.
MAC,消息认证码(Message Authentication Code)。用于保证消息的数据完整性的工具。MAC, Message Authentication Code. A tool used to guarantee the data integrity of a message.
本发明实施例提供的技术方案可典型地应用于的无线通信系统中,比如,例如:全球移动通讯系统(GSM,Global System of Mobile communication)网络,码分多址(CDMA,Code Division Multiple Access)网络,时分同步码分多址(TDSCDMA,Time Division-Synchronous Code Division Multiple Access)网络,宽带码分多址(WCDMA,Wideband Code Division Multiple Access Wireless)网络,通用分组无线业务(GPRS,General Packet Radio Service)网络,长期演进(LTE,Long Term Evolution)网络,软件定义网络(SDN,Software Defined Network),无线传感器网络(Wireless Sensor Network)等。The technical solution provided by the embodiment of the present invention can be typically applied to a wireless communication system, such as, for example, a Global System of Mobile communication (GSM) network, Code Division Multiple Access (CDMA). Network, Time Division-Synchronous Code Division Multiple Access (TDSCDMA) network, Wideband Code Division Multiple Access (WCDMA) network, General Packet Radio Service (GPRS, General Packet Radio Service) Network, Long Term Evolution (LTE) network, Software Defined Network (SDN), Wireless Sensor Network, etc.
事实上,TLS是SSL的升级版本,故业界有时也使用SSL表示TLS。从而为网络中的通信提供以下服务中的至少一种:认证用户和服务器,确保数据能够发送到正确的目的地(如客户机或者服务器);加密数据以防止数据在传输过程中被窃取;维护数据的完整性,以确保数据在传输过程中不被改变。TLS在许多商业部署中,都是包括在操作环境中的基础协议。几乎一半的互联网流量受TLS保护。但,它的设计没有考虑如何有效地使用低延迟或者低带宽类型的网络,例如无线和电信网络。因为,使用TCP协议传输会存在队头(HoL)阻塞现象,也就是说,如果一分组(packet)中有部分数据在传输中丢失,其他被接收的数据将被保存在 缓存器中直到丢失的该部分数据重传成功才会上报给应用层。例如,一个分组长度为16K,在传输过程中有1K的数据丢失,则剩余的15K数据需要等待该1K数据重传成功后,才会将该分组的数据提供给应用层。In fact, TLS is an upgraded version of SSL, so the industry sometimes uses SSL to represent TLS. Thereby providing at least one of the following services for communication in the network: authenticating the user and the server, ensuring that the data can be sent to the correct destination (such as a client or server); encrypting the data to prevent the data from being stolen during transmission; maintaining The integrity of the data to ensure that the data is not altered during transmission. TLS is a fundamental protocol included in the operating environment in many commercial deployments. Almost half of Internet traffic is protected by TLS. However, its design does not consider how to effectively use low-latency or low-bandwidth types of networks, such as wireless and telecommunications networks. Because there is a head-of-line (HoL) blocking phenomenon when using TCP protocol transmission, that is, if some data in a packet is lost in transmission, other received data will be saved in The part of the buffer until the lost data is retransmitted successfully will be reported to the application layer. For example, if a packet length is 16K and 1K data is lost during transmission, the remaining 15K data needs to wait for the 1K data to be retransmitted successfully before the data of the packet is provided to the application layer.
以下结合图1描述TLS层对应用层的数据进行处理的过程,图1表示通过TLS层对应用数据的处理过程。在TLS协议中,以TLS记录(TLS Record)为单位处理应用数据。当待传输的应用数据的数据量超过TLS记录的规格的时候,TLS层会对应用数据按照TLS记录为单位进行分片,假设分成了n片,前面n-1个分片的数据长度和TLS记录规格长度一致,最后第n个分片数据长度一般可能不足一个TLS记录规格长度。对于前面n-1个分片,由于长度和TLS记录的规格长度一致,我们称为此时的分片长度为最大分片长度MFL(Maximum fragment length),由于最大分片长度和TLS记录规格大小相同,后继提到的MFL,也可以认为是TLS记录规格大小。分片完成后,TLS协议栈对每个记录进行压缩、添加MAC、加解密处理等,最后将加密的数据依次调用TCP接口发送出去。The process of processing the data of the application layer by the TLS layer will be described below with reference to FIG. 1, which shows the processing procedure of the application data through the TLS layer. In the TLS protocol, application data is processed in units of TLS records. When the amount of data of the application data to be transmitted exceeds the specification of the TLS record, the TLS layer fragments the application data in units of TLS records, assuming that the data is divided into n slices, the data length of the preceding n-1 fragments, and TLS. The length of the record specification is the same. Finally, the length of the nth slice data may generally be less than the length of one TLS record specification. For the previous n-1 fragments, because the length and the specification length of the TLS record are the same, we call the fragment length at this time the maximum fragment length MFL (Maximum fragment length), due to the maximum fragment length and the TLS record size. The same, the MFL mentioned later, can also be considered as the TLS record size. After the fragmentation is completed, the TLS protocol stack compresses, adds MAC, encrypts and decrypts each record, and finally sends the encrypted data to the TCP interface for transmission.
从这个流程中可以看到,TLS协议一次通过tcp发送的包的数据量和TLS记录的规格数据量强相关,若TLS记录规格越大,一次tcp发送的包也就越大,若TLS记录规格越小,一次tcp发送的包也就越小。As can be seen from this flow, the amount of data transmitted by the TLS protocol through tcp is strongly related to the amount of data of the TLS record. If the TLS record specification is larger, the packet sent by a tcp will be larger, if the TLS record specification The smaller, the smaller the packet sent by a tcp.
TCP协议要求严格的数据按序传输,也就是说,对一组数据,当某个传送协议数据单元(TPDU,Transport Protocol Data Unit)丢失后,其后的数据单元只能等待已经丢失的TPDU被重传并接收以后,才会将这组数据上报给应用层,这就是TCP的队头(HoL,head-of-line)阻塞问题。例如,一个分组通过TLS层的处理,数据流中依次包括为数据1到数据4,其中的数据3丢失后,对端需要等待到源端重传了数据3并且收到了数据3后,也就是该分组中的数据都接收到后,将数据1到4进行解析,才会将解析的数据传递给应用层。The TCP protocol requires strict data transmission in order, that is, for a group of data, when a Transport Protocol Data Unit (TPDU) is lost, the subsequent data unit can only wait for the TPDU that has been lost. After retransmission and reception, this set of data will be reported to the application layer. This is the blocking problem of the head (of the head-of-line) of TCP. For example, a packet is processed by the TLS layer, and the data stream is sequentially included as data 1 to data 4. After the data 3 is lost, the peer needs to wait until the source retransmits the data 3 and receives the data 3, that is, After the data in the packet is received, the data 1 to 4 are parsed, and the parsed data is delivered to the application layer.
收端在接收到报文后,会由应用层与TCP协议层之间的TLS层进行处理,具体为对应用数据进行加解密和MAC处理。比如在解密流程中,当收到一个TLS记录时,TLS协议栈中会对该记录进行解密,解密成功后然后进行MAC校验。若在TCP传输过程中出现数据丢失,此时由于TLS没有收到一个完整的TLS记录,TLS解密处理会失败(TLS中也可以配置不加密模式,但这种模式下,在数据的MAC校验时,数据也会校验失败),只有等整个TLS记录的数据完整时,TLS解密和校验才会成功,解密后的数据才能成功送给应用层处理。After receiving the packet, the receiving end processes the TLS layer between the application layer and the TCP protocol layer, specifically encrypting and decrypting the application data and processing the MAC address. For example, in the decryption process, when a TLS record is received, the record is decrypted in the TLS protocol stack, and the MAC address is verified after successful decryption. If data loss occurs during TCP transmission, the TLS decryption process will fail because TLS does not receive a complete TLS record (the TLS can also be configured with no encryption mode, but in this mode, the MAC check of the data When the data is also verified to fail, the TLS decryption and verification will succeed only when the data of the entire TLS record is complete, and the decrypted data can be successfully sent to the application layer for processing.
在TLS机制处理下,即使接受者接收到一个记录中的15k数据(比如这个记录规格是16k,传输过程中1k的数据丢失),此时应用层数据也无法处理,这个时候会遭受HoL问题,只有丢失的包进行重传后,整个记录的数据收完整后,TLS才能正常解密数据,而这个等待的时间也就是个较大的时延。Under the TLS mechanism, even if the receiver receives 15k data in a record (for example, this record specification is 16k, 1k data loss during transmission), the application layer data cannot be processed at this time, and this time, the HoL problem will be suffered. Only after the lost packet is retransmitted, the TLS can decrypt the data normally after the entire recorded data is received, and the waiting time is a large delay.
目前业界开源实现普遍使用固定大小的TLS记录规格进行通信。例如,TLS标准文档RFC5246章节6.2.1规定,TLS记录的规格不能超过2^14字节(16KB)。OpenTLS是业界使用最广泛的实现了TLS功能的开源代码,在OpenTLS实现中,TLS记录规格大小默认使用了16KB,且该规格大小不能调整。再例如,Mbedtls开源代码实现方案,Mbedtls实现了TLS层的功能,应用广泛,在Mbedtls开源代码实现中,赋予了用户配置TLS记录的规格的权利,用户在业务初始化阶段进行配置,配置后不轻易变化,也就是说,TLS记录的规格一旦确定,后续的通信过程中就会沿用,若需要调整TLS记录的规格,只能由用户重新初始化业务,以重新配置TLS记录的规格,配置完成后再次启动该业务才可以,这个过程需要人工参与。应理解,TSL记录的规格越大,该记录中包括的数据量越多,也就越容易在传输中丢失数据。 用户可以选择配置以下5个TLS记录的规格供用户配置:512字节、1024字节、2048字节、4096字节、8192字节和16384字节。Currently, open source implementations in the industry generally use fixed-size TLS record specifications for communication. For example, Section 6.2.1 of the TLS standard document RFC5246 states that the specification of a TLS record cannot exceed 2^14 bytes (16 KB). OpenTLS is the industry's most widely used open source code for implementing TLS. In the OpenTLS implementation, the TLS record size defaults to 16KB, and the size cannot be adjusted. For example, the Mbedtls open source code implementation, Mbedtls implements the TLS layer function, widely used, in the Mbedtls open source code implementation, gives the user the right to configure the specifications of the TLS record, the user is configured during the business initialization phase, not easy to configure Change, that is to say, once the specification of the TLS record is determined, it will be used in the subsequent communication process. If the specification of the TLS record needs to be adjusted, the user can re-initialize the service to reconfigure the specifications of the TLS record. It is only possible to start the business, and this process requires manual participation. It should be understood that the larger the specification of the TSL record, the more data is included in the record, and the easier it is to lose data in the transmission. Users can choose to configure the following five TLS record specifications for user configuration: 512 bytes, 1024 bytes, 2048 bytes, 4096 bytes, 8192 bytes, and 16384 bytes.
但由于网络环境复杂多变,上述用法可能会带来多种问题。比如链路条件较差时,若TLS记录的规格过大,会导致网络时延过大和队头阻塞问题,而若TLS记录规格过小,则又会导致网络吞吐率和利用率过低,造成浪费。However, due to the complex and varied network environment, the above usage may bring a variety of problems. For example, if the link condition is too poor, if the TLS record size is too large, the network delay will be too large and the head of the network will be blocked. If the TLS record size is too small, the network throughput and utilization will be too low. waste.
从上面的讨论可以看出,发生在TCP层的碎片化(分片过小)和大数据包的重组,可以导致巨大的时延。应用数据在传输过程中,如果出现丢包,至少会导致一个RTT(Round-trip Time,往返时延)的时延。下面使用一个测试作为例子来描述一个丢包行为对TLS记录大小的影响。该测试中,使用1600K的应用负载,TLS服务器配置在香港,TLS客户端配置在班加罗尔,TLS服务器和TLS客户端之间通过平均RTT为300ms的网络传输。基于客户端的请求,数据是通过TLS加密从TLS服务器传来的。以下为测试结果:As can be seen from the above discussion, fragmentation (small fragmentation) and large packet reassembly that occur at the TCP layer can lead to huge delays. When the application data is lost during transmission, it will at least cause an RTT (Round-trip Time) delay. Let's use a test as an example to describe the impact of a packet loss behavior on the size of a TLS record. In this test, the application load of 1600K is used, the TLS server is configured in Hong Kong, the TLS client is configured in Bangalore, and the TLS server and the TLS client are transmitted over a network with an average RTT of 300ms. Based on the client's request, the data is sent from the TLS server via TLS encryption. The following are the test results:
1)TLS记录的规格(size)为16K,丢包率为0.1%,总延迟是9.1775121s;1) The specification (size) of the TLS record is 16K, the packet loss rate is 0.1%, and the total delay is 9.1775121s;
2)TLS记录的规格(size)为16K,丢包率为5%,总延迟是67.4828414s;2) The size of the TLS record is 16K, the packet loss rate is 5%, and the total delay is 67.4828414s;
3)TLS记录的规格(size)为1.5K,丢包率为0.1%,总延迟是13.1105458s3) The size of the TLS record is 1.5K, the packet loss rate is 0.1%, and the total delay is 13.1105458s.
4)TLS记录的规格(size)为1.5K,丢包率为5%,,总延迟是78.5495714s4) The specification (size) of the TLS record is 1.5K, the packet loss rate is 5%, and the total delay is 78.5495714s.
所以,从以上结果可以看出,随着TLS记录的规格的增大,以及丢包率的增加,总延迟(握手+数据传输延迟)增加。即使是简单地将TLS记录的规格减到更小的值,也没有减小延迟,反而会在高丢包率的情况下产生更多的延迟尖峰(即延迟在某些时刻突然增大)。Therefore, as can be seen from the above results, as the specification of the TLS record increases and the packet loss rate increases, the total delay (handshake + data transmission delay) increases. Even if the specification of the TLS record is simply reduced to a smaller value, there is no reduction in latency, but instead more peaks are generated at high packet loss rates (ie, the delay suddenly increases at some point).
图2是本发明实施例提供的一种通信系统100的简化框图,该通信系统100仅作为本发明的一种应用场景,不应理解为对本发明应用场景的限定。FIG. 2 is a simplified block diagram of a communication system 100 according to an embodiment of the present invention. The communication system 100 is only used as an application scenario of the present invention, and should not be construed as limiting the application scenario of the present invention.
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。The terms "first", "second", "third", "fourth", etc. (if present) in the specification and claims of the present invention and the above figures are used to distinguish similar objects without being used for Describe a specific order or order.
根据图2,该通信系统包括:终端(terminal)10、服务器20和网络30;其中,终端10通过接入设备,如WLAN(Wireless Local Area Network,无线局域网)接入点,或蜂窝网络的接入点接入网络30,并基于特定的网络协议与服务器20建立连接,服务器20根据终端10的请求,利用建立的连接向终端10传输数据,比如视频流。According to FIG. 2, the communication system comprises: a terminal 10, a server 20 and a network 30; wherein the terminal 10 is connected through an access device, such as a WLAN (Wireless Local Area Network), or a cellular network. The ingress accesses the network 30 and establishes a connection with the server 20 based on a specific network protocol. The server 20 transmits data, such as a video stream, to the terminal 10 using the established connection according to the request of the terminal 10.
终端,指向用户提供语音和/或数据连通性的设备,包括无线终端或有线终端。无线终端可以是具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。例如,无线终端可以是移动电话(或称为“蜂窝”电话)或者具有移动终端的计算机。又如,无线终端也可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置。再如,无线终端可以为移动站(英文为:mobile station)或用户设备(英文为:user equipment,简称UE)的一部分。本发明的说明书和权利要求书及上述附图中的术语“数据包”是网络传输的基本单位,以一定格式组织起来的数据。不同类型的网络协议对数据包的格式有不同的定义,但通常而言,一个数据包可分为头部(header)和净荷(payload),其中,头部包含了数据包传输过程中必需的信息,比如地址信息、标志位等等,净荷也称为数据部分,包含了被发送的数据内容。A terminal, a device that provides voice and/or data connectivity to a user, including a wireless terminal or a wired terminal. The wireless terminal can be a handheld device with wireless connectivity, or other processing device connected to a wireless modem. For example, the wireless terminal can be a mobile phone (or "cellular" phone) or a computer with a mobile terminal. As another example, the wireless terminal can also be a portable, pocket, handheld, computer built-in or in-vehicle mobile device. For another example, the wireless terminal can be part of a mobile station (mobile station) or user equipment (English: user equipment, UE for short). The term "data packet" in the specification and claims of the present invention and the above-mentioned drawings is the basic unit of network transmission, data organized in a certain format. Different types of network protocols have different definitions of packet formats, but in general, a packet can be divided into a header and a payload, where the header contains the necessary data transmission process. Information, such as address information, flag bits, etc., the payload, also known as the data portion, contains the content of the data being sent.
网络30可包括公用网络、专用网络、因特网的一部分和/或其任何组合。出于简洁之目的,网络30的其它部分并未进行阐述。Network 30 may include a public network, a private network, a portion of the Internet, and/or any combination thereof. For the sake of brevity, other portions of network 30 have not been described.
服务器20可以为应用服务器,服务器代理,数据中心服务器或网关。所属领域的技术人员可以理解一个通信系统通常可包括比图2中所示的部件更少或更多的部件,图2仅仅示出了 与本发明实施例所公开的实现方式更加相关的部件。例如,虽然图2中示出了三个终端10和一个服务器20,但所属领域的技术人员可理解成一个通信系统可包含任何数量的终端和服务器。 Server 20 can be an application server, a server proxy, a data center server or a gateway. One of ordinary skill in the art will appreciate that a communication system can generally include fewer or more components than those shown in FIG. 2, and FIG. 2 only shows Components that are more relevant to implementations disclosed by embodiments of the present invention. For example, although three terminals 10 and one server 20 are shown in FIG. 2, those skilled in the art will appreciate that a communication system can include any number of terminals and servers.
图3示出了本发明实施例的发送端的主要组件,该发送端可以是服务器或者终端,下面以发送端为服务器进行说明,根据图3,发送端包括处理器201、存储器202和网卡(network interface card,NIC)203。存储器202中存储有可执行程序21,可执行程序21包括:操作系统和应用程序。处理器201可以运行存储器202中的可执行程序21,以实现特定的功能。发送端与接收端要建立通信连接并基于建立的连接传输数据包,必须使用多种网络协议,这些协议按照层次组合在一起,构成协议族(Protocol Suite),而实现协议族功能的组件被称为协议栈(Protocol Stack)。如图3所示,服务器20和终端10分别包括协议栈204和协议栈11。数据包经协议栈204处理后,通过网卡203的发射电路231发送给终端10;接收电路232接收终端10上运行的应用程序12的数据包,并传递给协议栈204处理。其中,协议栈可由软件、硬件和/或固件的适当组合实现。在一个实施例中,协议栈204和协议栈11包括TCP/IP(Transmission Control Protocol/Internet Protocol)协议栈,TCP/IP协议栈是指参照TCP/IP参考模型所定义的协议族实现的协议栈,该协议族包括两个核心协议:TCP(传输控制协议)和IP(网际协议),根据TCP/IP参考模型的定义,协议族包含的协议被归类到5个抽象的"层"中:物理层、链路层、网络层、传输层以及应用层,关于各层的定义均为现有技术,本发明实施例不再赘述。Figure 3 shows the main components of the transmitting end of the embodiment of the present invention. The transmitting end may be a server or a terminal. The following is a description of the sending end as a server. According to FIG. 3, the transmitting end includes a processor 201, a memory 202, and a network card (network). Interface card, NIC) 203. The executable 202 is stored in the memory 202, and the executable program 21 includes an operating system and an application. The processor 201 can execute the executable program 21 in the memory 202 to implement a particular function. To establish a communication connection between the sender and the receiver and to transmit data packets based on the established connection, a variety of network protocols must be used. These protocols are combined in a hierarchy to form a protocol suite, and the components implementing the protocol family function are called It is a protocol stack. As shown in FIG. 3, the server 20 and the terminal 10 include a protocol stack 204 and a protocol stack 11, respectively. After the data packet is processed by the protocol stack 204, it is sent to the terminal 10 through the transmitting circuit 231 of the network card 203. The receiving circuit 232 receives the data packet of the application 12 running on the terminal 10 and transmits it to the protocol stack 204 for processing. Wherein, the protocol stack can be implemented by a suitable combination of software, hardware and/or firmware. In one embodiment, the protocol stack 204 and the protocol stack 11 include a TCP/IP (Transmission Control Protocol/Internet Protocol) protocol stack, and the TCP/IP protocol stack refers to a protocol stack implemented by a protocol family defined by the TCP/IP reference model. The protocol family includes two core protocols: TCP (Transmission Control Protocol) and IP (Internet Protocol). According to the definition of the TCP/IP reference model, the protocol family contains protocols that are classified into five abstract "layers": The physical layer, the link layer, the network layer, the transport layer, and the application layer are all defined in the prior art, and are not described in detail in the embodiments of the present invention.
应理解,在TCP/IP协议栈与应用层之间,就是上文中所述的SSL层13。图3中只是示意性地在终端中画出了该SSL层13。而服务器中,同样可以存在SSL层。还应理解,现有技术中,处于上层的SSL层是无法获知下层的信息(例如TCP连接的链路状态信息,可以包括往返时延RTT,拥塞窗口CWND等)。It should be understood that between the TCP/IP protocol stack and the application layer is the SSL layer 13 described above. The SSL layer 13 is only schematically depicted in the terminal in FIG. In the server, the SSL layer can also exist. It should also be understood that in the prior art, the SSL layer in the upper layer cannot know the information of the lower layer (for example, the link state information of the TCP connection, and may include a round trip delay RTT, a congestion window CWND, etc.).
本申请所记载的方案,在TCP协议层之上应用层之下,部署一个调整模块,该模块可以探知TCP连接的链路状态,从而根据该连接的链路状态来调整MFL,使得MFL灵活地匹配网络连接的链路状态,改善TCP连接的性能,例如传输时延等。应理解,该模块使用在数据的发端。由于TCP连接是用于传输数据的,该数据可以在网络设备之间,或者网络设备与终端之间传输,网络设备可以是上文中所述的服务器,也可以是网络中可以运行应用层的其他设备。TCP连接中,网络设备或者终端都可以是数据的发端。In the solution described in the present application, an adjustment module is deployed under the application layer above the TCP protocol layer, and the module can detect the link state of the TCP connection, thereby adjusting the MFL according to the link state of the connection, so that the MFL flexibly Match the link status of the network connection and improve the performance of the TCP connection, such as transmission delay. It should be understood that this module is used at the origin of the data. Since the TCP connection is used for transmitting data, the data may be transmitted between the network devices or between the network device and the terminal, and the network device may be the server described above, or may be other devices in the network that can run the application layer. device. In a TCP connection, a network device or a terminal may be the origin of data.
该调整模块可以是一组插入在TLS层中的程序,或者用于实现上述功能的线程、进程或者容器。本申请文件对该调整模块的具体实现方式不做限定。The adjustment module can be a set of programs inserted in the TLS layer, or a thread, process, or container for implementing the above functions. This application file does not limit the specific implementation of the adjustment module.
也就是说,本申请所记载的方案,提供了一种调整TLS记录的规格(size)的方法,该方法基于TCP层的信息(例如tcp_info_struct),这些TCP层的信息可以在实际的通信过程中,不断向TCP数据中学习而获得。例如,方法中使用RTTVAR或者CWND中的至少一个参数来调整TLS记录的规格。它从TCP数据的时延、规格或者拥塞窗口的变化中学习,从而可以多次改变数据包的长度,因此,数据包的长度可以匹配TCP的窗口。这样,就可以一定程度上克服由于较大尺寸的数据包导致的HoL的瓶颈问题。一种实现方式中,可以在握手过程中保持默认的MFL记录的规格,一旦握手过程完成,在应用数据的传输过程中,可以根据RTTVAR来调整TLS记录的规格。That is to say, the solution described in the present application provides a method for adjusting the size of a TLS record, which is based on information of a TCP layer (for example, tcp_info_struct), and the information of these TCP layers can be in actual communication process. , continuously learn from TCP data and get it. For example, the method uses at least one of the RTTVAR or CWND parameters to adjust the specifications of the TLS record. It learns from the delay of TCP data, specifications, or changes in the congestion window, so that the length of the packet can be changed multiple times. Therefore, the length of the packet can match the TCP window. In this way, the bottleneck of HoL due to larger size packets can be overcome to some extent. In one implementation, the default MFL record specification can be maintained during the handshake process. Once the handshake process is completed, the TLS record specification can be adjusted according to RTTVAR during the application data transmission process.
此外,本领域的技术人员可以理解服务器20可包括比图3中所示部件更少或更多的部件,图3仅示出了与本发明实施例所公开的多个实现方式的更加相关的部件。Moreover, those skilled in the art will appreciate that server 20 may include fewer or more components than those shown in FIG. 3, and FIG. 3 only shows more relevant to the various implementations disclosed in the embodiments of the present invention. component.
下面,简单描述本申请所涉及的通信过程。首先,由于SSL基于TCP协议进行数据传输,进行数据传输的收端和发端(也就是客户端和服务器)之间,需要先建立TCP链接,也就是 三次握手(TCP Handshake)。接下来,进行SSL握手,其中包括客户端/服务器密钥交换(Client/Server key exchange),证书/密钥/密码协商与交换(Cert/Key/Cipher spec Negotiation and Exchange)以及握手完成(Handshake Complete)三个阶段。在SSL握手过程中,客户端和服务器端需要完成SSL建链,该阶段内TLS记录规格不做动态调整。正如图4所示,在一种实现方式下,在SSL建链之前,发送端会配置默认的MFL,待SSL握手建立后,发送端就会使用该默认的MFL向接收端发送数据,现有技术中,该连接就会一直使用该MFL对应用数据进行分片。而本申请提供的方法中,随着数据包的传输,发送端调整MFL的规格(size),使得发送端可以使用调整后的MFL分片数据。而调整MFL,可以视为是上述的调整模块的功能。也就是说,TLS记录的规格就等于MFL。调整MFL的值,就是调整TLS记录的规格。Hereinafter, the communication process involved in the present application will be briefly described. First, since SSL is based on the TCP protocol for data transmission, between the receiving end and the originating end of the data transmission (that is, the client and the server), it is necessary to establish a TCP link first, that is, Three-way handshake (TCP Handshake). Next, perform an SSL handshake, including Client/Server key exchange, Cert/Key/Cipher spec Negotiation and Exchange, and Handshake Complete. )three phases. During the SSL handshake process, the client and server need to complete the SSL link establishment. The TLS record specifications are not dynamically adjusted during this phase. As shown in Figure 4, in an implementation manner, before the SSL is established, the sender configures the default MFL. After the SSL handshake is established, the sender sends the data to the receiver using the default MFL. In technology, the connection will always use the MFL to fragment the application data. In the method provided by the present application, as the data packet is transmitted, the transmitting end adjusts the size of the MFL, so that the transmitting end can use the adjusted MFL fragment data. Adjusting the MFL can be considered as the function of the above adjustment module. In other words, the specification of the TLS record is equal to the MFL. Adjusting the value of MFL is to adjust the specifications of the TLS record.
也就是说,本申请记载一种发送报文的方法,该方法包括:第一TCP连接的发送端发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;所述发送端确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息用于表示TCP连接的传输性能;根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值;该发送端向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。That is, the present application describes a method for transmitting a message, the method comprising: sending, by the sending end of the first TCP connection, the first packet of the first TCP connection, the maximum fragment length of the first TCP connection The MFL is a first value, and the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, and a specification of the TLS record of the first packet is the first value; Determining, by the sending end, that the link state information of the first TCP connection is changed, the link state information is used to indicate a transmission performance of the TCP connection; according to the change of the link state information, the sending end is to be The MFL of the first TCP connection is adjusted to a second value; the sending end sends the second packet of the first TCP connection to the opposite end of the first TCP connection, where the MFL of the second packet is the Two values.
其中,第一TCP连接就是某个TCP连接。The first TCP connection is a TCP connection.
这种发送报文的方法,其中涉及调整TLS记录的规格(size),该方法使用MFL作为TLS记录的规格,基于该TLS对应的TCP连接的链路信息,调整MFL的值,从而使得TLS记录的规格能够根据TCL连接的链路状态灵活地调整,减小了应用层获得数据的时延,使得数据的传输更加流畅,从而提高了通信的性能。The method for transmitting a message, which involves adjusting a size of a TLS record, the method uses the MFL as a specification of the TLS record, and adjusts the value of the MFL based on the link information of the TCP connection corresponding to the TLS, thereby causing the TLS record The specifications can be flexibly adjusted according to the link state of the TCL connection, which reduces the delay of obtaining data by the application layer, and makes the data transmission smoother, thereby improving the communication performance.
其中,所述链路状态信息包括往返时延RTT,拥塞窗口CWND和丢包率中的至少一种。The link state information includes at least one of a round trip delay RTT, a congestion window CWND, and a packet loss ratio.
其中,所述MFL的取值范围为大于等于1300Byte,且小于等于16KB。The value range of the MFL is greater than or equal to 1300 Bytes and less than or equal to 16 KB.
一种实现方式中,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:使用变化后的所述链路状态信息,计算所述第一TCP连接的报文发送成功的概率;在所述概率增大的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值大于第一值;在所述概率减小的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值小于第一值。In an implementation manner, the transmitting end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including: using the changed link state information, Calculating a probability that the packet of the first TCP connection is successfully sent; if the probability is increased, adjusting the MFL of the first TCP connection to a second value, where the second value is greater than the first value a value; the MFL of the first TCP connection is adjusted to a second value if the probability is reduced, wherein the second value is less than the first value.
具体可参照下文中根据Px(L)取匹配当前链路状态的MFL的相关段落的描述。Specifically described below according to P x (L) takes the MFL match the current link state may refer to the relevant paragraphs.
一种实现方式下,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述RTT增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述RTT减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In an implementation manner, the link state information includes a round-trip delay RTT, and the sending end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including Resetting, in the case of the RTT, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; if the RTT is decreased, The MFL of the first TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
具体可参照下文中根据Px(L)取匹配当前链路状态的MFL的相关段落的描述,以及相关的代码。For details, refer to the description of the relevant paragraphs of the MFL that match the current link state according to P x (L), and related codes.
一种实现方式下,所述MFL预设有取值范围,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述RTT增大,且所述第一值小于所述取值范围中的最大值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的一半;在所述RTT减小,且所述第一值大于所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二 值,所述第二值为所述第一值的两倍;在所述RTT增大,且所述第一值为所述取值范围中的最大值的情况下,或者,在所述RTT减小,且所述第一值为所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值等于所述第一值。In an implementation manner, the MFL is pre-set with a value range, the link state information includes a round-trip delay RTT, and the sending end uses the first TCP according to the change of the link state information. Adjusting the connected MFL to a second value, comprising: adjusting, when the RTT is increased, and the first value is less than a maximum value of the value range, adjusting the MFL of the first TCP connection to Binary value, the second value is half of the first value; in a case where the RTT is decreased, and the first value is greater than a minimum value of the value range, the first TCP is The connected MFL is adjusted to the second a value, the second value being twice the first value; in the case where the RTT is increased, and the first value is a maximum value in the value range, or, in the RTT And decreasing, and if the first value is a minimum value in the value range, adjusting the MFL of the first TCP connection to a second value, the second value being equal to the first value.
具体可以参照后文通过rtt来衡量链路状态,这样,rtt变化影响MFL变化的相关段落。Specifically, the link state can be measured by rtt later, so that the rtt change affects the relevant paragraph of the MFL change.
一种实现方式下,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In an implementation manner, the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the sending end connects the first TCP according to the change of the link state information. Adjusting the MFL to a second value, comprising: adjusting, when the CWND is increased, the MFL of the first TCP connection to a second value, the second value being less than or equal to a first value; in the CWND In the case of a decrease, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
一种实现方式下,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较小值,其中,在所述乘积小于所述取值范围中的最小值的情况下,所述第二值为所述取值范围中的最小值;在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较大值,其中,在所述乘积大于所述取值范围中的最大值的情况下,所述第二值为所述取值范围中的最大值。In an implementation manner, the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the sending end connects the first TCP according to the change of the link state information. Adjusting the MFL to the second value, including: adjusting, in the case that the CWND is increased, the MFL of the first TCP connection to a second value, where the second value is the CWND and the first TCP a product of a maximum message length MSS of the connection, and a smaller value of the first value, wherein, in a case where the product is smaller than a minimum value of the value range, the second value is the a minimum value in the range of values; adjusting the MFL of the first TCP connection to a second value, where the CWND is decreased, the second value being the CWND connected to the first TCP a product of a maximum message length MSS, and a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is the value The maximum value in the range.
具体可以参照后文通过CWND来衡量链路状态,这样,CWND变化影响MFL变化的相关段落。Specifically, the link state can be measured by CWND in the following text, so that the CWND change affects the relevant paragraph of the MFL change.
一种实现方式下,所述确定所述第一TCP连接的链路状态信息发生变化,包括:在接收到报文或者发送报文时,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化;或者,根据预设的时刻或者预设的时间间隔,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化。In an implementation manner, the determining the link state information of the first TCP connection is changed, including: detecting, when receiving a packet or sending a packet, link state information of the first TCP connection, Determining that the link state information changes; or detecting link state information of the first TCP connection according to a preset time or a preset time interval to determine that the link state information changes.
具体可以参照后文描述调整模块使用多种方式来触发调整Px(L)的段落。For details, reference may be made to the following description of the adjustment module using a plurality of ways to trigger the adjustment of the paragraph of P x (L).
下面具体介绍上文中描述的方法的实现方式,为实现这些实现方式,需要添加上文中描述的调整模块。The implementation of the method described above is specifically described below. To implement these implementations, the adjustment module described above needs to be added.
可以认为本申请的方案度量链路状态,以根据链路状态来动态调整MFL。其实现主要逻辑如下:The scheme of the present application can be considered to measure the link state to dynamically adjust the MFL according to the link state. The main logic of its implementation is as follows:
使用概率P(即Px(L))来衡量链路状态,其中Px(L)表示在链路状态为L的情况下,发送一个数据量为X的数据包成功的概率。应当理解,Px(L)实际上应当是P(X,L),也就是与X、L有关的二元函数,但是为了分析方便,往往将两个变量中的一个固定,讨论另一个变量与P的关系,例如在关注L与P的关系时,写为Px(L)。在下文的分析中,X用于表示MFL,也就是用于标识TLS记录的规格(size of TLS record)。The link state is measured using the probability P (i.e., P x (L)), where P x (L) represents the probability that a packet of data amount X is transmitted successfully in the case where the link state is L. It should be understood that P x (L) should actually be P(X, L), which is a binary function related to X and L, but for the convenience of analysis, one of the two variables is often fixed, and another variable is discussed. The relationship with P, for example, when focusing on the relationship between L and P, is written as P x (L). In the analysis below, X is used to represent the MFL, that is, the size of TLS record used to identify the TLS record.
应理解,发送该数据包成功的概率表示该数据包从发端一次性成功地传到收端,而没有发生丢包、重传等问题。其中,Px(L)和链路状态L相关,L可以由往返时延(RTT),丢包率(loss rate),拥塞窗口(CWND)等因素来衡量,L越大,表示链路状态越差,因此Px(L)会相应变小。具体的,遵循下述的规律It should be understood that the probability of successfully transmitting the data packet indicates that the data packet is successfully transmitted from the originating end to the receiving end at one time without any problems such as packet loss or retransmission. Where P x (L) is related to link state L, and L can be measured by factors such as round trip delay (RTT), loss rate, congestion window (CWND), etc. L is larger, indicating link status. The worse, so P x (L) will be smaller accordingly. Specifically, follow the rules below
(a)当链路的往返时延RTT变大时,L变大,Px(L)变小;(a) When the round-trip delay RTT of the link becomes large, L becomes large, and P x (L) becomes small;
(b)当丢包率loss rate变大时,L变大,Px(L)变小; (b) When the loss rate of the packet loss rate becomes larger, L becomes larger, and P x (L) becomes smaller;
(c)当拥塞窗口CWND变大时,L变大,Px(L)变小。(c) When the congestion window CWND becomes large, L becomes large, and P x (L) becomes small.
例如,在一种实现方式下,这里可以假设当数据包大小固定为X的时候,Px(L)和链路状态L为幂率分布关系,即Px(L)=cL-r,这里,c,r均是大于0的常数。For example, in one implementation, it can be assumed here that when the packet size is fixed to X, P x (L) and link state L are power-rate distribution relations, that is, P x (L)=cL -r , where , c, r are constants greater than zero.
调整模块可以使用多种方式来触发调整Px(L)。例如可以是事件触发机制。具体的,可以是当发端通过TLS层发送应用数据,或者收端通过TLS层接收应用数据时,检测当前链路状态,当然,也可以将该链路状态保存下来。这样,在发端通过TLS层发送应用数据,或者收端通过TLS层接收应用数据时,和之前记录的链路状态进行比较,在链路状态变化的情况下(例如检测到RTT、loss rate以及CWND中的至少一个发生变化),根据上述的规律,使用预置的链路状态和P之间的关系,调整Px(L)的值。The adjustment module can trigger adjustments P x (L) in a number of ways. For example, it can be an event trigger mechanism. Specifically, when the sending end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer, the current link state is detected. Of course, the link state may also be saved. In this way, when the originating end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer, it compares with the previously recorded link status, in the case of a link state change (for example, detecting RTT, loss rate, and CWND) At least one of the changes occurs, and according to the above rule, the value of P x (L) is adjusted using the relationship between the preset link state and P.
应理解,这个当发端通过TLS层发送应用数据,或者收端通过TLS层接收应用数据时,表示在发端通过TLS层发送应用数据,或者收端通过TLS层接收应用数据这类事件的过程中,或者发生上述事件之后的一小段时间内(应理解,由于程序执行而带来的延时,或者处理延时是可以容忍的)。It should be understood that when the transmitting end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer, it indicates that the sending end sends the application data through the TLS layer, or the receiving end receives the application data through the TLS layer. Or a short period of time after the above events occur (it should be understood that the delay due to program execution, or processing delay can be tolerated).
另一种实现方式下,也可以使用定时器机制来触发。具体的,可以是设置一个时间阈值,在定时器运行超过时间阈值的情况下,检测当前链路状态,和之前记录的链路状态进行比较,(应理解,可以在定时器超时的情况下,将检测到的链路状态记录下来)。则在检测到链路状态变化的情况下(例如检测到RTT、loss rate以及CWND中的至少一个发生变化),根据上述的规律,使用预置的链路状态和P之间的关系,调整Px(L)的值,以及将定时器重启,以等待下次超时的情况下,再检测链路状态。In another implementation, a timer mechanism can also be used to trigger. Specifically, the time threshold may be set, and when the timer runs beyond the time threshold, the current link state is detected and compared with the previously recorded link state. (It should be understood that, in the case that the timer expires, Record the detected link status). Then, when the link state change is detected (for example, at least one of the RTT, the loss rate, and the CWND is detected to change), according to the above rule, the relationship between the preset link state and the P is used to adjust the P. The value of x (L), and restart the timer to wait for the next timeout, and then detect the link state.
应理解,也可以使用其他的方式来触发调整Px(L)的值,本发明实施例不做限制。It should be understood that other methods may be used to trigger the adjustment of the value of P x (L), which is not limited in the embodiment of the present invention.
调整模块可以根据Px(L)的变化,调整MFL的值。应理解,Px(L)中的X表示数据包的数据量。由于数据包是使用MFL规格进行封装的,所以在Px(L)取一个值的情况下,该Px(L)对应的X的取值也就是该Px(L)对应的MFL的值。在一种实现方式下,先将MFL设置在一个合适的取值范围内,也就是说,无论后续MFL如何变化,MFL始终在该范围内。具体的的,设置Min_MFL=1300字节,Max_MFL=16384字节,MFL的取值范围即从Min_MFL到Max_MFL。如此设置,是因为:(1)TCP协议中的最大传输单元(Maximum Transmission Unit,MTU)一般为1500字节(Byte),由于SSL加密数据的过程中,需要对一个record做数据填充、添加MAC等操作,因此1500字节(Byte)的TCP数据加密前的原始数据大小大约为1300字节(Byte)左右,因此取最小的Min_MFL为1300字节(Byte);(2)SSL RFC中规定最大的TLS记录为16KB(Byte),因此最大Max_MFL取为16KB(Byte)。The adjustment module can adjust the value of the MFL based on the change in P x (L). It should be understood that X in P x (L) represents the amount of data of the packet. Since the data packet is encapsulated using MFL specifications, so in the case where P x (L) takes a value, which is P x (L) corresponding to the value of X is a value corresponding to the MFL P x (L) . In one implementation, the MFL is first set to a suitable range of values, that is, the MFL is always within this range regardless of how the subsequent MFL changes. Specifically, the Min_MFL=1300 bytes and Max_MFL=16384 bytes are set, and the MFL ranges from Min_MFL to Max_MFL. This is because: (1) The Maximum Transmission Unit (MTU) in the TCP protocol is generally 1500 bytes (Byte). Because SSL encrypts data, it needs to fill data and add MAC to a record. The operation is such that the original data size before the 1500-byte (TCP) data is encrypted is about 1300 bytes (Byte), so the minimum Min_MFL is 1300 bytes (Byte); (2) The maximum specified in the SSL RFC The TLS record is 16 KB (Byte), so the maximum Max_MFL is taken as 16 KB (Byte).
调整模块可以使用多种方式来根据Px(L)调整MFL。一种形式下,可以根据Px(L)取匹配当前链路状态的MFL。例如,根据前文,假设X的取值范围为:{1300,2k,3k,4k,5k,6k,7k,8k,9k,10k,11k,12k,13k,14k,15k,16k},应理解,2k表示2KB,3k表示3KB,4k表示4KB,其余的5k到16k的类似。。根据MFL的可能的取值X,分别计算Px(L),然后把MFL设置为对应最大Px(L)的X,即MFL=X{Max(Px(L)),X={1300,2k,3k…16k}}。在一种情况下,这里若计算出有多个X的发送概率相等,且均大于其他X的取值,也就是说,有多个X可以使Px(L)取得最大值,那么就取这几个X中较大的X值作为MFL,(即若PX1(L)=PX2(L)=MAX(Px(L)),但X2>X1,则取MFL=X2)。这种方式能够从理论上保证当前选择的MFL值对应的发送成功概率最高。The adjustment module can use a variety of methods to adjust the MFL based on P x (L). In one form, the MFL matching the current link state can be taken from P x (L). For example, according to the foregoing, it is assumed that the range of values of X is: {1300, 2k, 3k, 4k, 5k, 6k, 7k, 8k, 9k, 10k, 11k, 12k, 13k, 14k, 15k, 16k}, it should be understood that 2k means 2KB, 3k means 3KB, 4k means 4KB, and the rest 5k to 16k are similar. . Calculate P x (L) according to the possible value X of the MFL, and then set the MFL to X corresponding to the maximum P x (L), that is, MFL=X{Max(P x (L)), X={1300 , 2k, 3k...16k}}. In one case, if it is calculated that the transmission probabilities of multiple Xs are equal and greater than the values of other Xs, that is, if there are multiple Xs that can make P x (L) get the maximum value, then The larger X values of these Xs are taken as MFL (ie, if P X1 (L) = P X2 (L) = MAX (P x (L)), but X2 > X1, then MFL = X2). This way can theoretically ensure that the currently selected MFL value corresponds to the highest probability of successful transmission.
另一种实现方式下,可以使用指数关系调整,即MFL随着Px(L)的变化,呈指数变化。例 如,当L变化从而引起Px(L)变大时,MFL调整为MFL原先取值的两倍;当L变化从而引起Px(L)变小时,MFL调整为MFL原先取值的二分之一;当P无变化时,MFL无变化。应理解,MFL的范围始终在预设的范围,即[1300字节,16384字节]之内。In another implementation, an exponential relationship adjustment can be used, that is, the MFL changes exponentially with a change in P x (L). For example, when L changes to cause P x (L) to become larger, MFL is adjusted to twice the original value of MFL; when L changes to cause P x (L) to become small, MFL is adjusted to the original value of MFL. One; when there is no change in P, there is no change in MFL. It should be understood that the range of the MFL is always within the preset range, that is, [1300 bytes, 16384 bytes].
再一种实现方式下,可以使用递进式的方式来调整。例如,当Px(L)变大时,MFL调整为CWND与MSS的乘积,与MFL原先取值之中的较大值,用公式表示,也就是MFL=Max(old_MFL,CWND*MSS);当Px(L)变小时,MFL调整为CWND与MSS的乘积,与MFL原先取值之中的较小值,用公式表示,也就是MFL=min(old_MFL,CWND*MSS);当P无变化时,MFL无变化。应理解,MFL的范围始终在预设的范围,即[1300字节,16384字节]之内。In another implementation, it can be adjusted in a progressive manner. For example, when P x (L) becomes larger, the MFL is adjusted to the product of CWND and MSS, and the larger value among the original values of the MFL is expressed by formula, that is, MFL=Max(old_MFL, CWND*MSS); When P x (L) becomes small, the MFL is adjusted to the product of CWND and MSS, and the smaller of the MFL original values, which is expressed by formula, that is, MFL=min(old_MFL, CWND*MSS); when P is absent When changing, the MFL has no change. It should be understood that the range of the MFL is always within the preset range, that is, [1300 bytes, 16384 bytes].
应理解,也可以使用其他的方式来根据Px(L)调整MFL的值,本发明实施例不做限制。It should be understood that other methods may be used to adjust the value of the MFL according to P x (L), which is not limited in the embodiment of the present invention.
另一方面,可以从数据量(或者说数据的编号)的角度来考量数据传输成功的概率。也就是说,TLS记录的规格(以S表示,也就是MFL)还可以通过以下方式进行调整。假设,Pr_s(K)是一TLS记录中数据K成功传输的概率,以及,该TLS记录中排列在该数据K之前的数据已被成功传输。其中,数据K可以理解为该数据在接收端的TCP数据的编号为K,本领域技术人员应当理解,实际也就是指的是从编号为1的数据到该数据K,所包括的数据的大小,K的单位为KB。例如K=1,即可以认为Pr_s(K)表示的是1Kb的数据成功传输的概率。换言之,Pr_s(K)的含义就是前文中所述的Px(L),K可以看做是Px(L)中的X。也就是说,可以用K来表示TLS记录的规格(S),这里,Pr_s(K)与RTT、丢包率(loss rate)以及拥塞窗口(cwnd)中的至少一个有关。CWND变化会引起Pr_s(K)的变化。例如,如果cwnd增加,Pr_s(K)减小。另一方面,丢包率变化也会引起Pr_s(K)的变化。例如,如果丢包率增加,Pr_s(K)减小。也就是说,S会随着Pr_s(K)变化,而Pr_s(K)会随着链路质量参数,如RTT、丢包率(loss rate)以及拥塞窗口(cwnd)变化。On the other hand, the probability of successful data transmission can be considered from the perspective of the amount of data (or the number of data). That is to say, the specification of the TLS record (indicated by S, that is, the MFL) can also be adjusted in the following manner. It is assumed that Pr_s(K) is the probability that data K is successfully transmitted in a TLS record, and that the data arranged before the data K in the TLS record has been successfully transmitted. The data K can be understood as the number of the TCP data of the data at the receiving end is K. It should be understood by those skilled in the art that the actual size refers to the size of the data included from the data numbered 1 to the data K. The unit of K is KB. For example, K=1, that is, Pr_s(K) can be considered as the probability of successful transmission of 1Kb of data. In other words, the meaning of Pr_s(K) is P x (L) as described above, and K can be regarded as X in P x (L). That is, the specification (S) of the TLS record can be expressed by K, where Pr_s(K) is related to at least one of the RTT, the loss rate, and the congestion window (cwnd). A change in CWND causes a change in Pr_s(K). For example, if cwnd increases, Pr_s(K) decreases. On the other hand, a change in the packet loss rate also causes a change in Pr_s(K). For example, if the packet loss rate increases, Pr_s(K) decreases. That is, S will change with Pr_s(K), and Pr_s(K) will vary with link quality parameters such as RTT, loss rate, and congestion window (cwnd).
如果Pr_s(K)减小,则S也减小。设K=1,2,4,8,16,且Pr_s(K=1)>Pr_s(K=2)>Pr_s(K=4)>Pr_s(K=8)>Pr_s(K=16)。通常,初始值会从较小是K的取值开始,例如设K=1,这样就不能够将更多的数据传输(flood)入网络。在每个更新的时间点,将S更新到S_i,使得S_i=i max{Pr_s(K=i),i=1,2,4,8,16},也就是说,将K的取值更新为取到在该更新的时间点,能使Pr_s(K)取最大值的K的对应值。If Pr_s(K) decreases, S also decreases. Let K=1, 2, 4, 8, 16 and Pr_s(K=1)>Pr_s(K=2)>Pr_s(K=4)>Pr_s(K=8)>Pr_s(K=16). Usually, the initial value will start from a value that is smaller than K, for example, K = 1, so that more data cannot be flooded into the network. At each updated time point, S is updated to S_i such that S_i=i max{Pr_s(K=i), i=1, 2, 4, 8, 16}, that is, the value of K is updated. In order to obtain the point in time of the update, Pr_s(K) can be made to take the corresponding value of K of the maximum value.
下面结合代码,描述调整模块执行调整MFL值的方法。首先,说明下文代码中涉及到的一些参数的定义:The following describes the method by which the adjustment module performs the adjustment of the MFL value in combination with the code. First, explain the definition of some of the parameters involved in the following code:
a)curr_mfl是当前数据传输使用的最大片段长度(MFL)。a) curr_mfl is the maximum fragment length (MFL) used for current data transmission.
b)default_mfl是MFL的默认值。例如,可以是16K。b) default_mfl is the default value of MFL. For example, it can be 16K.
c)max_mfl是MFL可以增加到的最大值。c) max_mfl is the maximum value that MFL can increase to.
d)min_mfl是MFL可以减小到的最小值。d) min_mfl is the minimum value that the MFL can be reduced to.
e)new_mfl是将要为数据传输设置的MFL的新的取值。e) new_mfl is the new value of the MFL to be set for data transmission.
f)curr_rtt是从tcp_info估计出的,rtt当前的取值。f) curr_rtt is estimated from tcp_info, the current value of rtt.
g)prev_rtt是rtt先前的取值,该取值是在上一个消息传输过程中估计的。g) prev_rtt is the previous value of rtt, which is estimated during the last message transmission.
h)curr_cwnd是从tcp_info估计出的,cwnd当前的取值。h) curr_cwnd is the current value of cwnd estimated from tcp_info.
i)prev_cwnd是cwnd先前的取值,该取值是在上一个消息传输过程中估计的i) prev_cwnd is the previous value of cwnd, which is estimated during the last message transmission.
j)MSS是从tcp_info估计的最大片段的取值。j) MSS is the value of the largest segment estimated from tcp_info.
一种实现方式中,通过rtt来衡量链路状态,这样,rtt变化影响MFL变化。例如,可以这 样设计:MFL有一预设初始值,限定MFL的取值范围在{1300,2k,4k,8k,16k},应理解,2k表示2KB,4k表示4KB,其余的8k,16k的类似。当检测到rtt变大时,表示链路条件变差,则将MFL缩小为原先值(即在rtt该次变化之前的值)的一半(但对于MFL是2k时,由于取值范围限制,MFL缩小后取值为1300字节);当检测到rtt变小时,表示链路条件变好,则将MFL扩大为原先值的2倍(但对于MFL是1300字节时,由于取值范围限制,MFL扩大后取值为2k);在检测到TCP链路状态有其他变化的情况下或者未检测到TCP链路状态有变化的情况下,维持MFL大小不变。In one implementation, the link state is measured by rtt such that the rtt change affects the MFL change. For example, can this Sample design: MFL has a preset initial value, and the range of MFL is limited to {1300, 2k, 4k, 8k, 16k}. It should be understood that 2k represents 2KB, 4k represents 4KB, and the remaining 8k, 16k are similar. When it is detected that rtt becomes large, indicating that the link condition is deteriorated, the MFL is reduced to half of the original value (that is, the value before the change of rtt) (but for the MFL is 2k, due to the value range limitation, MFL The value is reduced to 1300 bytes. When the rtt is detected to be small, indicating that the link condition is good, the MFL is expanded to twice the original value (but for the MFL is 1300 bytes, due to the value range limitation, The MFL is expanded to 2k); if the TCP link status is detected to have other changes or if the TCP link status is not detected to change, the MFL size is maintained.
一种情况下,C语言设计代码如下:In one case, the C language design code is as follows:
Figure PCTCN2017105870-appb-000001
Figure PCTCN2017105870-appb-000001
再一种情况下,初始化阶段,给一些参数赋初始值,其中,将curr_mfl设置为default_mfl,也就是先给MFL设置一个预置值,将max_mfl设置为16KB,以及将min_mfl为1300Byte。则可以采用如下代码实现:In another case, in the initialization phase, some parameters are assigned initial values, wherein curr_mfl is set to default_mfl, that is, a preset value is set to the MFL, max_mfl is set to 16 KB, and min_mfl is 1300 Byte. Then you can use the following code to achieve:
Figure PCTCN2017105870-appb-000002
Figure PCTCN2017105870-appb-000002
也就是说,当检测到rtt变化,只有在MFL的原先值(即在rtt该次变化之前的值,也就是curr_mfl)大于min_mfl(即1300Byte),或者在MFL的原先值小于max_mfl(即16KB)的情况下,才改变MFL的值,否则(即curr_mfl=1300Byte或者curr_mfl=16KB),即使rtt变化,MFL的值也不变。应理解,为了上述的代码能够根据rtt变化调整MFL值,default_mfl应当设为一大于min_mfl小于max_mfl的值。That is, when the rtt change is detected, only the original value of the MFL (ie, the value before the change of rtt, that is, curr_mfl) is greater than min_mfl (ie, 1300 Byte), or the original value of the MFL is less than max_mfl (ie, 16 KB). In the case of the MFL, otherwise the value of the MFL is changed (ie, curr_mfl=1300Byte or curr_mfl=16KB), and the value of the MFL does not change even if rtt changes. It should be understood that for the above code to be able to adjust the MFL value according to the rtt change, the default_mfl should be set to a value greater than min_mfl less than max_mfl.
另一种实现方式中,通过cwnd来衡量链路状态,这样,cwnd变化影响MFL变化。例如,可以这样设计:根据触发条件(例如定时),估计当前的cwnd值,如果发现cwnd值变化,那么就给MFL赋一个新的值,也就是增大或者减小MFL的原先值(即在cwnd该次变化之前的值,也就是curr_mfl)。在一种实现方式下,初始化阶段,给一些参数赋初始值,其中,将curr_mfl设置为default_mfl,也就是先给MFL设置一个预置值,将max_mfl设置为16KB,以及将min_mfl为1300Byte。另外,可以引入MSS,与cwnd一起控制MFL值的变化。则可以用如下代码实现:In another implementation, the link state is measured by cwnd, such that the cwnd change affects the MFL change. For example, it can be designed to estimate the current cwnd value according to the trigger condition (such as timing). If the cwnd value is found to change, then the MFL is assigned a new value, that is, the original value of the MFL is increased or decreased (ie, Cwnd The value before this change, which is curr_mfl). In an implementation manner, in the initialization phase, some parameters are assigned initial values, wherein curr_mfl is set to default_mfl, that is, a preset value is first set to the MFL, max_mfl is set to 16 KB, and min_mfl is 1300 Byte. In addition, MSS can be introduced to control changes in MFL values along with cwnd. It can be implemented with the following code:
Figure PCTCN2017105870-appb-000003
Figure PCTCN2017105870-appb-000003
Figure PCTCN2017105870-appb-000004
Figure PCTCN2017105870-appb-000004
也就是说,在cwnd变小的情况下,也就是检测到的cwnd小于之前的cwnd(curr_cwnd<prev_cwnd),则:若当前的cwnd与MSS的乘积(curr_cwnd*MSS)小于min_mfl,调整MFL(new_mfl)为min_mfl,即确保MFL的值不小于预置的最小值;若当前的cwnd与MSS的乘积小于curr_mfl(MFL的原先值),则调整MFL(new_mfl)为cwnd与MSS的乘积;在其他情况下,不改变MFL的原先值(new_mfl=curr_mfl)。That is to say, in the case where cwnd becomes smaller, that is, the detected cwnd is smaller than the previous cwnd (curr_cwnd<prev_cwnd), if the product of the current cwnd and the MSS (curr_cwnd*MSS) is smaller than min_mfl, the MFL is adjusted (new_mfl). ) is min_mfl, that is, to ensure that the value of MFL is not less than the preset minimum value; if the current product of cwnd and MSS is less than curr_mfl (the original value of MFL), then adjust MFL(new_mfl) as the product of cwnd and MSS; in other cases Next, the original value of the MFL is not changed (new_mfl=curr_mfl).
在cwnd变大的情况下,也就是检测到的cwnd大于之前的cwnd(curr_cwnd>prev_cwnd),则:若当前的cwnd与MSS的乘积(curr_cwnd*MSS)大于max_mfl,调整MFL(new_mfl)为max_mfl,即确保MFL的值不大于预置的最大值;若当前的cwnd与MSS的乘积大于curr_mfl(MFL的原先值),则调整MFL(new_mfl)为cwnd与MSS的乘积;在其他情况下,不改变MFL的原先值(new_mfl=curr_mfl)。In the case where cwnd becomes larger, that is, the detected cwnd is larger than the previous cwnd (curr_cwnd>prev_cwnd), if the current product of cwnd and MSS (curr_cwnd*MSS) is greater than max_mfl, the MFL (new_mfl) is adjusted to max_mfl, That is, the value of the MFL is not greater than the preset maximum value; if the current product of cwnd and MSS is greater than curr_mfl (the original value of the MFL), the MFL (new_mfl) is adjusted to be the product of cwnd and MSS; in other cases, the value is not changed. The original value of the MFL (new_mfl=curr_mfl).
在其他情况下,也就是说如果cwnd不变,或者在检测到TCP链路状态有其他变化的情况下或者未检测到TCP链路状态有变化的情况下,维持MFL大小不变。In other cases, that is, if cwnd is unchanged, or if there is a change in the TCP link state or if there is no change in the TCP link state detected, the MFL size is maintained.
综上,本申请所记载的方案,提供了一种发送报文的方法,其中涉及调整TLS记录的规格(size),该方法使用MFL作为TLS记录的规格,基于该TLS对应的TCP连接的链路信息,调整MFL的值,从而使得TLS记录的规格能够根据TCL连接的链路状态灵活地调整,使得数据的传输更加流畅,从而提高了通信的性能。In summary, the solution described in the present application provides a method for transmitting a message, which involves adjusting a size of a TLS record, and the method uses the MFL as a specification of the TLS record, based on the chain of the TCP connection corresponding to the TLS. The road information adjusts the value of the MFL so that the specification of the TLS record can be flexibly adjusted according to the link state of the TCL connection, so that the data transmission is smoother, thereby improving the communication performance.
另一方面,如图5所示,本申请文件记载一种发送报文的装置500,该装置500包括发送模块501和调整模块502,其中,发送模块501用于发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;On the other hand, as shown in FIG. 5, the present application describes a device 500 for transmitting a message, the device 500 includes a sending module 501 and an adjusting module 502, wherein the sending module 501 is configured to send the first TCP connection. a first packet, a maximum fragment length MFL of the first TCP connection is a first value, and the MFL indicates a specification of a maximum transport layer security TLS record used by the first TCP connection to transmit data, where The specification of the TLS record of a message is the first value;
调整模块502用于确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息 用于表示TCP连接的传输性能;以及根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值;发送模块501还用于向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。The adjusting module 502 is configured to determine that link state information of the first TCP connection changes, the link state information For indicating the transmission performance of the TCP connection; and adjusting the MFL of the first TCP connection to a second value according to the change of the link state information; the sending module 501 is further configured to connect to the first TCP connection Sending, by the terminal, the second packet of the first TCP connection, where the MFL of the second packet is the second value.
在一种实现方式下,调整模块502用于在检测到该装置接收到报文,或者待发送报文的情况下,确定所述第一TCP连接的链路状态信息发生变化。In an implementation manner, the adjusting module 502 is configured to determine that the link state information of the first TCP connection changes when the device receives the packet or sends a packet.
在另一种实现方式下,调整模块502用于在预置的时刻,或者根据预置的时间间隔,周期性地确定所述第一TCP连接的链路状态信息发生变化。In another implementation manner, the adjusting module 502 is configured to periodically determine that the link state information of the first TCP connection changes at a preset time or according to a preset time interval.
其中,链路状态信息包括往返时延RTT,拥塞窗口CWND,平均拥塞窗口和丢包率中的至少一种。The link state information includes at least one of a round trip delay RTT, a congestion window CWND, an average congestion window, and a packet loss ratio.
其中,所述MFL的取值范围为大于等于1300Byte,且小于等于16KB。The value range of the MFL is greater than or equal to 1300 Bytes and less than or equal to 16 KB.
应理解,该发送装置可以向该第一TCP连接中,该发送端的对端(也就是接收端)发送,也就是该第一报文对应的TCP报文中的目的地址所表示的设备。也可以是认为是向该发送端对应的物理机的I/O(input/output)设备发送。It should be understood that the sending device may send, to the first TCP connection, the opposite end (that is, the receiving end) of the transmitting end, that is, the device represented by the destination address in the TCP packet corresponding to the first packet. Alternatively, it may be transmitted to an I/O (input/output) device of a physical machine corresponding to the transmitting end.
该装置为上文所记载的方法实施例对应的装置,因此,有关于该装置的多种实现方式、具体的实现细节以及相关技术效果,请参照前文的记载。尤其是具体地如何根据链路状态信息的变化调整MFL,请参见前文记载的各种实现方式。The device is a device corresponding to the method embodiment described above. Therefore, regarding various implementations, specific implementation details, and related technical effects of the device, please refer to the foregoing description. In particular, how to adjust the MFL according to the change of the link state information, please refer to the various implementations described above.
应理解,该装置中,调整模块可以理解为位于应用层与TCP协议层之间,该调整模块可以是一个进程或者线程,也可以是一段可执行代码。It should be understood that, in the device, the adjustment module can be understood as being located between the application layer and the TCP protocol layer, and the adjustment module can be a process or a thread, or can be a piece of executable code.
这样,本申请文件提供了一种发送报文的装置,其中涉及调整TLS记录的规格(size),该装置使用MFL作为TLS记录的规格,基于该TLS对应的TCP连接的链路信息,调整MFL的值,从而使得TLS记录的规格能够根据TCL连接的链路状态灵活地调整,使得数据的传输更加流畅,从而提高了通信的性能。Thus, the present application provides an apparatus for transmitting a message, which involves adjusting a size of a TLS record. The apparatus uses the MFL as a specification of the TLS record, and adjusts the MFL based on the link information of the TCP connection corresponding to the TLS. The value of the TLS record can be flexibly adjusted according to the link state of the TCL connection, so that the data transmission is smoother, thereby improving the communication performance.
可以理解的是,上述各方法实施例所描述的发送端和接收端可以由具有数据收发能力的任何设备来实现。例如发送端可以是终端或者服务器。如图5所示,该发送端装置300包括:处理电路302,以及与其连接的通信接口304和存储介质320。It can be understood that the transmitting end and the receiving end described in the foregoing method embodiments can be implemented by any device having data transceiving capability. For example, the sender can be a terminal or a server. As shown in FIG. 5, the transmitting device 300 includes a processing circuit 302, and a communication interface 304 and a storage medium 320 connected thereto.
其中,上文中提及的调整模块,以及上文中提及的发送报文的方法,可以通过处理电路302执行存储介质320中的程序来实现,应理解,涉及到向其他设备发送或者接收其他设备的信息,处理电路302需要执行存储介质320中的程序,以调用通信接口304来实现。The adjustment module mentioned above, and the method for sending a message mentioned above, may be implemented by the processing circuit 302 executing a program in the storage medium 320, which should be understood to involve sending or receiving other devices to other devices. The information processing circuit 302 needs to execute a program in the storage medium 320 to invoke the communication interface 304.
处理电路302用于处理数据,控制数据访问和存储,发出命令以及控制其它设备执行操作。处理电路302可以被实现为一个或多个处理器,一个或多个控制器和/或可用于执行程序等的其它结构。处理电路302具体可以包括通用处理器,数字信号处理器(DSP),专用集成电路(ASIC),现场可编程门阵列(FPGA)或其它可编程逻辑组件中的至少一种。通用处理器可以包括微处理器,以及任何常规的处理器,控制器,微控制器,或状态机。处理电路302也可以实现为计算组件,例如DSP和微处理器的组合。 Processing circuitry 302 is used to process data, control data access and storage, issue commands, and control other devices to perform operations. Processing circuitry 302 may be implemented as one or more processors, one or more controllers, and/or other structures that may be used to execute a program or the like. Processing circuitry 302 may specifically include at least one of a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic component. A general purpose processor may include a microprocessor, as well as any conventional processor, controller, microcontroller, or state machine. Processing circuit 302 can also be implemented as a computing component, such as a combination of a DSP and a microprocessor.
存储介质306可以包括计算机可读存储介质,如磁存储设备(例如,硬盘,软盘,磁条),光存储介质(例如,数字多功能盘(DVD)),智能卡,闪存设备,随机存取存储器(RAM),只读存储器(ROM),可编程ROM(PROM),可擦除PROM(EPROM),寄存器,以及它们的任意组合。存储介质306可以耦合到处理电路302以使得处理电路302可读取信息和将信息写入到存储介质306。具体地,存储介质306可以集成到处理电路302,或者存储介质306和处理电路302可以是分开的。 The storage medium 306 may include a computer readable storage medium such as a magnetic storage device (eg, a hard disk, a floppy disk, a magnetic strip), an optical storage medium (eg, a digital versatile disk (DVD)), a smart card, a flash memory device, a random access memory. (RAM), read only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), registers, and any combination thereof. Storage medium 306 can be coupled to processing circuitry 302 such that processing circuitry 302 can read information and write information to storage medium 306. In particular, storage medium 306 can be integrated into processing circuit 302, or storage medium 306 and processing circuit 302 can be separate.
通信接口304可包括电路和/或程序以实现用户设备300与一个或多个无线网络设备(例如,服务器)之间的双向通信。通信接口304可以耦合到一个或多个天线(图6中未示出),并包括至少一个接收电路316和/或至少一个发射电路318。在一个实施例中,通信接口304可以是全部或部分由无线调制解调器来实现。 Communication interface 304 may include circuitry and/or programs to enable two-way communication between user device 300 and one or more wireless network devices (eg, servers). Communication interface 304 can be coupled to one or more antennas (not shown in FIG. 6) and includes at least one receiving circuit 316 and/or at least one transmitting circuit 318. In one embodiment, communication interface 304 may be implemented in whole or in part by a wireless modem.
根据本发明实施例的一个或多个方面,处理电路302被适配为执行存储在与存储介质306中的协议栈程序320,以实现上述方法实施例中的部分或全部步骤。In accordance with one or more aspects of embodiments of the present invention, processing circuit 302 is adapted to execute protocol stack program 320 stored in storage medium 306 to implement some or all of the steps of the above method embodiments.
还应当理解,该装置500是可以发送经过TLS协议层处理的TCP报文的装置,例如可以是终端也可以是网络设备。It should also be understood that the apparatus 500 is a device that can transmit a TCP message processed through the TLS protocol layer, and may be, for example, a terminal or a network device.
还应当理解,装置500也可以通过图6中所示的发送端装置实现。例如,其中的发送模块501,可以由处理电路302执行存储介质320中的程序,以调用通信接口304来实现;另一方面,调整模块502可以由处理电路302执行存储介质320中的程序执行。再例如,上文中提及的TCP/IP协议栈等,可以存储在存储介质320中。It should also be understood that the apparatus 500 can also be implemented by the transmitting device shown in FIG. For example, the sending module 501 can execute the program in the storage medium 320 by the processing circuit 302 to invoke the communication interface 304. On the other hand, the adjusting module 502 can execute the program execution in the storage medium 320 by the processing circuit 302. As another example, the TCP/IP protocol stack or the like mentioned above may be stored in the storage medium 320.
以上为对本发明实施例所提供的发送报文的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The foregoing is a detailed description of a method and an apparatus for transmitting a message according to an embodiment of the present invention. The principles and implementation manners of the present invention are described in the following, and are generally described by those skilled in the art. The present invention is not limited by the scope of the present invention.

Claims (21)

  1. 一种发送报文的方法,其特征在于,所述方法包括:A method for sending a message, the method comprising:
    第一TCP连接的发送端发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;The sending end of the first TCP connection sends the first packet of the first TCP connection, the maximum fragment length MFL of the first TCP connection is a first value, and the MFL indicates that the first TCP connection is used for transmission The specification of the maximum transport layer security TLS record of the data, the specification of the TLS record of the first packet is the first value;
    所述发送端确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息用于表示TCP连接的传输性能;The sending end determines that the link state information of the first TCP connection changes, and the link state information is used to indicate the transmission performance of the TCP connection;
    根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值;The transmitting end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information;
    所述发送端向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。The sending end sends the second packet of the first TCP connection to the opposite end of the first TCP connection, where the MFL of the second packet is the second value.
  2. 根据权利要求1所述的方法,其特征在于,所述链路状态信息包括往返时延RTT,拥塞窗口CWND和丢包率中的至少一种。The method according to claim 1, wherein the link state information comprises at least one of a round trip delay RTT, a congestion window CWND, and a packet loss ratio.
  3. 根据权利要求1或2所述的方法,其特征在于,所述MFL的取值范围为大于等于1300Byte,且小于等于16KB。The method according to claim 1 or 2, wherein the MFL has a value range of 1300 Bytes or more and 16 KB or less.
  4. 根据权利要求1到3任一所述的方法,其特征在于,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the transmitting end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including:
    使用变化后的所述链路状态信息,计算所述MFL取值范围内的多个值所对应的报文发送成功的概率;Calculating, by using the changed link state information, a probability that a packet corresponding to the multiple values in the MFL value range is successfully sent;
    将所述一TCP连接的MFL调整为所述多个值中的第二值,所述第二值对应的报文发送成功的概率为所述多个值所对应的报文发送成功的概率中的最大值。The MFL of the TCP connection is adjusted to a second value of the plurality of values, and the probability that the packet corresponding to the second value is successfully sent is the probability that the packet corresponding to the multiple values is successfully sent. The maximum value.
  5. 根据权利要求1到3任一所述的方法,其特征在于,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the transmitting end adjusts the MFL of the first TCP connection to a second value according to the change of the link state information, including:
    使用变化后的所述链路状态信息,计算所述第一TCP连接的报文发送成功的概率;Calculating, by using the changed link state information, a probability that the first TCP connection is successfully sent;
    在所述概率增大的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值大于第一值;Adjusting, in the case of the increased probability, the MFL of the first TCP connection to a second value, wherein the second value is greater than the first value;
    在所述概率减小的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值小于第一值。In case the probability is reduced, the MFL of the first TCP connection is adjusted to a second value, wherein the second value is smaller than the first value.
  6. 根据权利要求1到3任一所述的方法,其特征在于,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the link state information comprises a round-trip delay RTT, and the transmitting end will be the first according to the change of the link state information The MFL of the TCP connection is adjusted to the second value, including:
    在所述RTT增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;In the case that the RTT is increased, the MFL of the first TCP connection is adjusted to a second value, and the second value is less than or equal to the first value;
    在所述RTT减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In the case that the RTT is reduced, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
  7. 根据权利要求1到3任一所述的方法,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括往返时延RTT,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the MFL is pre-set with a value range, the link state information includes a round-trip delay RTT, and the change according to the link state information The sending end adjusts the MFL of the first TCP connection to a second value, including:
    在所述RTT增大,且所述第一值小于所述取值范围中的最大值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的一半; And adjusting, when the RTT is increased, and the first value is smaller than a maximum value of the value range, adjusting the MFL of the first TCP connection to a second value, where the second value is Half of the first value;
    在所述RTT减小,且所述第一值大于所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的两倍;And adjusting, when the RTT is decreased, and the first value is greater than a minimum value of the value range, adjusting the MFL of the first TCP connection to a second value, where the second value is Double the first value;
    在所述RTT增大,且所述第一值为所述取值范围中的最大值的情况下,或者,在所述RTT减小,且所述第一值为所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值等于所述第一值。In a case where the RTT is increased, and the first value is a maximum value in the value range, or the RTT is decreased, and the first value is in the value range In the case of the minimum value, the MFL of the first TCP connection is adjusted to a second value, the second value being equal to the first value.
  8. 根据权利要求1到3任一所述的方法,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the change according to the link state information, The sending end adjusts the MFL of the first TCP connection to a second value, including:
    在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;When the CWND is increased, adjusting the MFL of the first TCP connection to a second value, where the second value is less than or equal to the first value;
    在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In the case that the CWND is reduced, the MFL of the first TCP connection is adjusted to a second value, and the second value is greater than or equal to the first value.
  9. 根据权利要求1到3任一所述的方法,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,所述根据所述链路状态信息的变化,所述发送端将所述第一TCP连接的MFL调整为第二值,包括:The method according to any one of claims 1 to 3, wherein the MFL is pre-set with a value range, the link state information includes a congestion window CWND, and the change according to the link state information, The sending end adjusts the MFL of the first TCP connection to a second value, including:
    在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较小值,其中,在所述乘积小于所述取值范围中的最小值的情况下,所述第二值为所述取值范围中的最小值;And increasing, in the case that the CWND is increased, the MFL of the first TCP connection to a second value, where the second value is a product of the CWND and a maximum packet length MSS of the first TCP connection, And a smaller value of the first value, wherein, in a case where the product is smaller than a minimum value of the value range, the second value is a minimum value of the value range;
    在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较大值,其中,在所述乘积大于所述取值范围中的最大值的情况下,所述第二值为所述取值范围中的最大值。And adjusting, in the case that the CWND is reduced, the MFL of the first TCP connection to a second value, where the second value is a product of the CWND and a maximum message length MSS of the first TCP connection, And a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is a maximum value in the value range.
  10. 根据权利要求1到9任一所述的方法,其特征在于,所述确定所述第一TCP连接的链路状态信息发生变化,包括:The method according to any one of claims 1 to 9, wherein the determining the link state information of the first TCP connection changes comprises:
    在接收到报文或者发送报文时,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化;When receiving the packet or sending the packet, detecting link state information of the first TCP connection to determine that the link state information changes;
    或者,根据预设的时刻或者预设的时间间隔,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化。Or detecting link state information of the first TCP connection according to a preset time or a preset time interval to determine that the link state information changes.
  11. 一种发送报文的装置,其特征在于,所述装置包括:An apparatus for transmitting a message, the apparatus comprising:
    发送模块,所述发送模块用于发送所述第一TCP连接的第一报文,所述第一TCP连接的最大分片长度MFL为第一值,所述MFL表示所述第一TCP连接用于传输数据的最大的传输层安全TLS记录的规格,所述第一报文的TLS记录的规格为所述第一值;a sending module, where the sending module is configured to send the first packet of the first TCP connection, where a maximum fragment length MFL of the first TCP connection is a first value, and the MFL is used to indicate the first TCP connection The specification of the maximum transport layer security TLS record for transmitting data, the specification of the TLS record of the first packet being the first value;
    调整模块,所述调整模块用于确定所述第一TCP连接的链路状态信息发生变化,所述链路状态信息用于表示TCP连接的传输性能;An adjustment module, configured to determine a change in link state information of the first TCP connection, where the link state information is used to indicate a transmission performance of the TCP connection;
    所述调整模块还用于根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值;The adjusting module is further configured to adjust the MFL of the first TCP connection to a second value according to the change of the link state information;
    所述发送模块还用于向所述第一TCP连接的对端发送所述第一TCP连接的第二报文,所述第二报文的MFL为所述第二值。The sending module is further configured to send the second packet of the first TCP connection to the opposite end of the first TCP connection, where the MFL of the second packet is the second value.
  12. 根据权利要求11所述的装置,其特征在于,所述链路状态信息包括往返时延RTT, 拥塞窗口CWND和丢包率中的至少一种。The apparatus according to claim 11, wherein said link state information comprises a round trip delay RTT, At least one of a congestion window CWND and a packet loss rate.
  13. 根据权利要求11或12所述的装置,其特征在于,所述MFL的取值范围为大于等于1300Byte,且小于等于16KB。The apparatus according to claim 11 or 12, wherein the MFL has a value range of 1300 Bytes or more and 16 KB or less.
  14. 根据权利要求11到13任一所述的装置,其特征在于,在所述根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于使用变化后的所述链路状态信息,计算所述MFL取值范围内的多个值所对应的报文发送成功的概率;将所述一TCP连接的MFL调整为所述多个值中的第二值,所述第二值对应的报文发送成功的概率为所述多个值所对应的报文发送成功的概率中的最大值。The apparatus according to any one of claims 11 to 13, wherein said adjusting said MFL of said first TCP connection to a second value according to said change of said link state information, said adjusting The module is configured to calculate, by using the changed link state information, a probability that a packet corresponding to the multiple values in the MFL value range is successfully sent; and adjusting the MFL of the TCP connection to the multiple The second value of the value, the probability that the packet corresponding to the second value is successfully sent is the maximum value of the probability that the packet corresponding to the multiple values is successfully sent.
  15. 根据权利要求11到13任一所述的装置,其特征在于,在根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于:The apparatus according to any one of claims 11 to 13, wherein in the adjusting module, the MFL of the first TCP connection is adjusted to a second value according to a change of the link state information. to:
    使用变化后的所述链路状态信息,计算所述第一TCP连接的报文发送成功的概率;在所述概率增大的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值大于第一值;在所述概率减小的情况下,将所述第一TCP连接的MFL调整为第二值,其中,所述第二值小于第一值。Calculating, by using the changed link state information, a probability that the first TCP connection is successfully sent; and if the probability is increased, adjusting the MFL of the first TCP connection to a second value And wherein the second value is greater than the first value; and if the probability is decreased, adjusting the MFL of the first TCP connection to a second value, wherein the second value is less than the first value.
  16. 根据权利要求11到13任一所述的装置,其特征在于,所述链路状态信息包括往返时延RTT,在根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于:The apparatus according to any one of claims 11 to 13, wherein the link state information comprises a round trip delay RTT, and the MFL of the first TCP connection is adjusted according to a change of the link state information. For the second value aspect, the adjustment module is used to:
    在所述RTT增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述RTT减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。In the case that the RTT is increased, the MFL of the first TCP connection is adjusted to a second value, the second value is less than or equal to a first value; and in a case where the RTT is decreased, the first The MFL of a TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
  17. 根据权利要求11到13任一所述的装置,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括往返时延RTT,在所述根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于在所述RTT增大,且所述第一值小于所述取值范围中的最大值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的一半;The apparatus according to any one of claims 11 to 13, wherein the MFL is pre-set with a value range, and the link state information includes a round-trip delay RTT, in the information according to the link state information. Changing, the aspect of adjusting the MFL of the first TCP connection to a second value, wherein the adjusting module is configured to increase when the RTT is greater than the maximum value of the value range And adjusting the MFL of the first TCP connection to a second value, where the second value is half of the first value;
    在所述RTT减小,且所述第一值大于所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述第一值的两倍;And adjusting, when the RTT is decreased, and the first value is greater than a minimum value of the value range, adjusting the MFL of the first TCP connection to a second value, where the second value is Double the first value;
    在所述RTT增大,且所述第一值为所述取值范围中的最大值的情况下,或者,在所述RTT减小,且所述第一值为所述取值范围中的最小值的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值等于所述第一值。In a case where the RTT is increased, and the first value is a maximum value in the value range, or the RTT is decreased, and the first value is in the value range In the case of the minimum value, the MFL of the first TCP connection is adjusted to a second value, the second value being equal to the first value.
  18. 根据权利要求11到13任一所述的装置,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,在所述根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于The device according to any one of claims 11 to 13, wherein the MFL is pre-set with a value range, and the link state information includes a congestion window CWND, and the change according to the link state information Adjusting the MFL of the first TCP connection to a second value, the adjustment module is used
    在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值小于等于第一值;在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值大于等于第一值。When the CWND is increased, the MFL of the first TCP connection is adjusted to a second value, the second value is less than or equal to a first value; and in a case where the CWND is decreased, the first The MFL of a TCP connection is adjusted to a second value, the second value being greater than or equal to the first value.
  19. 根据权利要求11到13任一所述的装置,其特征在于,所述MFL预设有取值范围,所述链路状态信息包括拥塞窗口CWND,在根据所述链路状态信息的变化,将所述第一TCP连接的MFL调整为第二值的方面,所述调整模块用于The device according to any one of claims 11 to 13, wherein the MFL is pre-set with a value range, and the link state information includes a congestion window CWND, and according to the change of the link state information, The MFL of the first TCP connection is adjusted to an aspect of a second value, and the adjustment module is used for
    在所述CWND增大的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值 为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较小值,其中,在所述乘积小于所述取值范围中的最小值的情况下,所述第二值为所述取值范围中的最小值;Adjusting the MFL of the first TCP connection to a second value, where the CWND is increased, the second value a product of a maximum message length MSS of the CWND and the first TCP connection, and a smaller value of the first value, wherein the product is less than a minimum value of the value range The second value is a minimum value in the range of values;
    在所述CWND减小的情况下,将所述第一TCP连接的MFL调整为第二值,所述第二值为所述CWND与所述第一TCP连接的最大报文长度MSS的乘积,与所述第一值中的较大值,其中,在所述乘积大于所述取值范围中的最大值的情况下,所述第二值为所述取值范围中的最大值。And adjusting, in the case that the CWND is reduced, the MFL of the first TCP connection to a second value, where the second value is a product of the CWND and a maximum message length MSS of the first TCP connection, And a larger value of the first value, wherein, in a case where the product is greater than a maximum value in the value range, the second value is a maximum value in the value range.
  20. 根据权利要求11到19任一所述的装置,其特征在于,在确定所述第一TCP连接的链路状态信息发生变化的方面,所述调整模块用于The apparatus according to any one of claims 11 to 19, wherein said adjustment module is used for determining that a change in link state information of said first TCP connection is made
    在接收到报文或者发送报文时,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化;When receiving the packet or sending the packet, detecting link state information of the first TCP connection to determine that the link state information changes;
    或者,根据预设的时刻或者预设的时间间隔,检测所述第一TCP连接的链路状态信息,以确定所述链路状态信息发生变化。Or detecting link state information of the first TCP connection according to a preset time or a preset time interval to determine that the link state information changes.
  21. 一种设备,用于发送报文,其特征在于,所述设备包括:处理电路、通信接口和存储介质,所述存储介质中存储有协议栈程序,所述通信接口用于通过执行所述存储介质中的程序与其他设备收发信息,所述处理器用于通过运行所述存储介质中的指令,以实现权利要求1到10所述的方法。 A device for transmitting a message, the device comprising: a processing circuit, a communication interface, and a storage medium, wherein the storage medium stores a protocol stack program, and the communication interface is configured to perform the storage A program in the medium transmits and receives information to and from other devices, the processor being operative to implement the method of claims 1 to 10 by operating instructions in the storage medium.
PCT/CN2017/105870 2017-02-13 2017-10-12 Method and device for transmitting packet WO2018145481A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710076967.1A CN108429700B (en) 2017-02-13 2017-02-13 Method and device for sending message
CN201710076967.1 2017-02-13

Publications (1)

Publication Number Publication Date
WO2018145481A1 true WO2018145481A1 (en) 2018-08-16

Family

ID=63107905

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/105870 WO2018145481A1 (en) 2017-02-13 2017-10-12 Method and device for transmitting packet

Country Status (2)

Country Link
CN (1) CN108429700B (en)
WO (1) WO2018145481A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111163037A (en) * 2018-11-07 2020-05-15 大唐移动通信设备有限公司 IP fragmentation optimization method and device
CN112911693B (en) * 2019-11-19 2022-03-29 大唐移动通信设备有限公司 Message processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103647759A (en) * 2013-11-26 2014-03-19 华为技术有限公司 Negotiation method and apparatus of maximum segment size (MSS)
US20150365503A1 (en) * 2014-06-12 2015-12-17 Accton Technology Corporation Method for determining maximum segment size
CN105429910A (en) * 2015-11-06 2016-03-23 京信通信技术(广州)有限公司 Message transmission and processing method and device
CN105704084A (en) * 2014-11-24 2016-06-22 中兴通讯股份有限公司 Processing method of TCP connection, processing device and mobile terminal

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050120213A1 (en) * 2003-12-01 2005-06-02 Cisco Technology, Inc. System and method for provisioning and authenticating via a network
CN101924771B (en) * 2010-08-26 2013-11-06 北京天融信科技有限公司 Core-level TCP adhering junction method for accelerating application proxy
US8843738B2 (en) * 2012-05-14 2014-09-23 Sierra Wireless, Inc. TLS abbreviated session identifier protocol
CN103929370A (en) * 2013-01-11 2014-07-16 中国科学院声学研究所 TCP congestion control method for bandwidth reservation network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103647759A (en) * 2013-11-26 2014-03-19 华为技术有限公司 Negotiation method and apparatus of maximum segment size (MSS)
US20150365503A1 (en) * 2014-06-12 2015-12-17 Accton Technology Corporation Method for determining maximum segment size
CN105704084A (en) * 2014-11-24 2016-06-22 中兴通讯股份有限公司 Processing method of TCP connection, processing device and mobile terminal
CN105429910A (en) * 2015-11-06 2016-03-23 京信通信技术(广州)有限公司 Message transmission and processing method and device

Also Published As

Publication number Publication date
CN108429700B (en) 2021-04-20
CN108429700A (en) 2018-08-21

Similar Documents

Publication Publication Date Title
US11855895B2 (en) Systems, apparatuses and methods for network packet management
US11570098B2 (en) Systems, apparatuses and methods for cooperating routers
Cui et al. Innovating transport with QUIC: Design approaches and research challenges
BR112019009138B1 (en) APPLICATION CHARACTERIZATION USING TRANSPORT PROTOCOL ANALYSIS
US8301685B2 (en) Method and apparatus for managing transmission of TCP data segments
US11258774B1 (en) Adaptive control of secure sockets layer proxy
US10382481B2 (en) System and method to spoof a TCP reset for an out-of-band security device
WO2012083762A1 (en) Data transmission method, apparatus, and system
WO2018145481A1 (en) Method and device for transmitting packet
EP3539235B1 (en) Systems, apparatuses and methods for cooperating routers
US20230171191A1 (en) Systems, Apparatuses and Methods for Cooperating Routers
US10715495B2 (en) Congestion control during communication with a private network
JP2006005833A (en) Device, method and program for data communication, and recording medium
Rajput et al. Comparing stream control and datagram congestion control with traditional transmission control protocol
Kühlewind Innovating Transport with QUIC: Design Approaches and Research Challenges

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: 17896020

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17896020

Country of ref document: EP

Kind code of ref document: A1