CN106936730B - Message sending method, TCP (Transmission control protocol) proxy and TCP client - Google Patents

Message sending method, TCP (Transmission control protocol) proxy and TCP client Download PDF

Info

Publication number
CN106936730B
CN106936730B CN201511024912.3A CN201511024912A CN106936730B CN 106936730 B CN106936730 B CN 106936730B CN 201511024912 A CN201511024912 A CN 201511024912A CN 106936730 B CN106936730 B CN 106936730B
Authority
CN
China
Prior art keywords
tcp
bandwidth
sample
token
sending
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201511024912.3A
Other languages
Chinese (zh)
Other versions
CN106936730A (en
Inventor
王文涛
朱坤
秦韵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201511024912.3A priority Critical patent/CN106936730B/en
Priority to PCT/CN2016/111079 priority patent/WO2017114231A1/en
Publication of CN106936730A publication Critical patent/CN106936730A/en
Application granted granted Critical
Publication of CN106936730B publication Critical patent/CN106936730B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/407Bus networks with decentralised control
    • H04L12/417Bus networks with decentralised control with deterministic access, e.g. token passing
    • 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/19Flow control; Congestion control at layers above the network layer
    • H04L47/193Flow control; Congestion control at layers above the network layer at the transport layer, e.g. TCP related
    • 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/215Flow control; Congestion control using token-bucket
    • 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/26Flow control; Congestion control using explicit feedback to the source, e.g. choke packets
    • H04L47/263Rate modification at the source after receiving feedback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/2871Implementation details of single intermediate entities
    • 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/163In-band adaptation of TCP data exchange; In-band control procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses a message sending method, a TCP (transmission control protocol) agent and a TCP client. The method is used for effectively avoiding the network from entering too many messages instantly and improving the TCP throughput. The method provided by the embodiment of the invention comprises the following steps: sending M messages to a TCP client; receiving N TCP response messages of M messages sent by a TCP client; calculating the sample transmission bandwidth of the TCP connection between the TCP agent and the TCP client according to each sample TCP response message, wherein the sample TCP response message is at least one of the N TCP response messages; determining an estimated bandwidth sample set according to the sample transmission bandwidth, wherein the estimated bandwidth sample set comprises the sample transmission bandwidth calculated according to each sample TCP response message; determining an estimated bandwidth according to the estimated bandwidth sample set; determining a target bandwidth according to the estimated bandwidth; determining the number of tokens available according to the target bandwidth, and controlling the sending of the message according to the number of tokens available.

Description

Message sending method, TCP (Transmission control protocol) proxy and TCP client
Technical Field
The present invention relates to the field of communications, and in particular, to a packet transmission method, a TCP proxy, and a TCP client.
Background
Network congestion refers to the phenomenon that a certain part of a communication network has too many packets (packets) and the part of the network has no time to process the packets, so that the performance of the part of the network and even the whole network is reduced, and even network communication service is stopped when the network congestion is serious, which is called congestion. Congestion is a network condition that is continuously overloaded when the user demand for network resources (including link bandwidth, memory, and processor processing power, etc.) exceeds the inherent capacity.
In the prior art, the number of messages entering a network is mainly controlled by an application based on a Transmission Control Protocol (TCP) through a TCP sliding window mechanism. When the network is congested, the TCP congestion control adjusts the sending window continuously according to an additive-multiplicative-subtractive (english called as AIMD) algorithm to adapt to the network quality.
Because the participants of the TCP sliding window mechanism are only the sending end and the receiving end of a single TCP connection, it only considers the receiving capability of the receiving end, but does not consider the transmission capability of the network, and it is easy for the network to enter too many messages instantaneously, and a traffic burst occurs. For example, when a network intermediate device, such as a router, is busy or is congested, at this time, a message sending or receiving capability based on a sliding window exceeds a network transmission capability, a network has no time to process too many messages, that is, a sending rate of a message is not controlled, at this time, a message in the window is discarded by the network device, a network transmission quality is deteriorated, and finally a TCP throughput is reduced.
Disclosure of Invention
The embodiment of the invention provides a message sending method, a TCP (transmission control protocol) proxy and a TCP client, which are used for effectively avoiding the network from entering too many messages instantly and improving the TCP throughput.
In view of this, in a first aspect, an embodiment of the present invention provides a message sending method, including:
after the TCP agent sends M messages to the TCP client, N TCP response messages of the M messages fed back by the TCP client are received, after the TCP agent receives the N TCP response messages, sample TCP response messages can be determined from the TCP response messages, and then sample transmission bandwidth of TCP connection between the TCP agent and the TCP client is calculated according to each sample TCP response message.
The TCP agent determines an estimated bandwidth sample set according to the calculated sample transmission bandwidth, determines an estimated bandwidth according to the estimated bandwidth sample set, determines a target bandwidth according to the estimated bandwidth, determines the number of tokens to be used according to the target bandwidth, and finally controls the sending of the message according to the number of tokens to be used.
In the embodiment of the invention, whether the message is sent out is controlled by the TCP agent, which is characterized in that whether the message is sent out is determined by the token number which is determined by the target bandwidth, so that the phenomenon that the network enters too many messages instantly can be effectively avoided, and the TCP throughput is improved.
Preferably, in the embodiment of the present invention, the TCP proxy determines the number of tokens available according to the target bandwidth, and finally, there are several possible implementation manners for controlling the sending of the packet according to the number of tokens available, which are specifically as follows:
in one implementation, the TCP proxy determines the number of tokens available according to the target bandwidth, and finally, the controlling the sending of the packet according to the number of tokens available includes:
the TCP agent can set the token number increase rate according to the target bandwidth, then determine whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, send the message to the TCP client.
In this implementation manner, the TCP proxy specifically controls the sending of the packet by determining a token number increase rate according to the target bandwidth, and determining whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, the TCP proxy sends the packet to the TCP client.
That is, in the embodiments of the present invention, a specific implementation manner is provided for controlling the sending of the packet by the TCP proxy, so as to effectively avoid that the network enters too many packets instantaneously and improve the TCP throughput.
In a possible design, in the above-described message sending method, the method may further include:
the TCP proxy may set a transmission timer and start the transmission timer, and when the timing of the transmission timer reaches a preset duration, perform a step of determining whether the number of tokens obtained according to the token number increase rate reaches a preset value.
In the embodiment of the invention, when the TCP agent determines that the number of tokens obtained according to the token number increase rate does not reach the preset value, the message to be sent is buffered in a socket buffer at the TCP agent side and waits to be sent, and an instruction for triggering message sending needs to arrive, that is, the TCP agent needs to wait for an Acknowledgement message (ACK) fed back by a TCP client when the last message is successfully sent, and then the TCP agent executes the step of determining whether the number of tokens increased according to the token number increase rate reaches the preset value again, but because of network failure or other reasons communication, the ACK round-trip time (English name: round-trip, RTT for short) is often too long, and under the condition, even if the number of tokens reaches the preset value, the data in the buffer can not be sent for a long time, in order to avoid such a situation, in the embodiment of the present invention, the TCP proxy sets a sending timer, and as long as the sending timer reaches a preset duration, the step of determining whether the number of tokens obtained according to the token number increase rate reaches a preset value is performed, and when the number of tokens reaches the preset value, the TCP proxy sends a message to the TCP client. Therefore, the condition that the data in the socket buffer area cannot be sent out for a long time can be effectively avoided.
In one possible design, the message sending method may further include:
the TCP agent can set a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained by the TCP agent according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens obtained according to the token number growth rate and capable of being stored by the token resource queue.
In the embodiment of the invention, the token resource queue is used for storing tokens obtained by the TCP agent according to the token number increase rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and are obtained according to the token number increase rate. In practical application, on one hand, in a certain time period, if no message needs to be sent by a TCP proxy, more tokens are generated according to the token number increase rate, and the maximum depth of the token resource queue restricts that the token increase cannot exceed a certain threshold, on the other hand, the maximum depth of the token resource queue plays a role of buffering, that is, when no message needs to be sent by the TCP proxy in a certain time period, the token resource queue can store a certain number of tokens, and at this time, if a large number of messages need to be sent suddenly, the number of messages allowed to be sent can be increased to the maximum, and finally, the effect that the relative rate of sending the messages is relatively uniform is achieved.
In one possible design, the calculation, by the TCP proxy, of the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet specifically includes:
for each sample TCP response packet, the TCP proxy may calculate the sample transmission bandwidth of the TCP connection according to the sending time of the packet corresponding to the sample TCP response packet, the receiving time of the sample TCP response packet, and the length of the corresponding packet.
In one possible design, before the TCP proxy determines the target bandwidth according to the estimated bandwidth, the method may further include:
the TCP agent can determine the service type of TCP connection between TCP clients, and then acquires policy configuration information, wherein the policy configuration information comprises the corresponding relation between the adjustment proportion of the target bandwidth and the service type, the policy configuration information is set by a user through a product configuration interface provided by the TCP agent, then the adjustment proportion of the target bandwidth can be determined according to the service type and the policy configuration information, and then the target bandwidth is determined according to the estimated bandwidth and the policy configuration information;
at this time, the TCP proxy determines the target bandwidth according to the estimated bandwidth and the policy configuration information, specifically:
the TCP agent calculates the target bandwidth according to the following formula:
the target bandwidth is the adjusted ratio of the target bandwidth x the estimated bandwidth.
In the embodiment of the present invention, the TCP proxy may receive policy configuration information input by a user through a product configuration interface provided by the TCP proxy, where the policy configuration information may include a correspondence between an adjustment ratio of a target bandwidth and a service type, and further, the adjustment ratio of the target bandwidth may specifically be a floating upper limit value of the target bandwidth, a floating lower limit value of the target bandwidth, an adjustment percentage of the target bandwidth, or the like. That is, in the embodiment of the present invention, the target bandwidth is determined not only according to the estimated bandwidth determined by the TCP proxy, but also comprehensively considering the determination of the target bandwidth according to the requirement of the TCP connection service type between the TCP proxy and the TCP client. The TCP agent can enable the number increase rate of the tokens to be set more reasonably and accurately through the strategy configuration information input by the user and the target bandwidth determined by the estimated bandwidth, and can effectively prevent the network from entering too many messages instantly and improve the TCP throughput in practical application.
In another implementation, the controlling, by the TCP proxy, the sending of the packet includes:
the TCP agent can send the target bandwidth to the TCP client, so that the TCP client can set the token number increase rate according to the target bandwidth, determine whether the number of tokens obtained according to the token number increase rate reaches a preset value or not, and send the message if the number of tokens reaches the preset value.
In the implementation mode, the TCP agent sends the target bandwidth to the TCP client, so that the TCP client sets the token number increase rate according to the target bandwidth, determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and only sends the message if the number of tokens reaches the preset value. Namely, another specific implementation mode for controlling the sending of the message by the TCP agent is provided, which is used for effectively avoiding the network from entering too many messages instantly and improving the TCP throughput.
In a second aspect, an embodiment of the present invention provides a packet sending method, including:
the TCP client can receive a target bandwidth sent by the TCP agent, wherein the target bandwidth is determined by the TCP agent according to an estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP agent according to a sample transmission bandwidth, the sample transmission bandwidth is obtained by calculating a TCP connection between the TCP agent and the TCP client by the TCP agent according to each sample TCP response message, the sample TCP response message is at least one of N TCP response messages, the N TCP response messages are messages fed back to the TCP agent after the TCP client receives M messages sent by the TCP agent, then the TCP client sets a token number increase rate according to the target bandwidth, and finally, whether the number of tokens obtained according to the token number increase rate reaches a preset value is determined, and if the number of tokens reaches the preset value, the TCP client sends the messages.
In one possible design, the message sending method further includes:
the TCP client may set a sending timer and start the sending timer, and when the sending timer reaches a preset duration, the TCP client executes a step of determining whether the number of the current tokens reaches a preset value.
When the TCP client determines that the number of tokens obtained according to the token number increase rate does not reach the preset value, the message to be sent may be buffered in the socket buffer at the TCP client side and wait to be sent, and it needs to wait for the arrival of the instruction for triggering the sending of the message, that is, the TCP client needs to wait for the ACK fed back when the last message is successfully sent, and at this time, the TCP client will execute the step of determining whether the number of tokens increased according to the token number increase rate reaches the preset value again, but due to network failure or other reasons, communication often results in an ACK round trip time RTT that is too long, in this case, even if the number of tokens has reached the preset value, the data in the socket buffer at the TCP client side cannot be sent out for a long time, and at this time, in order to avoid this occurrence, in the embodiment of the present invention, the TCP client sets a sending timer, as long as the sending timer reaches the preset duration, the step of determining whether the number of tokens obtained according to the token number increase rate reaches the preset value is executed, and when the number of tokens reaches the preset value, the TCP client sends the message. Therefore, the situation that the data in the buffer area cannot be sent out for a long time can be effectively avoided.
In one possible design, the message sending method may further include:
the TCP client can set a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens obtained according to the token number growth rate and capable of being stored by the token resource queue.
In the embodiment of the invention, the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and are obtained according to the token number growth rate. In practical application, on one hand, in a certain time period, if no message needs to be sent by the TCP client, more tokens are generated according to the token number increase rate, and the maximum depth of the token resource queue restricts that the token increase cannot exceed a certain threshold, and on the other hand, the maximum depth of the token resource queue plays a role of buffering, that is, when no message needs to be sent by the TCP client in a certain time period, the token resource queue can store a certain number of tokens, and at this time, if a large number of messages need to be sent suddenly, the number of messages allowed to be sent can be increased to the maximum, and finally, the effect that the relative rate of sending the messages is relatively uniform is achieved.
In one possible design, the target bandwidth is obtained by the TCP proxy according to the estimated bandwidth and the policy configuration information, where the policy configuration information may specifically include a correspondence between an adjustment ratio of the target bandwidth and a service type, and the policy configuration information may be set through a product configuration interface provided by the TCP proxy. Further, the adjustment ratio of the target bandwidth may specifically be a floating upper limit value of the target bandwidth, a floating lower limit value of the target bandwidth, an adjustment percentage of the target bandwidth, or the like.
In other words, in the embodiment of the present invention, the target bandwidth is determined only according to the estimated bandwidth determined by the TCP proxy, and the determination of the target bandwidth is performed according to the TCP connection service type between the TCP proxy and the TCP client, so that the token number increase rate set by the TCP client is more reasonable and accurate, and in practical application, the network can be more effectively prevented from entering too many messages instantaneously, and the TCP throughput is improved.
In a third aspect, an embodiment of the present invention provides a TCP proxy, where the TCP proxy has a function of implementing a TCP proxy behavior in the above method design. The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above-described functions. The modules may be software and/or hardware.
In one possible design, the TCP proxy includes:
the sending module is used for sending M messages to the TCP client;
the receiving module is used for receiving N TCP response messages of the M messages sent by the TCP client;
the processing module is used for calculating the sample transmission bandwidth of the TCP connection between the TCP agent and the TCP client according to each sample TCP response message received by the receiving module, the sample TCP response message is at least one of the N TCP response messages, an estimated bandwidth sample set is determined according to the sample transmission bandwidth, the estimated bandwidth sample set comprises the sample transmission bandwidth calculated according to each sample TCP response message, the estimated bandwidth is determined according to the estimated bandwidth sample set, the target bandwidth is determined according to the estimated bandwidth, the number of available tokens is determined according to the target bandwidth, and the sending of the messages is controlled according to the number of the available tokens.
In one possible design, the structure of the TCP proxy includes a sender for sending M packets to a TCP client, a receiver for receiving M packets from the TCP client, for receiving N TCP response messages of the M messages sent by the TCP client, the processor, for calculating a sample transmission bandwidth of the TCP connection between the TCP agent and the TCP client from each sample TCP response message received by the receiver, the sample TCP response message being at least one of the N TCP response messages, determining an estimated bandwidth sample set according to the sample transmission bandwidth, wherein the estimated bandwidth sample set comprises the sample transmission bandwidth calculated according to each sample TCP response message, determining an estimated bandwidth according to the estimated bandwidth sample set, determining a target bandwidth according to the estimated bandwidth, determining the number of tokens available according to the target bandwidth, and controlling the sending of the message according to the number of tokens available.
In a fourth aspect, an embodiment of the present invention provides a TCP client, where the TCP client has a function of implementing a behavior of the TCP client in the above method design. The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above-described functions.
In one possible design, the TCP client includes:
the receiving module is used for receiving a target bandwidth sent by the TCP agent, the target bandwidth is determined by the TCP agent according to the estimated bandwidth, the estimated bandwidth is determined by the TCP agent according to the estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP agent according to the sample transmission bandwidth, the sample transmission bandwidth is obtained by calculating the TCP connection between the TCP agent and the TCP client by the TCP agent according to each sample TCP response message, the sample TCP response message is at least one of N TCP response messages, and the N TCP response messages are messages which are fed back to the TCP agent after the TCP client receives the M messages sent by the TCP agent;
the processing module is used for setting the token number increase rate according to the target bandwidth and determining whether the number of tokens obtained according to the token number increase rate reaches a preset value or not;
and the sending module is used for sending the message if the processing module determines that the number of the tokens obtained according to the token number increasing rate reaches a preset value.
In one possible design, the structure of the TCP client includes a receiver, a processor, and a transmitter, where the receiver is configured to receive a target bandwidth sent by the TCP proxy, the target bandwidth is determined by the TCP proxy according to an estimated bandwidth, the estimated bandwidth is determined by the TCP proxy according to an estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP proxy according to a sample transmission bandwidth, the sample transmission bandwidth is obtained by the TCP proxy calculating a TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet, the sample TCP response packet is at least one of N TCP response packets, the N TCP response packets are packets fed back to the TCP proxy after the TCP client receives M packets sent by the TCP proxy, the processor is configured to set a token number increase rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token number increase rate reaches a preset value, and the sender is used for sending the message if the processor determines that the number of the tokens obtained according to the token number increasing rate reaches a preset value.
In a fifth aspect, an embodiment of the present invention provides a computer storage medium, in which program codes are stored, and the program codes are used for instructing to execute the method of the first aspect or the second aspect.
Compared with the prior art, according to the technical scheme, in the embodiment of the invention, the TCP proxy sends M messages to the TCP client, receives N TCP response messages of the M messages sent by the TCP client, calculates the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message, the sample TCP response message is at least one of the N TCP response messages, determines an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set includes the sample transmission bandwidth calculated according to each sample TCP response message, determines the estimated bandwidth according to the estimated bandwidth sample set, determines the target bandwidth according to the estimated bandwidth, determines the number of tokens to be used according to the target bandwidth, and controls the sending of the messages according to the number of tokens to be used. Compared with the prior art, when the message is sent, the sending of the message is limited by the number of tokens, namely the sending rate of the message is controlled, the phenomenon that the network enters too many messages instantly is effectively avoided, and the TCP throughput is improved.
Drawings
FIG. 1 is a system architecture diagram according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an embodiment of a message sending method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a system architecture in an embodiment of a message sending method according to the present invention;
fig. 4 is a schematic diagram of another embodiment of a message sending method according to an embodiment of the present invention;
FIG. 5 is a diagram of an embodiment of a TCP proxy according to an embodiment of the present invention;
FIG. 6 is a diagram of another embodiment of a TCP proxy according to an embodiment of the present invention;
FIG. 7 is a diagram of another embodiment of a TCP proxy according to an embodiment of the present invention;
FIG. 8 is a diagram of an embodiment of a TCP client according to an embodiment of the present invention;
fig. 9 is a schematic diagram of another embodiment of a TCP client according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a message sending method, a TCP (transmission control protocol) proxy and a client, which are used for effectively avoiding the network from entering too many messages instantly and improving the TCP throughput.
Referring to fig. 1, in the embodiment of the present invention, a TCP client establishes a TCP connection with a TCP server through an SCG gateway.
The TCP client may be a device that provides voice and/or data connectivity to a user, such as a handheld device having wireless connection capability or other processing device connected to a wireless modem.
The TCP proxy may be deployed on the SCG gateway, or may also be an independent network element in the network, and the network element may be deployed between the TCP client and the SCG gateway, or may be deployed between the SCG gateway and the TCP server.
The messages sent to the TCP client by the TCP server are all sent to the TCP agent firstly and then sent to the TCP client by the TCP agent.
In order to avoid that the network enters too many messages instantaneously, before sending the messages to the TCP client, the TCP proxy needs to perform sending control according to the current bandwidth condition of the network, specifically, the number of tokens to be used may be determined according to the target bandwidth, and then the sending of the messages is controlled according to the number of tokens to be used.
In the embodiment of the present invention, there are various specific ways for the TCP proxy to perform transmission control, which are described below:
the TCP agent determines the number increase rate of tokens according to the target bandwidth and determines whether the number of tokens obtained according to the number increase rate of tokens reaches a preset value, if so, the TCP agent sends a message to the TCP client:
referring to fig. 2, an embodiment of a method for sending a packet according to an embodiment of the present invention includes:
201. the TCP agent sends M messages to the TCP client;
in the embodiment of the present invention, the TCP proxy may send M messages to the TCP client, wherein after the TCP proxy sends M messages to the TCP client, in the embodiment of the present invention, the TCP proxy may further receive N TCP response messages of the M messages sent by the TCP client.
In this embodiment, M is a positive integer greater than or equal to 1, N is also a positive integer greater than or equal to 1, and M is greater than or equal to N, and specific values are not limited herein.
It should be noted that the TCP proxy may also be a processing unit with a specific function disposed on the TCP server, or may also be a network device through which a message passes in a data interaction process between the TCP server and the TCP client, such as a Service Control Gateway (SCG), or may also be an independent network device in the network, which is not limited herein.
For convenience of understanding, in the embodiment of the present invention, a TCP proxy is deployed in an SCG gateway as an example, and an interaction flow between the SCG gateway and a TCP client is shown in fig. 3:
specifically, the TCP client is taken to surf the internet as an example for explanation; the TCP server receives a get message sent by the TCP client through the TCP agent, the TCP agent analyzes a protocol of the get message after receiving the get message, identifies a service type requested by the TCP client and forwards the message sent by the TCP server according to the service type to the TCP client, and the TCP client can send a TCP response message to the TCP agent after receiving the message.
202. The TCP agent calculates the sample transmission bandwidth of the TCP connection between the TCP agent and the TCP client according to each sample TCP response message;
in the embodiment of the present invention, the TCP proxy may calculate the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet, which is actually the sample transmission bandwidth of the TCP connection between the SCG gateway and the TCP client.
It should be noted that the sample TCP response packet may be one or more packets in N response packets, and is not limited herein.
Specifically, when the TCP proxy receives N response packets sent by the TCP client, for each sample TCP response packet, the TCP proxy may calculate a sample transmission bandwidth of the TCP connection according to a sending time of a packet corresponding to the sample TCP response packet, a receiving time of the sample TCP response packet, and a length of the packet corresponding to the sample TCP response packet.
203. The TCP agent determines an estimated bandwidth sample set according to the sample transmission bandwidth;
in the embodiment of the present invention, after the TCP proxy calculates the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet, an estimated bandwidth sample set may be determined according to the calculated sample transmission bandwidth, where the estimated bandwidth sample set includes the sample transmission bandwidth calculated by the TCP proxy according to each sample TCP response packet.
It should be noted that the estimated bandwidth sample set may also include a sample transmission bandwidth calculated by the TCP proxy according to at least one sample TCP response packet, which is not limited herein.
204. The TCP agent determines the estimated bandwidth according to the estimated bandwidth sample set;
in the embodiment of the present invention, the TCP proxy may determine the estimated bandwidth according to the obtained estimated bandwidth sample set, and specifically, the TCP proxy may perform simple calculation on the sample transmission bandwidth obtained by calculating the sample TCP response packet included in the estimated bandwidth sample set, for example, calculate an average bandwidth as the estimated bandwidth, it may be understood that the estimated bandwidth may also be obtained by other calculation methods, for example, performing weighted average calculation, and the specific details are not limited herein.
205. The TCP agent determines a target bandwidth according to the estimated bandwidth;
in an embodiment of the present invention, after determining the estimated bandwidth according to the estimated bandwidth sample set, the TCP proxy may determine the target bandwidth according to the estimated bandwidth. It should be noted that, before determining the target bandwidth according to the estimated bandwidth, the TCP proxy may further obtain policy configuration information, where the policy configuration information includes a correspondence between an adjustment ratio of the target bandwidth and a service type, and the policy configuration information is set by a user through a product configuration interface provided by the TCP proxy, and determines the adjustment ratio of the target bandwidth according to the service type identified by the TCP proxy.
In this embodiment, the specific way for the TCP proxy to determine the target bandwidth according to the estimated bandwidth may be:
the TCP agent determines a target bandwidth according to the estimated bandwidth and the strategy configuration information;
at this time, the determining, by the TCP proxy, the target bandwidth according to the estimated bandwidth and the policy configuration information specifically includes:
the TCP agent calculates the target bandwidth according to the following formula:
the target bandwidth is the adjusted ratio of the target bandwidth x the estimated bandwidth.
It should be noted that the adjustment ratio of the target bandwidth may specifically be a floating upper limit value of the target bandwidth, a floating lower limit value of the target bandwidth, or an adjustment percentage of the target bandwidth, where the policy configuration information may be input through a configuration interface provided by the TCP proxy. For example, according to an actual service type requirement, the configuration may be performed through a product configuration interface provided by the TCP proxy, where the configuration interface has a floating upper limit option of a target bandwidth or a floating lower limit option of the target bandwidth or an adjustment percentage option of the target bandwidth, and a user inputs a corresponding floating upper limit value of the target bandwidth, a floating lower limit value of the target bandwidth, and an adjustment percentage of the target bandwidth, where taking an example that a target bandwidth adjustment ratio is a target floating upper limit value, the TCP proxy determines the target bandwidth according to the estimated bandwidth and the policy configuration information specifically may be:
the target bandwidth is the floating upper limit value of the target bandwidth x the estimated bandwidth.
It should be noted that the calculation method of the target bandwidth described by the above formula is only one calculation method, and besides, there may be other methods for calculating the target bandwidth according to the target bandwidth adjustment ratio and the estimated bandwidth, and the method is not limited herein.
206. The TCP agent sets token number increase rate according to the target bandwidth;
in the embodiment of the invention, after the TCP agent determines the target bandwidth, the token number increase rate can be set according to the target bandwidth.
207. The TCP agent sets a token resource queue and the maximum depth of the token resource queue;
in the embodiment of the invention, the TCP agent can set a token resource queue for storing tokens obtained by the TCP agent according to the token number growth rate, and can also set the maximum depth of the token resource queue for indicating the maximum number of tokens obtained according to the token number growth rate which can be stored by the token resource queue.
In the embodiment of the invention, in a certain time period, if no message needs to be sent by a TCP agent, more tokens can be generated according to the increase rate of the token number, and the maximum depth of the token resource queue restricts that the increase of the token cannot exceed a certain threshold value.
It should be noted that there is no chronological sequence relationship between step 207 and steps 201 to 206, and the details are not limited herein.
208. The TCP proxy sets a sending timer and starts the sending timer, and when the sending timer reaches a preset duration, step 209 is executed;
in this embodiment of the present invention, the TCP proxy may set a sending timer, start the timer, and execute step 209 when the sending timer reaches a preset duration.
In the embodiment of the invention, when the TCP proxy determines that the number of tokens obtained according to the token number increase rate does not reach the preset value, the message to be sent is buffered in the socket buffer at the TCP proxy side and waits to be sent, at this time, the arrival of the instruction for triggering the message sending needs to be waited, that is, when the TCP proxy needs to wait for the message sent last time to be successfully sent, the TCP proxy will perform the step of determining whether the number of tokens obtained according to the token number increase rate reaches the preset value again, however, due to network failure or other communication reasons, the RTT of ACK is often too long, in this case, even if the number of tokens reaches the preset value, the data in the socket buffer cannot be sent out for a long time, and at this time, in order to avoid the occurrence of this situation, in the embodiment of the invention, the TCP proxy sets a sending timer, as long as the sending timer reaches the preset time length, the step of determining whether the number of tokens obtained according to the token number increase rate reaches the preset value is executed, so that the condition that the data in the socket buffer cannot be sent out for a long time can be effectively avoided.
It is understood that step 208 can be performed after step 206, and is not limited thereto.
209. The TCP agent determines whether the number of tokens obtained according to the increase rate of the number of tokens currently reaches a preset value, if so, the step 210 is executed;
in the embodiment of the invention, a TCP agent stores a message which needs to be forwarded to a TCP client in a TCP agent socket buffer zone to be sent, at the moment, the TCP agent judges whether the number of tokens in a token resource queue reaches a preset value, and if the number of tokens in the token resource queue reaches the preset value, the step 210 is executed. It is to be understood that the specific values of the preset values are not specifically limited herein.
210. The TCP proxy sends a message to the TCP client.
In the embodiment of the invention, when the TCP agent determines that the number of tokens in the token resource queue reaches the preset value, the TCP agent sends a message to the TCP client.
For ease of understanding, the following description will be given by taking a preset value of 3 tokens as an example:
the TCP proxy stores 8 messages that need to be forwarded to the TCP client in a TCP proxy socket buffer to be sent, and at this time, if the TCP proxy detects that the number of tokens in the token resource queue is 5, the TCP proxy takes out 3 messages from the socket buffer and sends the 3 messages to the TCP client, it should be noted that the TCP proxy can also take out 4 messages from the buffer, or send messages with other numbers to the TCP client, which is not limited herein. It should be noted that, after the sent message is successfully sent to the TCP client, according to a Transmission Control Protocol/Internet Protocol (TCP/IP), the TCP client sends an ACK to the TCP proxy, and after the TCP proxy receives the ACK, the step of determining whether the number of tokens in the token resource queue reaches a preset value is executed again, and if the preset value is reached and there is a message not sent out in the socket buffer, the message in the socket buffer is continuously sent, which is not described herein again.
If the TCP agent detects that the number of tokens in the token resource queue is less than 3, the 8 messages are continuously stored in the socket buffer area to wait for being sent.
In addition, it should be noted that, whenever the TCP proxy stores the message to be forwarded to the TCP client into the socket buffer of the TCP proxy side, it is determined whether the number of tokens in the token resource queue reaches a preset value.
In the embodiment of the invention, a TCP agent sends M messages to a TCP client, receives N TCP response messages of the M messages sent by the TCP client, calculates the sample transmission bandwidth of TCP connection between the TCP agent and the TCP client according to each sample TCP response message, the sample TCP response message is at least one of the N TCP response messages, determines an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set comprises the sample transmission bandwidth calculated according to each sample TCP response message, determines the estimated bandwidth according to the estimated bandwidth sample set, determines a target bandwidth according to the estimated bandwidth, sets a token number increase rate according to the target bandwidth, determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends the messages to the TCP client. Compared with the prior art, when the message is sent, the sending of the message is limited by the number of tokens, namely the sending rate of the message is controlled, the phenomenon that the network enters too many messages instantly is effectively avoided, and the TCP throughput is improved.
Secondly, the TCP agent sends the target bandwidth to the TCP client so that the TCP client sets a token number increase rate according to the target bandwidth, determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends the message:
referring to fig. 4, another embodiment of a message sending method according to an embodiment of the present invention includes:
steps 401 to 405 are the same as steps 201 to 205 in the above embodiment, and are not described herein again.
406. The TCP agent sends the target bandwidth to the TCP client;
in the embodiment of the present invention, after the TCP proxy determines the target bandwidth according to the estimated bandwidth, the target bandwidth may be sent to the TCP client, and the TCP client may receive the target bandwidth.
407. The TCP client sets token number increase rate according to the target bandwidth;
in the embodiment of the invention, the TCP client can set a token resource queue for storing tokens obtained according to the token number growth rate, and can also set the maximum depth of the token resource queue for indicating the maximum number of tokens obtained according to the token number growth rate which can be stored by the token resource queue.
In the embodiment of the invention, in a certain time period, if no message needs to be sent by a TCP client, more tokens can be generated according to the increase rate of the token number, and the maximum depth of the token resource queue restricts that the token increase cannot exceed a certain threshold value.
It should be noted that there is no chronological sequence relationship between step 408 and steps 401 to 407, and the details are not limited herein.
409. The TCP client sets a sending timer and starts the sending timer, and when the sending timer reaches a preset duration, step 410 is executed;
in this embodiment of the present invention, the TCP client may set a sending timer, start the timer, and execute step 410 when the sending timer reaches a preset duration.
In the embodiment of the present invention, when the TCP client determines that the number of tokens obtained according to the token number increase rate does not reach the preset value, the message to be sent is buffered in the socket buffer at the TCP client side and waits to be sent, at this time, it is required to wait for the arrival of the instruction for triggering the sending of the message, that is, the TCP client waits for the ACK fed back when the message sent last time is successfully sent, and at this time, the TCP client will execute the step of determining whether the number of tokens obtained according to the token number increase rate reaches the preset value again, however, due to network failure or other communication reasons, the ACK is often too long, in this case, even if the number of tokens reaches the preset value, the data in the socket buffer cannot be sent out for a long time, and at this time, in order to avoid this situation, in the embodiment of the present invention, the TCP client sets a sending timer, as long as the sending timer reaches the preset time length, the step of determining whether the number of tokens increasing according to the token number increasing rate reaches the preset value or not is executed, so that the condition that the data in the socket buffer cannot be sent out for a long time can be effectively avoided.
It is understood that step 409 can be executed after step 407, and is not limited herein.
410. The TCP client determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, executes step 411;
the TCP client stores the message to be sent in a socket buffer of the TCP client side through the socket, and waits to be sent, at this time, the TCP client executes a step of determining whether the number of tokens in the token resource queue reaches a preset value, and if the number of tokens in the token resource queue reaches the preset value, executes step 411. It is to be understood that the specific values of the preset values are not limited herein.
411. The TCP client sends the message.
In the embodiment of the invention, when the TCP client determines that the number of tokens which are increased according to the increase rate of the number of tokens at present reaches the preset value, the TCP client sends the message.
For ease of understanding, the following description will be given by taking a preset value of 3 tokens as an example:
the TCP client stores 8 messages to be forwarded to the TCP client in a socket buffer at the TCP client side to be sent by the TCP client, at this time, if the TCP client detects that the number of tokens in the token resource queue is 5, the TCP client takes out 3 messages from the socket buffer and sends the 3 messages to the TCP proxy, it should be noted that the TCP client may also take out 4 messages from the buffer or send messages with other numbers to the TCP proxy, and the specific here is not limited. It should be noted that, after the sent message is successfully sent, according to the TCP/IP protocol, the TCP proxy may feed back an ACK to the TCP client, and after the TCP client receives the ACK, the step of determining whether the number of tokens in the token resource queue reaches the preset value is executed again, and if the number of tokens reaches the preset value and there is a message that is not sent in the socket buffer, the message in the socket buffer is continuously sent, which is not described herein again.
If the TCP client detects that the number of tokens in the token resource queue is less than 3, the 8 messages are continuously stored in the socket buffer area to wait for being sent.
It should be noted that, each time the TCP client stores a packet to be sent to the TCP proxy into the socket buffer on the TCP client side through the socket, the TCP client performs a step of determining whether the number of tokens in the token resource queue reaches a preset value.
The method comprises the steps of sending M messages to a TCP client through a TCP agent, receiving N TCP response messages of the M messages sent by the TCP client, calculating sample transmission bandwidth of TCP connection between the TCP agent and the TCP client according to each sample TCP response message, determining an estimated bandwidth sample set according to the sample transmission bandwidth, wherein the sample TCP response message is at least one of the N TCP response messages, the estimated bandwidth sample set comprises sample transmission bandwidth calculated according to each sample TCP response message, determining estimated bandwidth according to the estimated bandwidth sample set, sending target bandwidth to the TCP client, enabling the TCP client to set token number growth rate according to the target bandwidth, determining whether the number of tokens obtained according to the token number growth rate reaches a preset value or not, and if the number of tokens reaches the preset value, sending the messages. Compared with the prior art, when the message is sent, the sending of the message is limited by the number of tokens, namely the sending rate of the message is controlled, the phenomenon that the network enters too many messages instantly is effectively avoided, and the TCP throughput is improved.
The above describes a message sending method in the embodiment of the present invention, and a TCP proxy in the embodiment of the present invention is described below.
Referring to fig. 5, an embodiment of the TCP proxy of the present invention includes: a sending module 501, a receiving module 502 and a processing module 503.
A sending module 501, configured to send M messages to a TCP client;
a receiving module 502, configured to receive N TCP response packets of the M packets sent by the TCP client;
a processing module 503, configured to calculate a sample transmission bandwidth of a TCP connection between a TCP proxy and a TCP client according to each sample TCP response packet received by the receiving module 502, where the sample TCP response packet is at least one of N TCP response packets, determine an estimated bandwidth sample set according to the sample transmission bandwidth, where the estimated bandwidth sample set includes the sample transmission bandwidth calculated according to each sample TCP response packet, determine an estimated bandwidth according to the estimated bandwidth sample set, determine a target bandwidth according to the estimated bandwidth, set a token number increase rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token number increase rate reaches a preset value;
the sending module 501 is further configured to send a message to the TCP client if the processing module 503 determines that the number of tokens obtained according to the token number increase rate reaches a preset value;
in conjunction with the above embodiments, the processing module 503 is further configured to:
setting a sending timer and starting the sending timer;
when the timing of the sending timer reaches the preset duration, determining whether the number of tokens obtained according to the token number increase rate reaches a preset value;
setting a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and obtained according to the token number growth rate;
for each sample TCP response message, calculating the sample transmission bandwidth of the TCP connection according to the sending time of the message corresponding to the sample TCP response message, the receiving time of the sample TCP response message and the length of the message corresponding to the sample TCP response message;
acquiring strategy configuration information, wherein the strategy configuration information comprises a corresponding relation between the adjustment proportion of the target bandwidth and the service type;
and determining the target bandwidth according to the estimated bandwidth, the service type corresponding to the TCP connection and the strategy configuration information.
Referring to fig. 6, a TCP proxy in an embodiment of the present invention is described from the perspective of a modular functional entity, and a TCP proxy in an embodiment of the present invention is described from the perspective of hardware processing, in which the TCP proxy 600 may generate a relatively large difference due to different configurations or performances, for example, the TCP proxy may include one or more physical device processors (e.g., one or more processors) corresponding to the processing module 503 in the embodiment, a physical device transmitter 602 corresponding to the sending module 501 in the embodiment, a physical device receiver 603 corresponding to the receiving module 502, and a memory 604, one or more data 608, or a storage medium 605 (e.g., one or more mass storage devices) storing program codes 609. Memory 604 and storage media 605 may be, among other things, transient or persistent storage. The program stored on the storage medium 605 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a TCP proxy. Still further, central processor 601 may be configured to communicate with storage medium 605 to execute a series of instruction operations in storage medium 605 on TCP proxy 600.
TCP proxy 600 may also include one or more power supplies 606, one or more operating systems 607.
The steps executed by the TCP proxy in this embodiment may be based on the TCP proxy structure diagram shown in fig. 6, and specifically refer to the corresponding processes in the foregoing embodiments, which are not described herein again.
Referring to fig. 7, another embodiment of the TCP proxy according to the embodiment of the present invention includes: the sending module 701 receives a module 702 and a processing module 703.
A sending module 701, configured to send M messages to a TCP client;
a receiving module 702, configured to receive N TCP response packets of the M packets sent by the TCP client;
a processing module 703, configured to calculate a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet received by the receiving module 702, where the sample TCP response packet is at least one of the N TCP response packets, determine an estimated bandwidth sample set according to the sample transmission bandwidth, where the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response packet, determine an estimated bandwidth according to the estimated bandwidth sample set, and determine a target bandwidth according to the estimated bandwidth;
the sending module 701 is further configured to send the target bandwidth to the TCP client, so that the TCP client sets a token number increase rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends the message.
Similarly, the corresponding entity device in this embodiment may refer to the schematic structure diagram shown in fig. 6, and the corresponding steps may refer to the above embodiment, which is not described herein again.
With reference to fig. 8, the TCP client in the embodiment of the present invention is described below, and an embodiment of the TCP client in the embodiment of the present invention includes: a receiving module 801, a processing module 802 and a sending module 803.
A receiving module 801, configured to receive a target bandwidth sent by a TCP proxy, where the target bandwidth is determined by the TCP proxy according to an estimated bandwidth, the estimated bandwidth is determined by the TCP proxy according to an estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP proxy according to a sample transmission bandwidth, the sample transmission bandwidth is obtained by the TCP proxy calculating a TCP connection between the TCP proxy and a TCP client according to each sample TCP response packet, the sample TCP response packet is at least one of N TCP response packets, and the N TCP response packets are packets that are fed back to the TCP proxy after the TCP client receives M packets sent by the TCP proxy;
the processing module 802 is configured to set a token number increase rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token number increase rate reaches a preset value;
the sending module 803 is configured to send the message if the processing module 802 determines that the number of tokens obtained according to the token number increase rate reaches a preset value.
In conjunction with the above embodiments, the processing module 802 is further configured to:
setting a sending timer and starting the sending timer;
when the timing of the sending timer reaches the preset duration, determining whether the number of tokens obtained according to the token number increase rate reaches a preset value;
setting a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and obtained according to the token number growth rate.
The TCP client in the embodiment of the present invention is described from the perspective of the modular functional entity, and the TCP client in the embodiment of the present invention is described from the perspective of hardware processing, as shown in fig. 9, for convenience of description, only the part related to the embodiment of the present invention is shown, and details of the specific technology are not disclosed, please refer to the method part corresponding to the embodiment of the present invention, and refer to fig. 9, which is a schematic structural diagram of the TCP client provided in the embodiment of the present invention:
the TCP client includes: the physical devices corresponding to the receiving module 801 and the sending module 803 in the above embodiments are a receiver 901 and a processor 902 of the physical device corresponding to the transmitter 903 and the processing module 802, and the TCP client further includes a memory 904 for storing program codes, and when the program codes are executed by the processor 902, the methods in the above embodiments of the present invention can be implemented. Those skilled in the art will appreciate that the TCP client architecture shown in fig. 9 does not constitute a definition of a TCP client, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The steps executed by the TCP client in this embodiment may be based on the TCP client structure diagram shown in fig. 9, and specifically refer to the corresponding processes in the foregoing embodiments, which are not described herein again.
It should be noted that, the processor related to the above device embodiments may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of the CPU and the NP. The processor may further include a hardware chip, which may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. In addition, the PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof, and is not limited in the present invention.
In the several embodiments provided in this application, it should be understood that the disclosed system, module and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules may be stored in a computer readable storage medium when implemented as software functional units and sold or used as stand-alone products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (20)

1. A method for sending a message, the method being performed by a TCP proxy, the method comprising:
sending M messages to a TCP client;
receiving N TCP response messages of the M messages sent by the TCP client, wherein M is a positive integer greater than or equal to 1, N is a positive integer greater than or equal to 1, and M is greater than or equal to N;
calculating a sample transmission bandwidth of a TCP connection between the TCP agent and the TCP client according to each sample TCP response message, wherein the sample TCP response message is at least one of the N TCP response messages;
determining an estimated bandwidth sample set according to the sample transmission bandwidth, wherein the estimated bandwidth sample set comprises sample transmission bandwidth calculated according to each sample TCP response message;
determining an estimated bandwidth from the set of estimated bandwidth samples;
determining a target bandwidth according to the estimated bandwidth;
determining the number of tokens available according to the target bandwidth, and controlling the sending of the message according to the number of tokens available.
2. The message sending method according to claim 1, wherein the determining the number of token tokens available according to the target bandwidth, and the controlling sending of the message according to the number of token tokens available comprises:
setting a token number increase rate according to the target bandwidth;
and determining whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sending the message to the TCP client.
3. The message sending method according to claim 1, wherein the determining the number of token tokens available according to the target bandwidth, and the controlling sending of the message according to the number of token tokens available comprises:
and sending the target bandwidth to the TCP client so that the TCP client sets a token number increase rate according to the target bandwidth, determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends the message.
4. The message sending method according to claim 2, characterized in that the method further comprises:
setting a sending timer and starting the sending timer;
and when the timing of the sending timer reaches the preset duration, executing the step of determining whether the number of tokens obtained according to the token number increase rate reaches a preset value.
5. The message sending method according to claim 4, characterized in that the method further comprises:
setting a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and are obtained according to the token number growth rate.
6. The method of messaging according to claim 5, wherein the calculating a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client from each sample TCP response packet comprises:
and for each sample TCP response message, calculating the sample transmission bandwidth of the TCP connection according to the sending time of the message corresponding to the sample TCP response message, the receiving time of the sample TCP response message and the length of the message corresponding to the sample TCP response message.
7. The method of messaging according to claim 6, wherein before the TCP proxy determining the target bandwidth based on the estimated bandwidth, further comprising:
acquiring policy configuration information, wherein the policy configuration information comprises a corresponding relation between the adjustment proportion of the target bandwidth and the service type;
the determining a target bandwidth from the estimated bandwidth comprises:
and determining the target bandwidth according to the estimated bandwidth, the service type corresponding to the TCP connection and the strategy configuration information.
8. A method for sending a message, comprising:
a TCP client receives a target bandwidth sent by a TCP agent, wherein the target bandwidth is determined by the TCP agent according to an estimated bandwidth, the estimated bandwidth is determined by the TCP agent according to an estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP agent according to a sample transmission bandwidth, the sample transmission bandwidth is obtained by calculating a TCP connection between the TCP agent and the TCP client by the TCP agent according to each sample TCP response message, the sample TCP response message is at least one of N TCP response messages, and the N TCP response messages are messages fed back to the TCP agent after the TCP client receives M messages sent by the TCP agent;
the TCP client sets token number increase rate according to the target bandwidth;
and the TCP client determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends a message.
9. The message sending method according to claim 8, characterized in that the method further comprises:
the TCP client sets a sending timer and starts the sending timer;
and when the timing of the sending timer reaches the preset duration, executing the step of determining whether the number of tokens obtained according to the token number increase rate reaches a preset value.
10. The message sending method according to any of claims 8 or 9, characterized in that the method further comprises:
the TCP client sets a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing the token, and the maximum depth is used for indicating the maximum number of the tokens which can be stored by the token resource queue.
11. A TCP proxy, comprising:
the sending module is used for sending M messages to the TCP client;
a receiving module, configured to receive N TCP response packets of the M packets sent by the TCP client, where M is a positive integer greater than or equal to 1, N is also a positive integer greater than or equal to 1, and M is greater than or equal to N;
the processing module is configured to calculate a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet received by the receiving module, where the sample TCP response packet is at least one of the N TCP response packets, determine an estimated bandwidth sample set according to the sample transmission bandwidth, where the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response packet, determine an estimated bandwidth according to the estimated bandwidth sample set, determine a target bandwidth according to the estimated bandwidth, determine an available token number according to the target bandwidth, and control transmission of a packet according to the available token number.
12. The TCP proxy of claim 11, wherein the processing module is configured to:
setting a token number increase rate according to the target bandwidth;
determining whether the number of tokens obtained according to the token number growth rate reaches a preset value;
and the sending module is used for sending the message to the TCP client if the processing module determines that the number of tokens obtained according to the token number increase rate reaches a preset value.
13. The TCP proxy of claim 11, wherein the sending module is configured to:
and sending the target bandwidth to the TCP client so that the TCP client sets a token number increase rate according to the target bandwidth, determines whether the number of tokens obtained according to the token number increase rate reaches a preset value, and if so, sends the message.
14. The TCP proxy of claim 12, wherein the processing module is configured to:
setting a sending timer and starting the sending timer;
and when the timing of the sending timer reaches the preset duration, determining whether the number of tokens obtained according to the token number increase rate reaches a preset value.
15. The TCP proxy of claim 14, wherein the processing module is configured to:
setting a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and are obtained according to the token number growth rate.
16. The TCP proxy of claim 15, wherein the processing module is configured to:
and for each sample TCP response message, calculating the sample transmission bandwidth of the TCP connection according to the sending time of the message corresponding to the sample TCP response message, the receiving time of the sample TCP response message and the length of the message corresponding to the sample TCP response message.
17. The TCP proxy of claim 16, wherein the processing module is configured to:
acquiring policy configuration information, wherein the policy configuration information comprises a corresponding relation between the adjustment proportion of the target bandwidth and the service type;
and determining the target bandwidth according to the estimated bandwidth, the service type corresponding to the TCP connection and the strategy configuration information.
18. A TCP client, comprising:
a receiving module, configured to receive a target bandwidth sent by a TCP proxy, where the target bandwidth is determined by the TCP proxy according to an estimated bandwidth, the estimated bandwidth is determined by the TCP proxy according to an estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP proxy according to a sample transmission bandwidth, the sample transmission bandwidth is obtained by the TCP proxy calculating a TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet, the sample TCP response packet is at least one of N TCP response packets, the N TCP response packets are packets that are fed back to the TCP proxy after the TCP client receives M packets sent by the TCP proxy, M is a positive integer greater than or equal to 1, N is also a positive integer greater than or equal to 1, and M is greater than or equal to N;
the processing module is used for setting a token number increase rate according to the target bandwidth and determining whether the number of tokens obtained according to the token number increase rate reaches a preset value or not;
and the sending module is used for sending the message if the processing module determines that the number of tokens obtained according to the token number increasing rate reaches a preset value.
19. The TCP client of claim 18, wherein the processing module is configured to:
setting a sending timer and starting the sending timer;
and when the timing of the sending timer reaches the preset duration, determining whether the number of tokens obtained according to the token number increase rate reaches a preset value.
20. The TCP client according to claim 18 or 19, wherein the processing module is configured to:
setting a token resource queue and the maximum depth of the token resource queue, wherein the token resource queue is used for storing tokens obtained according to the token number growth rate, and the maximum depth is used for indicating the maximum number of tokens which can be stored by the token resource queue and are obtained according to the token number growth rate.
CN201511024912.3A 2015-12-30 2015-12-30 Message sending method, TCP (Transmission control protocol) proxy and TCP client Active CN106936730B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201511024912.3A CN106936730B (en) 2015-12-30 2015-12-30 Message sending method, TCP (Transmission control protocol) proxy and TCP client
PCT/CN2016/111079 WO2017114231A1 (en) 2015-12-30 2016-12-20 Packet sending method, tcp proxy, and tcp client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511024912.3A CN106936730B (en) 2015-12-30 2015-12-30 Message sending method, TCP (Transmission control protocol) proxy and TCP client

Publications (2)

Publication Number Publication Date
CN106936730A CN106936730A (en) 2017-07-07
CN106936730B true CN106936730B (en) 2020-04-03

Family

ID=59225630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511024912.3A Active CN106936730B (en) 2015-12-30 2015-12-30 Message sending method, TCP (Transmission control protocol) proxy and TCP client

Country Status (2)

Country Link
CN (1) CN106936730B (en)
WO (1) WO2017114231A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109245981B (en) * 2018-10-25 2021-06-22 浙江中控技术股份有限公司 Scheduling method and system for field bus communication
CN110855575B (en) * 2019-09-30 2022-05-06 荣耀终端有限公司 TCP message scheduling method and device and communication equipment
CN113938258A (en) * 2020-06-29 2022-01-14 中兴通讯股份有限公司 Data transmission method, device and computer storage medium
CN112685358B (en) * 2020-12-24 2023-07-28 电信科学技术第五研究所有限公司 DDR3 grouping read-write method based on FPGA
CN112910658B (en) * 2021-02-02 2022-07-12 刘玉 Data packet transmission method and device for providing TCP proxy service
CN114173428B (en) * 2021-10-21 2022-08-05 北京连山科技股份有限公司 Method for improving data transmission speed of multilink equipment
CN114157727B (en) * 2021-12-10 2024-05-14 北京华环电子股份有限公司 Application method and device of TCP acceleration in OSU

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1518285A (en) * 2003-01-16 2004-08-04 华为技术有限公司 Network bandwidth detecting method for implementing stream medium service
CN101300795A (en) * 2005-11-07 2008-11-05 英特尔公司 Efficient scheduling of dowlink packet data traffic in wireless data networks
CN101873634A (en) * 2010-06-18 2010-10-27 杭州华三通信技术有限公司 Method and device for scheduling bandwidth on WLAN basis

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075918B (en) * 2006-05-15 2010-05-12 中兴通讯股份有限公司 Method for inspecting network band width
US9350673B2 (en) * 2013-03-14 2016-05-24 Vivint, Inc. Dynamic adjustment of quality of service parameters

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1518285A (en) * 2003-01-16 2004-08-04 华为技术有限公司 Network bandwidth detecting method for implementing stream medium service
CN101300795A (en) * 2005-11-07 2008-11-05 英特尔公司 Efficient scheduling of dowlink packet data traffic in wireless data networks
CN101873634A (en) * 2010-06-18 2010-10-27 杭州华三通信技术有限公司 Method and device for scheduling bandwidth on WLAN basis

Also Published As

Publication number Publication date
CN106936730A (en) 2017-07-07
WO2017114231A1 (en) 2017-07-06

Similar Documents

Publication Publication Date Title
CN106936730B (en) Message sending method, TCP (Transmission control protocol) proxy and TCP client
US10367922B2 (en) Method and apparatus for sending transmission control protocol TCP data packet and system
EP3714579B1 (en) Layer 3 fair rate congestion control notification
US9641650B2 (en) TCP proxy server
EP2772028B1 (en) Control system, gateway and method for selectively delaying network data flows
KR102016446B1 (en) Tcp congestion control for large latency networks
EP3525406A1 (en) Method and apparatus for determining tcp congestion window
EP3961981A1 (en) Method and device for congestion control, communication network, and computer storage medium
CN107852371B (en) Data packet network
WO2014201068A1 (en) Rate control
EP3232638A1 (en) Data transmission method, apparatus and system
US10868839B2 (en) Method and system for upload optimization
EP2664178B1 (en) Adaptive relative bit-rate manager for TCP depending flow control
US20140325064A1 (en) Controlling Establishment of Multiple TCP Connections
CN107852372B (en) Data packet network
US9882820B2 (en) Communication apparatus
CN112887218B (en) Message forwarding method and device
EP3314970B1 (en) Method and apparatus for managing uplink traffic from a client device in a communication network
JPWO2020012973A1 (en) Communication controllers, methods, and programs
Tekala et al. Throughput analysis of Scalable TCP congestion control
Shaii et al. Congestion avoidance: Network based schemes solution

Legal Events

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