[go: up one dir, main page]

WO2017114231A1 - Packet sending method, tcp proxy, and tcp client - Google Patents

Packet sending method, tcp proxy, and tcp client Download PDF

Info

Publication number
WO2017114231A1
WO2017114231A1 PCT/CN2016/111079 CN2016111079W WO2017114231A1 WO 2017114231 A1 WO2017114231 A1 WO 2017114231A1 CN 2016111079 W CN2016111079 W CN 2016111079W WO 2017114231 A1 WO2017114231 A1 WO 2017114231A1
Authority
WO
WIPO (PCT)
Prior art keywords
tcp
bandwidth
token
sample
tokens
Prior art date
Application number
PCT/CN2016/111079
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 WO2017114231A1 publication Critical patent/WO2017114231A1/en

Links

Images

Classifications

    • 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/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
    • 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

Definitions

  • the present invention relates to the field of communications, and in particular, to a packet sending method, a TCP proxy, and a TCP client.
  • Network congestion refers to the excessive number of packets arriving at a certain part of the communication network, which makes the part of the network unable to process the packets, which may cause the performance of the network or the entire network to degrade. In severe cases, the network may even be caused.
  • the communications business has come to a standstill, a phenomenon known as congestion. Congestion is a state of continuous overloaded network where users' demand for network resources (including link bandwidth, storage space, and processor processing power) exceeds the inherent capacity.
  • an application based on a Transmission Control Protocol controls the number of packets entering the network through a TCP sliding window mechanism.
  • the TCP congestion control adjusts the transmission window to adapt to the network quality according to the additive-increase multiplicative-decrease (English abbreviation: AIMD) algorithm.
  • the participant of the TCP sliding window mechanism Since the participants of the TCP sliding window mechanism are only the transmitting end and the receiving end of a single TCP connection, it only considers the receiving capability of the receiving end, and does not take into account the transmission capability of the network, and it is prone to occur that the network instantaneously enters too many messages and appears. Traffic bursts. For example, when a network intermediate device, such as a router, is busy or congested, the packet sending or receiving capability based on the sliding window exceeds the network transmission capability, and the network cannot process too many packets, that is, there is no packet. The transmission rate is controlled. At this time, the packets in the window are discarded by the network device, and the network transmission quality is deteriorated, eventually causing the TCP throughput to drop.
  • a network intermediate device such as a router
  • the embodiment of the invention provides a packet sending method, a TCP proxy and a TCP client, which are used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
  • the first aspect of the present invention provides a packet sending method, including:
  • the TCP proxy After the TCP proxy sends M packets to the TCP client, it receives N TCP response packets of M messages fed back by the TCP client. After receiving the N TCP response packets, the TCP proxy can receive the TCP response packets.
  • the sample TCP response message is determined in the paper, and the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client is calculated according to each sample TCP response message.
  • the TCP proxy determines the estimated bandwidth sample set according to the calculated sample transmission bandwidth, determines the estimated bandwidth according to the estimated bandwidth sample set, determines the target bandwidth according to the estimated bandwidth, determines the available token token number according to the target bandwidth, and finally controls the packet according to the available token number. send.
  • whether the packet is sent out is controlled by the TCP proxy, and the specific expression is: whether the packet is sent by the number of tokens, and the token number is determined by the target bandwidth, so Effectively avoid the network from entering too many messages in an instant and improve TCP throughput.
  • the TCP proxy determines the number of available token tokens according to the target bandwidth, and finally controls the sending of the packet according to the number of available tokens.
  • the following are possible implementation manners, as follows:
  • the TCP proxy determines the number of available token tokens according to the target bandwidth, and finally controls the sending of the packet according to the number of available tokens, including:
  • the TCP proxy can set the token growth rate according to the target bandwidth, and then determine whether the number of tokens obtained according to the token growth rate reaches a preset value. If yes, the packet is sent to the TCP client.
  • the TCP proxy controls the sending of the packet by determining the number of tokens to increase according to the target bandwidth, and determining whether the number of tokens obtained according to the token growth rate reaches a preset value.
  • the TCP proxy sends the message to the TCP client.
  • a specific implementation manner for the TCP proxy to control the sending of the packet is provided, which is used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
  • the message sending method described above may further include:
  • the TCP proxy can set a sending timer and start the sending timer.
  • the sending timer reaches the preset duration, it performs the step of determining whether the number of tokens obtained according to the token number increasing rate reaches a preset value.
  • the TCP proxy determines the token obtained according to the growth rate of the number of tokens
  • the message that needs to be sent is cached in the TCP proxy side socket buffer waiting to be sent. It needs to wait for the instruction to trigger the sending of the message, that is, the TCP proxy needs to wait.
  • the TCP client sends an acknowledgement message (English name: Acknowledgement, English abbreviation: ACK). At this time, the TCP proxy will perform the determination again to determine whether the number of tokens that grow according to the number of tokens reaches the preset.
  • the TCP proxy sets a sending timer as long as the sending timer reaches the preset.
  • a step of determining whether the number of tokens obtained according to the growth rate of the token reaches a preset value is performed, and when When the number of tokens reaches the preset value, the TCP proxy sends a message to the TCP client. That is, it can effectively avoid the situation that the data in the socket socket buffer cannot be sent out for a long time.
  • the message sending method may further include:
  • the TCP proxy can set the maximum depth of the token resource queue and the token resource queue.
  • the token resource queue is used to store the token obtained by the TCP proxy according to the number of tokens.
  • the maximum depth is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained.
  • the token resource queue is used to store the token obtained by the TCP proxy according to the number of tokens
  • the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate.
  • the maximum depth of the token resource queue plays a buffering role. That is, when the TCP proxy does not need to send packets in a period of time, the token resource queue can A certain number of tokens are saved. In this case, if a large number of packets need to be sent, the number of packets allowed to be sent can be maximized, and the relative rate of sending packets is relatively uniform.
  • the TCP proxy calculates the TCP generation based on each sample TCP response message.
  • the sample transmission bandwidth of the TCP connection between the TCP client and the TCP client is specifically:
  • the TCP proxy can calculate the sample transmission bandwidth of the TCP connection according to the sending time of the packet corresponding to the sample TCP response message, the receiving time of the sample TCP response message, and the length of the corresponding packet. .
  • the TCP proxy may also include before determining the target bandwidth based on the estimated bandwidth:
  • the TCP proxy can determine the service type of the TCP connection between the TCP clients, and then obtain the policy configuration information, where the policy configuration information includes the correspondence between the adjustment ratio of the target bandwidth and the service type, and the policy configuration information is provided by the user through the TCP proxy.
  • the product configuration interface is set, and then the adjustment ratio 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;
  • the TCP proxy determines the target bandwidth based on the estimated bandwidth and policy configuration information:
  • the TCP proxy calculates the target bandwidth according to the following formula:
  • Target bandwidth adjustment ratio of target bandwidth ⁇ estimated bandwidth.
  • the TCP proxy can receive the policy configuration information input by the user through the TCP proxy.
  • the policy configuration information can include the correspondence between the adjustment ratio of the target bandwidth and the service type. Further, the bandwidth of the target bandwidth The adjustment ratio may specifically be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth. 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 the target bandwidth is determined according to the requirement of the TCP connection service type between the TCP proxy and the TCP client. In an actual application, the corresponding policy configuration information may be manually selected according to the actual service type requirement, such as a video service or a picture service.
  • the TCP proxy can make the set number of tokens grow more reasonable and more accurate through the policy configuration information input by the user and the target bandwidth determined by the bandwidth estimation. In practical applications, the network can prevent the network from entering too many packets in an instant. Improve TCP throughput.
  • the TCP proxy controls the sending of the packet, including:
  • the TCP proxy can send the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token number growth rate reaches a preset value, and if so, sends a report. Text.
  • the TCP proxy sends the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token number growth rate reaches a preset value.
  • the TCP client sends the message. That is, another specific implementation manner is provided for the TCP proxy to control the sending of the packet, which is used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
  • an embodiment of the present invention provides a packet sending method, including:
  • the TCP client can receive the target bandwidth sent by the TCP proxy, wherein the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth.
  • the sample transmission bandwidth is obtained by the TCP proxy calculating the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message, and the sample TCP response packet is at least one of N TCP response messages, and N TCP response reports.
  • the TCP client receives the M packets sent by the TCP proxy and feeds back the packets to the TCP proxy. Then the TCP client sets the token growth rate according to the target bandwidth, and finally determines whether the number of tokens obtained according to the token growth rate is The preset value is reached. If it is reached, the TCP client sends the message.
  • the message sending method further includes:
  • the TCP client can set a sending timer and start the sending timer. When the sending timer reaches the preset duration, the TCP client determines whether the current number of tokens reaches the preset value.
  • the packet to be sent is buffered in the TCP client socket socket buffer waiting to be sent, and needs to wait for the trigger to be sent.
  • the arrival of the message instruction, that is, the TCP client needs to wait for the ACK that is sent back when the last message has been sent successfully.
  • the TCP client will perform the determination again to determine whether the number of tokens that grow according to the number of tokens reaches the pre-up.
  • the step of setting the value however, due to network failure or other reasons, the communication often causes the ACK round trip time RTT to be too long.
  • the TCP client sets a sending timer, as long as the sending timer reaches the preset duration, the data in the area may not be sent out for a long time. Will perform a token that is determined by the rate of increase in the number of tokens. The step of whether the number reaches the preset value, and when the number of tokens reaches the preset value, the TCP client sends a message. That is to say, it can effectively avoid the situation that the data in the buffer cannot be sent out for a long time.
  • the message sending method may further include:
  • the TCP client can set the maximum depth of the token resource queue and the token resource queue.
  • the token resource queue is used to store the token obtained according to the growth rate of the token.
  • the maximum depth is used to indicate that the token resource queue can be stored according to the token growth rate. The maximum number of tokens.
  • the token resource queue is used to store the token obtained according to the growth rate of the number of tokens
  • the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the growth rate of the number of tokens.
  • the maximum depth of the token resource queue plays a buffering role, that is, when the TCP client does not need to send a message during a period of time, the token resource The queue can store a certain number of tokens. In this case, if a large number of packets need to be sent, the maximum number of packets allowed to be sent can be increased, and the relative rate of sending packets is relatively uniform.
  • 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 the adjustment ratio of the target bandwidth and the service type, and the policy configuration information may be provided by using a TCP proxy.
  • the product configuration interface is set.
  • the adjustment ratio of the target bandwidth may specifically be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth.
  • the target bandwidth is determined not only according to the estimated bandwidth determined by the TCP proxy, but also the target bandwidth is determined according to the requirement of the TCP connection service type between the TCP proxy and the TCP client.
  • the rate of the number of tokens set by the TCP client can be made more reasonable and more accurate. In practical applications, the network can be prevented from entering too many packets in an instant and the TCP throughput can be improved.
  • an embodiment of the present invention provides a TCP proxy, where the TCP proxy has an implementation.
  • the functions may be implemented by hardware or by corresponding software implemented by hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the modules can be software and/or hardware.
  • the TCP proxy includes:
  • a sending module configured to send M packets to the TCP client
  • a receiving module configured to receive N TCP response messages of M messages sent by the TCP client;
  • a processing module configured to calculate, according to each sample TCP response message received by the receiving module, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is at least one of N TCP response packets And determining an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, determining an estimated bandwidth according to the estimated bandwidth sample set, and determining a target bandwidth according to the estimated bandwidth, according to the target bandwidth. Determine the number of available tokens and control the transmission of packets based on the number of available tokens.
  • the structure of the TCP proxy includes a transmitter, a receiver, and a processor, and the transmitter is configured to send M messages to the TCP client, and the receiver is configured to receive the TCP client.
  • the sample TCP response message is at least one of N TCP response messages
  • the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes the sample transmission bandwidth calculated according to each sample TCP response message, according to the estimation.
  • the bandwidth sample set determines the estimated bandwidth, determines the target bandwidth according to the estimated bandwidth, determines the number of available token tokens according to the target bandwidth, and controls the sending of the packet according to the number of available tokens.
  • an embodiment of the present invention provides a TCP client, which has a function of implementing TCP client behavior in the foregoing method design.
  • the functions may be implemented by hardware or by corresponding software implemented by hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the TCP client includes:
  • a receiving module configured to receive a target bandwidth sent by the TCP proxy, where the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth, and the sample transmission is performed.
  • Bandwidth is based on TCP proxy per
  • the sample TCP response message is obtained by calculating the TCP connection between the TCP proxy and the TCP client, and the sample TCP response packet is at least one of N TCP response messages, and the N TCP response messages are TCP clients receiving the TCP. M packets sent by the proxy and then fed back to the TCP proxy packet;
  • a processing module configured to set a token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token growth rate reaches a preset value
  • a sending module configured to send a message if the processing module determines that the number of tokens obtained according to the number of tokens increases to a preset value.
  • the structure of the TCP client includes a receiver, a processor, and a transmitter, and the receiver is configured to receive a target bandwidth sent by the TCP proxy, and the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the bandwidth is estimated.
  • the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth
  • the sample transmission bandwidth is calculated by the TCP proxy according to each sample TCP response message to calculate the TCP connection between the TCP proxy and the TCP client.
  • the sample TCP response message is at least one of the N TCP response messages, and the N TCP response messages are packets that the TCP client feeds back to the TCP proxy after receiving the M messages sent by the TCP proxy, and the processing is performed. And determining, according to the target bandwidth setting token growth rate, whether the number of tokens obtained according to the token number increasing rate reaches a preset value, and the transmitter is configured to: if the processor determines the token obtained according to the token number increasing rate When the number reaches the preset value, the message is sent.
  • an embodiment of the present invention provides a computer storage medium, where the program storage code is stored in the computer storage medium, and the program code is used to indicate that the method of the first aspect or the second aspect is performed.
  • the TCP proxy sends M packets to the TCP client, and receives N TCP response packets of the M packets sent by the TCP client.
  • the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client is calculated according to each sample TCP response message, and the sample TCP response packet is at least one of N TCP response packets, and the estimated bandwidth is determined according to the sample transmission bandwidth.
  • the sample set, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, an estimated bandwidth is determined according to the estimated bandwidth sample set, a target bandwidth is determined according to the estimated bandwidth, and finally, the available token token number is determined according to the target bandwidth,
  • the sending of the message is controlled according to the number of available tokens.
  • the packet transmission is limited by the token number, that is, the packet transmission rate is controlled, which effectively prevents the network from entering too many packets in an instant and improves the TCP throughput.
  • FIG. 1 is a schematic structural diagram of a system according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of an embodiment of a method for sending a message according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a system in an embodiment of a packet sending method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of another embodiment of a packet sending method according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of an embodiment of a TCP proxy according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of another embodiment of a TCP proxy according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of another embodiment of a TCP proxy according to an embodiment of the present invention.
  • FIG. 8 is a schematic 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.
  • the embodiment of the invention provides a packet sending method, a TCP proxy and a client, which are used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
  • 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 the user, such as a handheld device with wireless connectivity, or other processing device connected to the wireless modem.
  • the TCP proxy can be deployed on the SCG gateway or can be an independent network element in the network.
  • the network element can be deployed between the TCP client and the SCG gateway, or between the SCG gateway and the TCP server.
  • the packets sent by the TCP server to the TCP client are sent to the TCP proxy first, and then sent to the TCP client by the TCP proxy.
  • the TCP proxy In order to prevent the network from entering too many packets in an instant, the TCP proxy needs to send and control according to the current bandwidth of the network before sending the packet to the TCP client, which may be based on the target.
  • the bandwidth determines the number of token tokens available, and then controls the transmission of the message based on the number of available tokens.
  • the TCP proxy performs transmission control in a plurality of manners, which are respectively described below:
  • the TCP proxy determines the growth rate of the number of tokens according to the target bandwidth and determines whether the number of tokens obtained according to the growth rate of the token reaches a preset value. If yes, the packet is sent to the TCP client:
  • an embodiment of a packet sending method includes:
  • the TCP proxy sends M packets to the TCP client.
  • the TCP proxy can send M packets to the TCP client, wherein after the TCP proxy sends M packets to the TCP client, in the embodiment of the present invention, the TCP proxy can also receive the TCP client to send. N TCP response messages of the above M messages.
  • M is a positive integer greater than or equal to 1
  • N is also a positive integer greater than or equal to 1
  • M is greater than or equal to N, and specific values are not limited herein.
  • the TCP proxy may also be a processing unit deployed on a TCP server with a specific function, or may be a network device that is deployed in a data exchange process between the TCP server and the TCP client.
  • the gateway of the service control gateway (English name: service control gateway, English abbreviation: SCG)
  • it may also be an independent network device in the network, which is not limited herein.
  • the TCP proxy is deployed in the SCG gateway as an example, and the interaction process between the SCG gateway and the TCP client is as shown in FIG. 3:
  • the TCP client is used as an example to describe the TCP client.
  • the TCP server receives the get packet sent by the TCP client through the TCP proxy. After receiving the get packet, the TCP proxy performs protocol parsing on the get packet to identify the TCP client. The requested service type, and forwards the packet sent by the TCP server according to the service type to the TCP client. After receiving the packet, the TCP client may send a TCP response packet to the TCP proxy.
  • the TCP proxy calculates a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet.
  • the TCP proxy can calculate the TCP generation according to each sample TCP response message.
  • the sample transmission bandwidth of the TCP connection between the TCP client and the TCP client is actually the sample transmission bandwidth of the TCP connection between the SCG gateway and the TCP client.
  • sample TCP response packet may be one or more of the N response packets, which is not limited herein.
  • the TCP proxy may send, according to the sending time of the packet corresponding to the sample TCP response packet, the TCP response message.
  • the sample transmission bandwidth of the TCP connection is calculated by the reception time of the sample TCP response message and the length of the message corresponding to the sample TCP response message.
  • the TCP proxy determines an estimated bandwidth sample set according to the sample transmission bandwidth.
  • the estimated bandwidth sample set may be determined according to the calculated sample transmission bandwidth, where The estimated bandwidth sample set includes a sample transmission bandwidth calculated by the TCP proxy according to each sample TCP response message.
  • the estimated bandwidth sample set may also include a sample transmission bandwidth calculated by the TCP proxy according to the at least one sample TCP response packet, which is not limited herein.
  • the TCP proxy determines an estimated bandwidth according to the estimated bandwidth sample set.
  • the TCP proxy may determine the estimated bandwidth according to the obtained estimated bandwidth sample set. Specifically, the TCP proxy may perform simple calculation on the sample transmission bandwidth calculated by the sample TCP response packet included in the estimated bandwidth sample set, for example, The average bandwidth is calculated as the estimated bandwidth. It can be understood that the estimated bandwidth can be obtained by other calculation methods, such as weighted average calculation, which is not limited herein.
  • the TCP proxy determines the target bandwidth according to the estimated bandwidth.
  • 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 also obtain policy configuration information, where the policy configuration information includes a correspondence between the adjustment ratio of the target bandwidth and the service type, and the policy configuration information is provided by the user through the TCP proxy. The configuration interface is set, and the adjustment ratio of the target bandwidth is determined according to the type of service identified by the TCP proxy.
  • the specific manner in which the TCP proxy determines the target bandwidth according to the estimated bandwidth may be:
  • the TCP proxy determines the target bandwidth based on the estimated bandwidth and policy configuration information
  • the TCP proxy determines the target bandwidth according to the estimated bandwidth and the policy configuration information, and specifically includes:
  • the TCP proxy calculates the target bandwidth according to the following formula:
  • Target bandwidth adjustment ratio of target bandwidth ⁇ estimated bandwidth.
  • the adjustment ratio of the target bandwidth may be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth
  • the policy configuration information may be provided through a configuration interface provided by the TCP proxy. Input. For example, according to the actual service type requirement, it can be set through the product configuration interface provided by the TCP proxy.
  • the configuration interface has a floating upper limit option of the target bandwidth or a floating lower limit option of the target bandwidth or a target percentage adjustment option for the user input.
  • the target bandwidth adjustment ratio is taken as the target floating upper limit value, and the TCP proxy determines according to the estimated bandwidth and the policy configuration information.
  • the target bandwidth can be:
  • Target bandwidth floating upper limit of the target bandwidth ⁇ estimated bandwidth.
  • the calculation method of the target bandwidth described by the above formula is only one of the calculation methods.
  • the target bandwidth adjustment ratio and the estimated bandwidth there may be other methods for calculating the target bandwidth, which is not limited herein. .
  • the TCP proxy sets a growth rate of the number of tokens according to the target bandwidth.
  • the token number growth rate may be set according to the target bandwidth.
  • the TCP proxy sets the maximum depth of the token resource queue and the token resource queue.
  • the TCP proxy may set a token resource queue, which is used to store a token obtained by the TCP proxy according to the number of tokens, and a maximum depth of the token resource queue, which is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained by the growth rate.
  • the token resource queue can store a certain number of tokens. In this case, if a large number of packets need to be sent suddenly, The biggest increase is allowed to be sent The number of packets eventually reaches the uniform rate of sending packets.
  • step 207 there is no sequence relationship between step 207 and step 201 to step 206, which is not limited herein.
  • the TCP proxy sets the sending timer and starts the sending timer, when the sending timer reaches the preset duration, step 209 is performed;
  • the TCP proxy may set a sending timer and start the timer.
  • step 209 is performed.
  • the packets to be sent are buffered in the socket buffer of the TCP proxy side and are waiting to be sent. Waiting for the instruction to trigger the sending of the message, that is, the TCP proxy needs to wait for the ACK of the TCP client to feed back when the last sent message has been sent successfully. At this time, the TCP proxy will perform the determination again according to the number of tokens. The step of obtaining the number of tokens reaches the preset value. However, due to network failure or other communication reasons, the RTT of the ACK is often too long.
  • the socket buffer In the embodiment of the present invention the TCP proxy sets a sending timer, as long as the sending timer reaches the preset duration, when the data in the area is not sent out for a long time.
  • the step of determining whether the number of tokens obtained according to the growth rate of the token reaches a preset value is performed, that is, it can be effectively Avoid the situation data socket buffer for a long time can not be sent out.
  • step 208 can be executed after step 206, which is not limited herein.
  • the TCP proxy determines whether the number of tokens currently obtained according to the number of token growth rate reaches a preset value, if yes, step 210 is performed;
  • the TCP proxy stores the packet that needs to be forwarded to the TCP client to the TCP proxy socket buffer for waiting to be sent. At this time, the TCP proxy determines whether the number of tokens in the token resource queue reaches the preset value. If it is determined that it is reached, then step 210 is performed. In addition, it can be understood that the specific value of the preset value is not limited herein.
  • the TCP proxy sends a packet to the TCP client.
  • the TCP proxy when the TCP proxy determines that the number of tokens in the token resource queue reaches a preset value, the TCP proxy sends a packet to the TCP client.
  • the TCP proxy stores 8 packets that need to be forwarded to the TCP client to the TCP proxy socket buffer for waiting to be sent. At this time, if the TCP proxy detects that the number of tokens in the token resource queue is five, the TCP proxy is from the socket. Three packets are fetched from the buffer, and the three packets are sent to the TCP client. It should be noted that the TCP proxy can also take out four packets from the buffer, or send other packets to the TCP client. , specifically here is not limited.
  • TCP/IP Transmission Control Protocol/Internet Protocol
  • TCP proxy receives the ACK, it re-executes the step of determining whether the number of tokens in the token resource queue reaches a preset value. If the preset is reached, and the socket buffer is still If the packet is not sent, the packet in the socket buffer is sent. The details are not mentioned here.
  • the TCP proxy detects that the number of tokens in the token resource queue is less than three, the above eight packets continue to be stored in the socket buffer and are waiting to be sent.
  • the TCP proxy needs to forward the packet forwarded to the TCP client to the TCP proxy side socket buffer, it will determine whether the number of tokens in the token resource queue reaches the preset value.
  • the TCP proxy sends M packets to the TCP client, receives N TCP response packets of M messages sent by the TCP client, and calculates TCP proxy and TCP client according to each sample TCP response packet.
  • the sample transmission bandwidth of the TCP connection between the terminals, the sample TCP response message is at least one of N TCP response messages, and the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes a TCP response report according to each sample.
  • Calculate the sample transmission bandwidth determine the estimated bandwidth according to the estimated bandwidth sample set, determine the target bandwidth according to the estimated bandwidth, set the token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token number growth rate reaches a preset value.
  • the packet transmission is limited to the number of tokens, that is, the packet transmission rate is controlled, thereby effectively preventing the network from entering too many packets in an instant and improving the TCP throughput. .
  • the TCP proxy sends the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines that the token growth rate is obtained according to the token number. Whether the number of obtained tokens reaches a preset value, and if so, the message is sent:
  • another embodiment of a packet 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 foregoing embodiment, and details are not described herein again.
  • the TCP proxy sends the target bandwidth to the TCP client.
  • the target bandwidth may be sent to the TCP client, and the TCP client may receive the target bandwidth.
  • the TCP client sets a growth rate of the number of tokens according to the target bandwidth.
  • the TCP client may set a token resource queue, which is used to store the token obtained according to the growth rate of the token number, and may also set the maximum depth of the token resource queue, which is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained by the rate.
  • the token resource queue can store a certain number of tokens. In this case, if a large number of packets need to be sent suddenly, the maximum can be The increase allows the number of packets to be sent, and finally achieves a relatively uniform rate of sending packets.
  • step 408 there is no sequence relationship between the step 408 and the step 401 to the step 407, which is not limited herein.
  • the TCP client sets the sending timer and starts the sending timer, when the sending timer reaches the preset duration, step 410 is performed;
  • the TCP client may set a sending timer and start the timer.
  • step 410 is performed.
  • the packets to be sent are buffered in the socket buffer of the TCP client side and are waiting to be sent. At this time, it is necessary to wait for the arrival of the instruction for triggering the transmission of the message, that is, the TCP client waits for the ACK that is sent back when the last transmitted message has been sent successfully, and the TCP client will perform the determination again according to the number of tokens. Whether the number of tokens obtained reaches the pre- The step of setting the value, however, due to network failure or other communication reasons, the RTT of the ACK is often too long.
  • the TCP client sets a sending timer. As long as the sending timer reaches the preset duration, the current number of tokens is determined. The step of increasing the number of tokens for increasing the rate reaches a preset value, that is, the situation in which the data in the socket buffer cannot be sent for a long time can be effectively avoided.
  • step 409 can be executed after step 407, which is not limited herein.
  • the TCP client determines whether the number of tokens obtained according to the number of token growth rate reaches a preset value, if yes, step 411;
  • the TCP client stores the packet to be sent to the TCP client side socket buffer through the socket socket, and waits for the TCP client to determine whether the number of tokens in the token resource queue reaches the preset value. If it is determined that it is reached, step 411 is performed. It can be understood that the specific value of the preset value is not limited herein.
  • the TCP client sends a packet.
  • the TCP client when the TCP client determines that the number of tokens currently increasing according to the number of tokens reaches a preset value, the TCP client sends a packet.
  • the TCP client stores the eight packets that need to be forwarded to the TCP client to the TCP client side socket buffer for transmission by the TCP client. In this case, if the TCP client detects the number of tokens in the token resource queue is 5 The TCP client extracts three packets from the socket buffer and sends the three packets to the TCP proxy. It should be noted that the TCP client can also take out four packets from the buffer, or other The number of packets is sent to the TCP proxy, which is not limited here.
  • the TCP proxy feeds back an ACK to the TCP client, and when the TCP client receives the ACK, it re-executes the determination of the token resource queue. If the number of the tokens reaches the preset value, if the preset value is reached, and the packet in the socket buffer is not sent, the packet in the socket buffer is sent, which is not described here.
  • the TCP client detects that the number of tokens in the token resource queue is less than three, the above 8 The message continues to be stored in the socket buffer waiting to be sent.
  • the TCP client determines the token in the token resource queue. The step of whether the number reaches the preset value.
  • the sample transmission bandwidth of the connection, the sample TCP response message is at least one of N TCP response messages, and the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes the sample calculated according to each sample TCP response message.
  • the transmission bandwidth is determined according to the estimated bandwidth sample set, and the target bandwidth is sent to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token growth rate reaches the pre-predetermined rate.
  • a packet sending method in the embodiment of the present invention has been described above.
  • the following describes the TCP proxy in the embodiment of the present invention.
  • an embodiment of the TCP proxy of the present invention includes: a sending module 501, a receiving module 502, and a processing module 503.
  • the sending module 501 is configured to send M messages to the TCP client.
  • the receiving module 502 is configured to receive N TCP response messages of M messages sent by the TCP client.
  • the processing module 503 is configured to calculate, according to each sample TCP response message received by the receiving module 502, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is in the N TCP response packets. At least one, determining an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, determining an estimated bandwidth according to the estimated bandwidth sample set, and determining a target bandwidth according to the estimated bandwidth, according to The target bandwidth sets the rate of increase of the number of tokens, and determines whether the number of tokens obtained according to the growth rate of the number of tokens reaches a preset value;
  • the sending module 501 is further configured to: if the processing module 503 determines that the rate is increased according to the number of tokens If the number of tokens reaches a preset value, the packet is sent to the TCP client;
  • processing module 503 is further configured to:
  • the token resource queue is used to store the token obtained according to the growth rate of the token.
  • the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate.
  • the sample transmission of the TCP connection is calculated according to the transmission time of the packet corresponding to the sample TCP response message, the reception time of the sample TCP response message, and the length of the packet corresponding to the sample TCP response message. bandwidth;
  • Obtaining policy configuration information where the policy configuration information includes a correspondence between a target bandwidth adjustment ratio and a service type;
  • the target bandwidth is determined according to the estimated bandwidth, the service type corresponding to the TCP connection, and the policy configuration information.
  • the TCP proxy in the embodiment of the present invention is described above from the perspective of a modular functional entity.
  • the following describes the TCP proxy in the embodiment of the present invention from the perspective of hardware processing.
  • FIG. 6 a TCP provided by the embodiment of the present invention is provided.
  • Schematic diagram of the proxy structure, the TCP proxy 600 may be relatively different due to different configurations or performances, such as may include one or more physical device processors (eg, one or more processors) corresponding to the processing module 503 of the above embodiment.
  • the memory 604 and the storage medium 605 may be short-term storage or persistent storage.
  • the program stored on storage medium 605 can include one or more modules (not shown), each of which can include a series of instruction operations in a TCP proxy.
  • central processor 601 can be configured to communicate with storage medium 605 to perform a series of instruction operations in storage medium 605 on TCP proxy 600.
  • TCP proxy 600 may also include one or more power sources 606, one or more operating systems 607.
  • the steps performed by the TCP proxy in this embodiment may be based on the schematic diagram of the TCP proxy structure shown in FIG. 6. For details, refer to the corresponding process in the foregoing embodiment, and details are not described herein again.
  • another embodiment of a TCP proxy includes: a sending module 701 receiving a module 702 and a processing module 703.
  • the sending module 701 is configured to send M messages to the TCP client.
  • the receiving module 702 is configured to receive N TCP response packets of the M packets sent by the TCP client.
  • the processing module 703 is configured to calculate, according to each sample TCP response message received by the receiving module 702, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is Determining, by the at least one of the N TCP response messages, 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 of the sample TCP response messages, according to The estimated bandwidth sample set determines an estimated bandwidth, and the target bandwidth is determined 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 the token growth 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, Then send a message.
  • the corresponding physical device in this embodiment can refer to the structural diagram shown in FIG. 6.
  • the corresponding steps refer to the foregoing embodiment, and details are not described herein again.
  • an embodiment of the TCP client in the embodiment of the present invention includes: a receiving module 801, and a processing module. 802 and a transmitting module 803.
  • the receiving module 801 is configured to receive a target bandwidth sent by the TCP proxy, where the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth, and the sample is determined.
  • the transmission bandwidth is obtained by the TCP proxy to calculate the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message.
  • the sample TCP response packet is at least one of N TCP response packets, and N TCP response packets. The message that the TCP client receives back to the TCP proxy after receiving the M packets sent by the TCP proxy;
  • the processing module 802 is configured to set a token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token growth rate reaches a preset value;
  • the sending module 803 is configured to send a message if the processing module 802 determines that the number of tokens obtained according to the number of tokens increases to a preset value.
  • processing module 802 is further configured to:
  • the token resource queue is used to store the token obtained according to the growth rate of the token.
  • the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate.
  • the TCP client in the embodiment of the present invention is described above from the perspective of a modular functional entity.
  • 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 For a part related to the embodiment of the present invention, the specific technical details are not disclosed. Please refer to the method part corresponding to the embodiment of the present invention.
  • FIG. 9 a schematic diagram of a TCP client structure is provided in the embodiment of the present invention:
  • the TCP client includes: a physical device corresponding to the receiving module 801 and the sending module 803 of the foregoing embodiment, and a physical device processor 902 corresponding to the receiver 901 and the processing module 802.
  • the TCP client further includes a memory 904.
  • For storing program code when the program code is executed by the processor 902, the methods of the above-described embodiments of the present invention can be implemented. It will be understood by those skilled in the art that the TCP client structure shown in FIG. 9 does not constitute a limitation to the TCP client, and may include more or less components than those illustrated, or combine some components, or different component arrangements. .
  • the steps performed by the TCP client in this embodiment may be based on the structure of the TCP client shown in FIG. 9.
  • the steps performed by the TCP client in this embodiment may be based on the structure of the TCP client shown in FIG. 9.
  • the steps performed by the TCP client in this embodiment may be based on the structure of the TCP client shown in FIG. 9.
  • the processor involved in the foregoing device embodiment may be a central processing unit (English name: central processing unit, English abbreviation: CPU), a network processor (English full name: network processor, English abbreviation: NP) or A combination of CPU and NP.
  • the processor may further include a hardware chip, which may be an application-specific integrated circuit (English name: ASIC), a programmable logic device (English full name: programmable logic device, English abbreviation: PLD) or combination.
  • PLD can be complex programmable logic Device (English full name: complex programmable logic device, English abbreviation: CPLD), field programmable logic gate array (English full name: field-programmable gate array, English abbreviation: FPGA), general array logic (English full name: generic array logic, English The abbreviation: GAL) or any combination thereof is not limited in the present invention.
  • the disclosed systems, modules, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules when implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (English full name: Read-Only Memory, English abbreviation: ROM), a random access memory (English full name: Random Access Memory English: RAM), a disk Or a variety of media such as optical discs that can store program code.

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

Disclosed in embodiments of the present invention are a packet sending method, a TCP proxy, and a TCP client, for use in effectively avoiding entrance of an excessively-great quantity of packets into a network in a instantaneous time, and in improving the TCP throughput. The method in an embodiment of the present invention comprises: sending M packets to a TCP client; receiving N TCP response packets of the M packets, sent by the TCP client; calculating a sample transmission bandwidth of a TCP connection between a TCP proxy and the TCP client according to each sample TCP response packet, the sample TCP response packet being at least one of the N TCP response packets; determining an estimated-bandwidth sample set according to the according to the sample transmission bandwidth, the estimated-bandwidth sample set comprising the sample transmission bandwidth calculated according to each sample TCP response packet; determining an estimated bandwidth according to the estimated-bandwidth sample set; determining a target bandwidth according to the estimated bandwidth; and determining the quantity of available tokens according to the target bandwidth, and controlling the sending of a packet according to the quantity of the available tokens.

Description

一种报文发送方法、TCP代理以及TCP客户端Message sending method, TCP proxy and TCP client 技术领域Technical field
本发明涉及通信领域,尤其涉及一种报文发送方法、TCP代理以及TCP客户端。The present invention relates to the field of communications, and in particular, to a packet sending method, a TCP proxy, and a TCP client.
背景技术Background technique
网络拥塞是指到达通信网络中某一部分的报文(packet)数量过多,使得该部分网络来不及处理所述报文,以致引起这部分网络乃至整个网络性能下降的现象,严重时甚至会使网络通信业务陷入停顿,这种现象被称为拥塞。拥塞是一种持续过载的网络状态,此时用户对网络资源(包括链路带宽、存储空间和处理器处理能力等)的需求超过了固有的容量。Network congestion refers to the excessive number of packets arriving at a certain part of the communication network, which makes the part of the network unable to process the packets, which may cause the performance of the network or the entire network to degrade. In severe cases, the network may even be caused. The communications business has come to a standstill, a phenomenon known as congestion. Congestion is a state of continuous overloaded network where users' demand for network resources (including link bandwidth, storage space, and processor processing power) exceeds the inherent capacity.
现有技术中,主要是由基于传输控制协议(英文全称:Transmission Control Protocol,英文简称:TCP)的应用通过TCP滑动窗口机制来控制进入网络中的报文的数量。当网络出现拥塞后,TCP拥塞控制按照加性增/乘性减(英文全称:additive-increase multiplicative-decrease,英文简称:AIMD)算法不断调整发送窗口来适应网络质量。In the prior art, an application based on a Transmission Control Protocol (English name: TCP) controls the number of packets entering the network through a TCP sliding window mechanism. When the network is congested, the TCP congestion control adjusts the transmission window to adapt to the network quality according to the additive-increase multiplicative-decrease (English abbreviation: AIMD) algorithm.
由于TCP滑动窗口机制的参与者仅仅是单个TCP连接的发送端和接收端,它只考虑了接收端的接收能力,而没有考虑到网络的传输能力,容易出现网络瞬间进入过多的报文,出现流量突发。如当网络中间设备,例如路由器等,比较繁忙或者是发生拥塞时,此时基于滑动窗口的报文发送或者接收能力超过了网络传输能力,网络来不及处理过多的报文,即没有对报文的发送速率进行控制,此时,窗口内的报文就会被网络设备丢弃,网络传输质量变差,最终造成TCP吞吐量下降。Since the participants of the TCP sliding window mechanism are only the transmitting end and the receiving end of a single TCP connection, it only considers the receiving capability of the receiving end, and does not take into account the transmission capability of the network, and it is prone to occur that the network instantaneously enters too many messages and appears. Traffic bursts. For example, when a network intermediate device, such as a router, is busy or congested, the packet sending or receiving capability based on the sliding window exceeds the network transmission capability, and the network cannot process too many packets, that is, there is no packet. The transmission rate is controlled. At this time, the packets in the window are discarded by the network device, and the network transmission quality is deteriorated, eventually causing the TCP throughput to drop.
发明内容Summary of the invention
本发明实施例提供了一种报文发送方法、TCP代理以及TCP客户端,用于有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。The embodiment of the invention provides a packet sending method, a TCP proxy and a TCP client, which are used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
有鉴于此,第一方面,本发明实施例提供一种报文发送方法,包括: In view of the above, the first aspect of the present invention provides a packet sending method, including:
TCP代理向TCP客户端发送M个报文后,接收TCP客户端反馈的M个报文的N个TCP响应报文,TCP代理在接收到N个TCP响应报文之后,可以从这些TCP响应报文中确定样本TCP响应报文,再根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽。After the TCP proxy sends M packets to the TCP client, it receives N TCP response packets of M messages fed back by the TCP client. After receiving the N TCP response packets, the TCP proxy can receive the TCP response packets. The sample TCP response message is determined in the paper, and the sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client is calculated according to each sample TCP response message.
TCP代理根据计算得到的样本传输带宽确定估算带宽样本集,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,根据目标带宽确定可用令牌token数,最后根据可用token数控制报文的发送。The TCP proxy determines the estimated bandwidth sample set according to the calculated sample transmission bandwidth, determines the estimated bandwidth according to the estimated bandwidth sample set, determines the target bandwidth according to the estimated bandwidth, determines the available token token number according to the target bandwidth, and finally controls the packet according to the available token number. send.
本发明实施例中,报文是否会被发送出去是由TCP代理进行控制,具体表现为:报文是否被发送由token数来确定,而该token数又是由目标带宽所确定的,故可以有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。In the embodiment of the present invention, whether the packet is sent out is controlled by the TCP proxy, and the specific expression is: whether the packet is sent by the number of tokens, and the token number is determined by the target bandwidth, so Effectively avoid the network from entering too many messages in an instant and improve TCP throughput.
优选的,本发明实施例中,TCP代理根据目标带宽确定可用令牌token数,最后根据可用token数控制报文的发送有以下几种可能的实现方式,具体如下:Preferably, in the embodiment of the present invention, the TCP proxy determines the number of available token tokens according to the target bandwidth, and finally controls the sending of the packet according to the number of available tokens. The following are possible implementation manners, as follows:
一种实现方式中,TCP代理根据目标带宽确定可用令牌token数,最后根据可用token数控制报文的发送包括:In an implementation manner, the TCP proxy determines the number of available token tokens according to the target bandwidth, and finally controls the sending of the packet according to the number of available tokens, including:
TCP代理可以根据目标带宽设置token数目增长速率,再确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则向TCP客户端发送所述报文。The TCP proxy can set the token growth rate according to the target bandwidth, and then determine whether the number of tokens obtained according to the token growth rate reaches a preset value. If yes, the packet is sent to the TCP client.
在本实现方式中,TCP代理对报文的发送进行控制具体通过根据所述目标带宽确定token数目增长速率,确定按照所述token数目增长速率获得的token的数目是否达到预置数值,若达到,TCP代理才向所述TCP客户端发送所述报文。In this implementation manner, the TCP proxy controls the sending of the packet by determining the number of tokens to increase according to the target bandwidth, and determining whether the number of tokens obtained according to the token growth rate reaches a preset value. The TCP proxy sends the message to the TCP client.
即本发明实施例中,提供了一种TCP代理对报文的发送进行控制的具体实现方式,用于有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。That is, in the embodiment of the present invention, a specific implementation manner for the TCP proxy to control the sending of the packet is provided, which is used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
在一种可能的设计中,上述描述的报文发送方法中,还可以包括:In a possible design, the message sending method described above may further include:
TCP代理可以设置一个发送定时器,并启动该发送定时器,当该发送定时器定时达到预置时长时,则执行确定按照token数目增长速率获得的token的数目是否达到预置数值的步骤。The TCP proxy can set a sending timer and start the sending timer. When the sending timer reaches the preset duration, it performs the step of determining whether the number of tokens obtained according to the token number increasing rate reaches a preset value.
本发明实施例中,当TCP代理确定按照token数目增长速率获得的token 的数目未达到预置数值时,需要被发送的报文会缓存在TCP代理侧套接字socket缓冲区中等待被发送,需要等待触发发送报文的指令的到来,即,TCP代理需要等待上次报文已经发送成功时TCP客户端反馈的确认报文(英文全称:Acknowledgement,英文简称:ACK),此时TCP代理才会再次执行确定按照token数目增长速率增长的token的数目是否达到预置数值的步骤,但是,由于网络故障或其它原因通信,常常会导致ACK往返时间(英文名称:round-trip time,英文简称:RTT)太长,在这种情况下,即使token的数目已经达到预置数值,缓冲区中的数据也会长时间无法发送出去,此时为了避免这种情况的出现,本发明实施例中,TCP代理通过设置一个发送定时器,只要该发送定时器定时达到预置时长时,就会执行确定按照token数目增长速率获得的token的数目是否达到预置数值的步骤,并当token的数目达到预置数值时,则TCP代理才向TCP客户端发送报文。即可以有效地避免了出现套接字socket缓冲区中的数据长时间无法发送出去的情况。In the embodiment of the present invention, when the TCP proxy determines the token obtained according to the growth rate of the number of tokens When the number does not reach the preset value, the message that needs to be sent is cached in the TCP proxy side socket buffer waiting to be sent. It needs to wait for the instruction to trigger the sending of the message, that is, the TCP proxy needs to wait. When the secondary packet has been sent successfully, the TCP client sends an acknowledgement message (English name: Acknowledgement, English abbreviation: ACK). At this time, the TCP proxy will perform the determination again to determine whether the number of tokens that grow according to the number of tokens reaches the preset. The numerical step, however, due to network failure or other reasons of communication, often causes the ACK round trip time (English name: round-trip time, English abbreviation: RTT) to be too long, in this case, even if the number of tokens has reached the pre- If the value is set, the data in the buffer will not be sent out for a long time. In this embodiment of the present invention, the TCP proxy sets a sending timer as long as the sending timer reaches the preset. When the duration is long, a step of determining whether the number of tokens obtained according to the growth rate of the token reaches a preset value is performed, and when When the number of tokens reaches the preset value, the TCP proxy sends a message to the TCP client. That is, it can effectively avoid the situation that the data in the socket socket buffer cannot be sent out for a long time.
在一种可能的设计中,该报文发送方法还可以包括:In a possible design, the message sending method may further include:
TCP代理可以设置token资源队列以及token资源队列的最大深度,其中,token资源队列用于存放TCP代理按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数。The TCP proxy can set the maximum depth of the token resource queue and the token resource queue. The token resource queue is used to store the token obtained by the TCP proxy according to the number of tokens. The maximum depth is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained.
本发明实施例中,token资源队列用于存放TCP代理按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数。在实际应用中,一方面,在一定的时间周期内,若没有报文需要被TCP代理发送,此时按照token数目增长速率会生成出较多的token,而该token资源队列的最大深度约束了token增长不可能超过一定的阈值,另一方面所带来的作用是,token资源队列的最大深度起到一个缓冲作用,即当一段时间周期内TCP代理没有报文需要发送时,token资源队列可以保存一定数量的token,此时,若突然有大量报文需要发送时,可以最大的提高允许被发送的报文数量,最终达到发送报文的相对速率比较均匀的效果。In the embodiment of the present invention, the token resource queue is used to store the token obtained by the TCP proxy according to the number of tokens, and the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate. In practical applications, on the one hand, if there is no packet to be sent by the TCP proxy in a certain period of time, at this time, more tokens are generated according to the number of tokens, and the maximum depth of the token resource queue is constrained. The token growth cannot exceed a certain threshold. On the other hand, the maximum depth of the token resource queue plays a buffering role. That is, when the TCP proxy does not need to send packets in a period of time, the token resource queue can A certain number of tokens are saved. In this case, if a large number of packets need to be sent, the number of packets allowed to be sent can be maximized, and the relative rate of sending packets is relatively uniform.
在一种可能的设计中,TCP代理根据每个样本TCP响应报文计算TCP代 理和TCP客户端之间的TCP连接的样本传输带宽具体为:In one possible design, the TCP proxy calculates the TCP generation based on each sample TCP response message. The sample transmission bandwidth of the TCP connection between the TCP client and the TCP client is specifically:
对于每个样本TCP响应报文,TCP代理可以根据样本TCP响应报文对应的报文的发送时间、样本TCP响应报文的接收时间,以及对应的报文的长度计算出TCP连接的样本传输带宽。For each sample TCP response message, the TCP proxy can calculate the sample transmission bandwidth of the TCP connection according to the sending time of the packet corresponding to the sample TCP response message, the receiving time of the sample TCP response message, and the length of the corresponding packet. .
在一种可能的设计中,TCP代理根据估算带宽确定目标带宽之前还可以包括:In one possible design, the TCP proxy may also include before determining the target bandwidth based on the estimated bandwidth:
TCP代理可以确定TCP客户端之间的TCP连接的业务类型,接着获取策略配置信息,其中,策略配置信息包括目标带宽的调整比例与业务类型的对应关系,该策略配置信息由用户通过TCP代理提供的产品配置界面进行设置,之后可以根据业务类型与策略配置信息确定目标带宽的调整比例,再根据估算带宽以及策略配置信息确定目标带宽;The TCP proxy can determine the service type of the TCP connection between the TCP clients, and then obtain the policy configuration information, where the policy configuration information includes the correspondence between the adjustment ratio of the target bandwidth and the service type, and the policy configuration information is provided by the user through the TCP proxy. The product configuration interface is set, and then the adjustment ratio 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;
此时,TCP代理根据估算带宽以及策略配置信息确定目标带宽具体为:At this point, the TCP proxy determines the target bandwidth based on the estimated bandwidth and policy configuration information:
TCP代理按照以下公式计算得到目标带宽:The TCP proxy calculates the target bandwidth according to the following formula:
目标带宽=目标带宽的调整比例×估算带宽。Target bandwidth = adjustment ratio of target bandwidth × estimated bandwidth.
本发明实施例中,TCP代理可以接收用户通过TCP代理提供的产品配置界面输入策略配置信息,其中,策略配置信息可以包括目标带宽的调整比例与业务类型的对应关系,进一步的,该标带宽的调整比例具体可以为目标带宽的浮动上限值或目标带宽的浮动下限值或目标带宽的调整百分比等。即在本发明实施例中,目标带宽不仅仅只根据由TCP代理确定的估算带宽所确定,还综合考虑了根据TCP代理与TCP客户端之间的TCP连接业务类型的需要进行目标带宽的确定,在实际应用中,可以根据实际的业务类型需求情况,比如视频类业务或图片类业务等业务类型,通过人工方式来选择输入对应的策略配置信息。TCP代理通过用户输入的策略配置信息以及估算带宽确定的目标带宽,可以使得设置的token数目增长速率更加合理,更加准确,在实际应用中,可以更加有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。In the embodiment of the present invention, the TCP proxy can receive the policy configuration information input by the user through the TCP proxy. The policy configuration information can include the correspondence between the adjustment ratio of the target bandwidth and the service type. Further, the bandwidth of the target bandwidth The adjustment ratio may specifically be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth. 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 the target bandwidth is determined according to the requirement of the TCP connection service type between the TCP proxy and the TCP client. In an actual application, the corresponding policy configuration information may be manually selected according to the actual service type requirement, such as a video service or a picture service. The TCP proxy can make the set number of tokens grow more reasonable and more accurate through the policy configuration information input by the user and the target bandwidth determined by the bandwidth estimation. In practical applications, the network can prevent the network from entering too many packets in an instant. Improve TCP throughput.
另一种实现方式中,TCP代理对报文的发送进行控制包括:In another implementation manner, the TCP proxy controls the sending of the packet, including:
TCP代理可以将目标带宽发送至TCP客户端,以使得TCP客户端根据目标带宽设置token数目增长速率,并确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送报文。 The TCP proxy can send the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token number growth rate reaches a preset value, and if so, sends a report. Text.
本实现方式中,TCP代理将目标带宽发送至TCP客户端,以使得TCP客户端根据目标带宽设置token数目增长速率,并确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,TCP客户端才发送报文。即提供了一种TCP代理对报文的发送进行控制另一种具体的实现方式,用于有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。In this implementation manner, the TCP proxy sends the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token number growth rate reaches a preset value. The TCP client sends the message. That is, another specific implementation manner is provided for the TCP proxy to control the sending of the packet, which is used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
第二方面,本发明实施例提供了一种报文发送方法,包括:In a second aspect, an embodiment of the present invention provides a packet sending method, including:
TCP客户端可以接收TCP代理发送的目标带宽,其中,目标带宽由TCP代理根据估算带宽确定,而估算带宽由TCP代理根据估算带宽样本集确定,估算带宽样本集由TCP代理根据样本传输带宽确定,样本传输带宽由TCP代理根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接得到,样本TCP响应报文为N个TCP响应报文中的至少一个,N个TCP响应报文为TCP客户端接收到TCP代理发送的M个报文后反馈至TCP代理的报文,接着TCP客户端根据目标带宽设置token数目增长速率,最后确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则该TCP客户端才发送报文。The TCP client can receive the target bandwidth sent by the TCP proxy, wherein the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth. The sample transmission bandwidth is obtained by the TCP proxy calculating the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message, and the sample TCP response packet is at least one of N TCP response messages, and N TCP response reports. The TCP client receives the M packets sent by the TCP proxy and feeds back the packets to the TCP proxy. Then the TCP client sets the token growth rate according to the target bandwidth, and finally determines whether the number of tokens obtained according to the token growth rate is The preset value is reached. If it is reached, the TCP client sends the message.
在一种可能的设计中,该报文发送方法还包括:In a possible design, the message sending method further includes:
TCP客户端可以设置发送定时器并启动该发送定时器,当发送定时器定时达到预置时长时,则执行TCP客户端确定当前token的数目是否达到预置数值的步骤。The TCP client can set a sending timer and start the sending timer. When the sending timer reaches the preset duration, the TCP client determines whether the current number of tokens reaches the preset value.
当TCP客户端确定按照token数目增长速率获得的token的数目未达到预置数值时,需要被发送的报文会缓存在TCP客户端侧套接字socket缓冲区中等待被发送,需要等待触发发送报文的指令的到来,即,TCP客户端需要等待上次报文已经发送成功时反馈回来的ACK,此时TCP客户端才会再次执行确定按照token数目增长速率增长的token的数目是否达到预置数值的步骤,但是,由于网络故障或其它原因通信,常常会导致ACK往返时间RTT太长,在这种情况下,即使token的数目已经达到预置数值,TCP客户端侧套接字socket缓冲区中的数据也会长时间无法发送出去,此时为了避免这种情况的出现,本发明实施例中,TCP客户端通过设置一个发送定时器,只要该发送定时器定时达到预置时长时,就会执行确定按照token数目增长速率获得的token 的数目是否达到预置数值的步骤,并当token的数目达到预置数值时,则TCP客户端发送报文。即可以有效地避免了出现缓冲区中的数据长时间无法发送出去的情况。When the TCP client determines that the number of tokens obtained according to the token growth rate does not reach the preset value, the packet to be sent is buffered in the TCP client socket socket buffer waiting to be sent, and needs to wait for the trigger to be sent. The arrival of the message instruction, that is, the TCP client needs to wait for the ACK that is sent back when the last message has been sent successfully. At this time, the TCP client will perform the determination again to determine whether the number of tokens that grow according to the number of tokens reaches the pre-up. The step of setting the value, however, due to network failure or other reasons, the communication often causes the ACK round trip time RTT to be too long. In this case, even if the number of tokens has reached the preset value, the TCP client side socket socket buffer 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 data in the area may not be sent out for a long time. Will perform a token that is determined by the rate of increase in the number of tokens. The step of whether the number reaches the preset value, and when the number of tokens reaches the preset value, the TCP client sends a message. That is to say, it can effectively avoid the situation that the data in the buffer cannot be sent out for a long time.
在一种可能的设计中,该报文发送方法还可以包括:In a possible design, the message sending method may further include:
TCP客户端可以设置token资源队列以及token资源队列的最大深度,其中,token资源队列用于存放按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数。The TCP client can set the maximum depth of the token resource queue and the token resource queue. The token resource queue is used to store the token obtained according to the growth rate of the token. The maximum depth is used to indicate that the token resource queue can be stored according to the token growth rate. The maximum number of tokens.
本发明实施例中,token资源队列用于存放按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数。在实际应用中,一方面,在一定的时间周期内,若TCP客户端没有报文需要发送,此时按照token数目增长速率会生成出较多的令token,而该token资源队列的最大深度约束了token增长不可能超过一定的阈值,另一方面所带来的作用是,token资源队列的最大深度起到一个缓冲作用,即当一段时间周期内TCP客户端没有报文需要发送时,token资源队列可以保存一定数量的token,此时,若突然有大量报文需要发送时,可以最大的提高允许被发送的报文数量,最终达到发送报文的相对速率比较均匀的效果。In the embodiment of the present invention, the token resource queue is used to store the token obtained according to the growth rate of the number of tokens, and the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the growth rate of the number of tokens. In practical applications, on the one hand, if there is no packet to be sent by the TCP client in a certain period of time, at this time, according to the number of tokens, the rate will generate more tokens, and the maximum depth constraint of the token resource queue. The token growth cannot exceed a certain threshold. On the other hand, the maximum depth of the token resource queue plays a buffering role, that is, when the TCP client does not need to send a message during a period of time, the token resource The queue can store a certain number of tokens. In this case, if a large number of packets need to be sent, the maximum number of packets allowed to be sent can be increased, and the relative rate of sending packets is relatively uniform.
在一种可能的设计中,目标带宽由TCP代理根据估算带宽以及策略配置信息得到,其中策略配置信息具体可以包括目标带宽的调整比例与业务类型的对应关系,该策略配置信息可以通过TCP代理提供的产品配置界面进行设置。进一步的,该标带宽的调整比例具体可以为目标带宽的浮动上限值或目标带宽的浮动下限值或目标带宽的调整百分比等。In a 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 the adjustment ratio of the target bandwidth and the service type, and the policy configuration information may be provided by using a TCP proxy. The product configuration interface is set. Further, the adjustment ratio of the target bandwidth may specifically be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth.
即在本发明实施例中,目标带宽不仅仅只根据由TCP代理确定的估算带宽所确定,还综合考虑了根据TCP代理与TCP客户端之间的TCP连接业务类型的需要进行目标带宽的确定,可以使得TCP客户端设置的token数目增长速率更加合理,更加准确,在实际应用中,可以更加有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。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 the target bandwidth is determined according to the requirement of the TCP connection service type between the TCP proxy and the TCP client. The rate of the number of tokens set by the TCP client can be made more reasonable and more accurate. In practical applications, the network can be prevented from entering too many packets in an instant and the TCP throughput can be improved.
第三方面,本发明实施例提供了一种TCP代理,该TCP代理具有实现上 述方法设计中TCP代理行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。所述模块可以是软件和/或硬件。In a third aspect, an embodiment of the present invention provides a TCP proxy, where the TCP proxy has an implementation. The function of TCP proxy behavior in the method design. The functions may be implemented by hardware or by corresponding software implemented by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware.
在一种可能的设计中,该TCP代理包括:In one possible design, the TCP proxy includes:
发送模块,用于向TCP客户端发送M个报文;a sending module, configured to send M packets to the TCP client;
接收模块,用于接收TCP客户端发送的M个报文的N个TCP响应报文;a receiving module, configured to receive N TCP response messages of M messages sent by the TCP client;
处理模块,用于根据接收模块接收的每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,根据目标带宽确定可用token数,根据可用token数控制报文的发送。a processing module, configured to calculate, according to each sample TCP response message received by the receiving module, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is at least one of N TCP response packets And determining an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, determining an estimated bandwidth according to the estimated bandwidth sample set, and determining a target bandwidth according to the estimated bandwidth, according to the target bandwidth. Determine the number of available tokens and control the transmission of packets based on the number of available tokens.
在一种可能的设计中,TCP代理的结构中包括发送器、接收器以及处理器,所述发送器、用于向TCP客户端发送M个报文,所述接收器,用于接收TCP客户端发送的M个报文的N个TCP响应报文,所述处理器,用于根据接收器接收的每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,根据目标带宽确定可用令牌token数,根据可用token数控制报文的发送。In a possible design, the structure of the TCP proxy includes a transmitter, a receiver, and a processor, and the transmitter is configured to send M messages to the TCP client, and the receiver is configured to receive the TCP client. The N TCP response messages of the M messages sent by the terminal, the processor, configured to calculate a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message received by the receiver The sample TCP response message is at least one of N TCP response messages, and the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes the sample transmission bandwidth calculated according to each sample TCP response message, according to the estimation. The bandwidth sample set determines the estimated bandwidth, determines the target bandwidth according to the estimated bandwidth, determines the number of available token tokens according to the target bandwidth, and controls the sending of the packet according to the number of available tokens.
第四方面,本发明实施例提供了一种TCP客户端,该TCP客户端具有实现上述方法设计中TCP客户端行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。In a fourth aspect, an embodiment of the present invention provides a TCP client, which has a function of implementing TCP client behavior in the foregoing method design. The functions may be implemented by hardware or by corresponding software implemented by hardware. The hardware or software includes one or more modules corresponding to the functions described above.
在一种可能的设计中,该TCP客户端包括:In one possible design, the TCP client includes:
接收模块,用于接收TCP代理发送的目标带宽,目标带宽由TCP代理根据估算带宽确定,估算带宽由TCP代理根据估算带宽样本集确定,估算带宽样本集由TCP代理根据样本传输带宽确定,样本传输带宽由TCP代理根据每 个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接得到,样本TCP响应报文为N个TCP响应报文中的至少一个,N个TCP响应报文为TCP客户端接收到TCP代理发送的M个报文后反馈至TCP代理的报文;a receiving module, configured to receive a target bandwidth sent by the TCP proxy, where the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth, and the sample transmission is performed. Bandwidth is based on TCP proxy per The sample TCP response message is obtained by calculating the TCP connection between the TCP proxy and the TCP client, and the sample TCP response packet is at least one of N TCP response messages, and the N TCP response messages are TCP clients receiving the TCP. M packets sent by the proxy and then fed back to the TCP proxy packet;
处理模块,用于根据目标带宽设置token数目增长速率,确定按照token数目增长速率获得的token的数目是否达到预置数值;a processing module, configured to set a token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token growth rate reaches a preset value;
发送模块,用于若处理模块确定按照token数目增长速率获得的token的数目达到预置数值,则发送报文。And a sending module, configured to send a message if the processing module determines that the number of tokens obtained according to the number of tokens increases to a preset value.
在一种可能的设计中,TCP客户端的结构中包括接收器、处理器以及发送器,所述接收器,用于接收TCP代理发送的目标带宽,目标带宽由TCP代理根据估算带宽确定,估算带宽由TCP代理根据估算带宽样本集确定,估算带宽样本集由TCP代理根据样本传输带宽确定,样本传输带宽由TCP代理根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接得到,样本TCP响应报文为N个TCP响应报文中的至少一个,N个TCP响应报文为TCP客户端接收到TCP代理发送的M个报文后反馈至TCP代理的报文,所述处理器,用于根据目标带宽设置token数目增长速率,确定按照token数目增长速率获得的token的数目是否达到预置数值,所述发送器,用于若处理器确定按照token数目增长速率获得的token的数目达到预置数值,则发送报文。In a possible design, the structure of the TCP client includes a receiver, a processor, and a transmitter, and the receiver is configured to receive a target bandwidth sent by the TCP proxy, and the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the bandwidth is estimated. Determined by the TCP proxy according to the estimated bandwidth sample set, the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth, and the sample transmission bandwidth is calculated by the TCP proxy according to each sample TCP response message to calculate the TCP connection between the TCP proxy and the TCP client. The sample TCP response message is at least one of the N TCP response messages, and the N TCP response messages are packets that the TCP client feeds back to the TCP proxy after receiving the M messages sent by the TCP proxy, and the processing is performed. And determining, according to the target bandwidth setting token growth rate, whether the number of tokens obtained according to the token number increasing rate reaches a preset value, and the transmitter is configured to: if the processor determines the token obtained according to the token number increasing rate When the number reaches the preset value, the message is sent.
第五方面,本发明实施例提供了一种计算机存储介质,该计算机存储介质中存储有程序代码,该程序代码用于指示执行上述第一方面或第二方面的方法。In a fifth aspect, an embodiment of the present invention provides a computer storage medium, where the program storage code is stored in the computer storage medium, and the program code is used to indicate that the method of the first aspect or the second aspect is performed.
相较于现有技术,从以上技术方案可以看出,本发明实施例中,TCP代理向TCP客户端发送M个报文,接收TCP客户端发送的M个报文的N个TCP响应报文,根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,最后根据目标带宽确定可用令牌token数,根据可用token数控制报文的发送。相较于现有技术,当发送报 文时,报文的发送受限于token数,即对报文的发送速率进行了控制,有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。Compared with the prior art, it can be seen from the foregoing technical solution that, in the embodiment of the present invention, the TCP proxy sends M packets to the TCP client, and receives N TCP response packets of the M packets sent by the TCP client. The sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client is calculated according to each sample TCP response message, and the sample TCP response packet is at least one of N TCP response packets, and the estimated bandwidth is determined according to the sample transmission bandwidth. The sample set, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, an estimated bandwidth is determined according to the estimated bandwidth sample set, a target bandwidth is determined according to the estimated bandwidth, and finally, the available token token number is determined according to the target bandwidth, The sending of the message is controlled according to the number of available tokens. Compared to the prior art, when sending a newspaper In this case, the packet transmission is limited by the token number, that is, the packet transmission rate is controlled, which effectively prevents the network from entering too many packets in an instant and improves the TCP throughput.
附图说明DRAWINGS
图1为本发明实施例的一个系统架构示意图;1 is a schematic structural diagram of a system according to an embodiment of the present invention;
图2为本发明实施例一种报文发送方法一个实施例示意图;2 is a schematic diagram of an embodiment of a method for sending a message according to an embodiment of the present invention;
图3为本发明实施例一种报文发送方法一个实施例中的系统架构示意图;FIG. 3 is a schematic structural diagram of a system in an embodiment of a packet sending method according to an embodiment of the present disclosure;
图4为本发明实施例一种报文发送方法另一实施例示意图;FIG. 4 is a schematic diagram of another embodiment of a packet sending method according to an embodiment of the present disclosure;
图5为本发明实施例一种TCP代理一个实施例示意图;FIG. 5 is a schematic diagram of an embodiment of a TCP proxy according to an embodiment of the present invention; FIG.
图6为本发明实施例一种TCP代理另一实施例示意图;FIG. 6 is a schematic diagram of another embodiment of a TCP proxy according to an embodiment of the present invention; FIG.
图7为本发明实施例一种TCP代理另一实施例示意图;FIG. 7 is a schematic diagram of another embodiment of a TCP proxy according to an embodiment of the present invention; FIG.
图8为本发明实施例一种TCP客户端一个实施例示意图;FIG. 8 is a schematic diagram of an embodiment of a TCP client according to an embodiment of the present invention; FIG.
图9为本发明实施例一种TCP客户端另一实施例示意图。FIG. 9 is a schematic diagram of another embodiment of a TCP client according to an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种报文发送方法、TCP代理以及客户端,用于有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。The embodiment of the invention provides a packet sending method, a TCP proxy and a client, which are used to effectively prevent the network from entering too many packets in an instant and improve the TCP throughput.
请参阅图1,本发明实施例中,TCP客户端通过SCG网关与TCP服务器建立TCP连接。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.
该TCP客户端,可以是指向用户提供语音和/或数据连通性的设备,例如是具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。The TCP client may be a device that provides voice and/or data connectivity to the user, such as a handheld device with wireless connectivity, or other processing device connected to the wireless modem.
TCP代理可以部署于SCG网关上实现,或者也可以为网络中独立的网元,该网元可以部署于TCP客户端与SCG网关之间,也可以部署于SCG网关与TCP服务器之间。The TCP proxy can be deployed on the SCG gateway or can be an independent network element in the network. The network element can be deployed between the TCP client and the SCG gateway, or between the SCG gateway and the TCP server.
TCP服务器发送给TCP客户端的报文均会被先发送至TCP代理,再由TCP代理发送至TCP客户端。The packets sent by the TCP server to the TCP client are sent to the TCP proxy first, and then sent to the TCP client by the TCP proxy.
为了避免网络瞬间进入过多的报文,TCP代理在向TCP客户端发送报文之前,需要根据网络的当前带宽情况进行发送控制,具体的可以是根据目标 带宽确定可用令牌token数,然后再根据可用token数控制报文的发送。In order to prevent the network from entering too many packets in an instant, the TCP proxy needs to send and control according to the current bandwidth of the network before sending the packet to the TCP client, which may be based on the target. The bandwidth determines the number of token tokens available, and then controls the transmission of the message based on the number of available tokens.
本发明实施例中,TCP代理进行发送控制具体有多种方式,下面分别进行描述:In the embodiment of the present invention, the TCP proxy performs transmission control in a plurality of manners, which are respectively described below:
一、TCP代理根据目标带宽确定token数目增长速率并确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则向TCP客户端发送报文:1. The TCP proxy determines the growth rate of the number of tokens according to the target bandwidth and determines whether the number of tokens obtained according to the growth rate of the token reaches a preset value. If yes, the packet is sent to the TCP client:
请参阅图2,本发明实施例一种报文发送方法一个实施例,包括:Referring to FIG. 2, an embodiment of a packet sending method according to an embodiment of the present invention includes:
201、TCP代理向TCP客户端发送M个报文;201. The TCP proxy sends M packets to the TCP client.
本发明实施例中,TCP代理可以向TCP客户端发送M个报文,其中,在TCP代理向TCP客户端发送M个报文后,本发明实施例中,TCP代理还可以接收TCP客户端发送的上述M个报文的N个TCP响应报文。In the embodiment of the present invention, the TCP proxy can send M packets to the TCP client, wherein after the TCP proxy sends M packets to the TCP client, in the embodiment of the present invention, the TCP proxy can also receive the TCP client to send. N TCP response messages of the above M messages.
需要说明的是,本实施例中,M为大于或等于1的正整数,N也为大于或等于1的正整数,且M大于或等于N,具体数值此处不做限定。It should be noted that, in this embodiment, M is a positive integer greater than or equal to 1, and 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.
需要说明的是,TCP代理也可以是部署在TCP服务器上某个具有特定功能的处理单元,亦可以是部署在TCP服务器与TCP客户端之间进行数据交互过程中报文经过的某个网络设备,如业务控制网关(英文全称:service control gateway,英文简称:SCG)网关中,也可以是网络中独立的网络设备,具体此处不做限定。It should be noted that the TCP proxy may also be a processing unit deployed on a TCP server with a specific function, or may be a network device that is deployed in a data exchange process between the TCP server and the TCP client. For example, in the gateway of the service control gateway (English name: service control gateway, English abbreviation: SCG), it may also be an independent network device in the network, which is not limited herein.
为了便于理解,本发明实施例中以TCP代理部署在SCG网关为例进行说明,SCG网关与TCP客户端之间的交互流程如图3所示:For ease of understanding, in the embodiment of the present invention, the TCP proxy is deployed in the SCG gateway as an example, and the interaction process between the SCG gateway and the TCP client is as shown in FIG. 3:
具体地,以TCP客户端上网为例进行说明;TCP服务器通过TCP代理接收TCP客户端发送的get报文,TCP代理收到get报文后,对该get报文进行协议解析,识别TCP客户端所请求的业务类型,并向TCP客户端转发TCP服务器根据该业务类型而发送的报文,TCP客户端接收到报文后,可以向TCP代理发送TCP响应报文。Specifically, the TCP client is used as an example to describe the TCP client. The TCP server receives the get packet sent by the TCP client through the TCP proxy. After receiving the get packet, the TCP proxy performs protocol parsing on the get packet to identify the TCP client. The requested service type, and forwards the packet sent by the TCP server according to the service type to the TCP client. After receiving the packet, the TCP client may send a TCP response packet to the TCP proxy.
202、TCP代理根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽;202. The TCP proxy calculates a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response packet.
本发明实施例中,TCP代理可以根据每个样本TCP响应报文计算TCP代 理和TCP客户端之间的TCP连接的样本传输带宽,实际中即是SCG网关和TCP客户端之间的TCP连接的样本传输带宽。In the embodiment of the present invention, the TCP proxy can calculate the TCP generation according to each sample TCP response message. The sample transmission bandwidth of the TCP connection between the TCP client and the TCP client is actually the sample transmission bandwidth of the TCP connection between the SCG gateway and the TCP client.
需要说明的是,上述样本TCP响应报文可以是N个响应报文中的一个或多个报文,具体此处不做限定。It should be noted that the sample TCP response packet may be one or more of the N response packets, which is not limited herein.
具体地,当TCP代理接收到TCP客户端发送的N个响应报文时,对于每个样本TCP响应报文,TCP代理可以根据所述样本TCP响应报文对应的报文的发送时间、所述样本TCP响应报文的接收时间,以及所述样本TCP响应报文对应的报文的长度计算处所述TCP连接的样本传输带宽。Specifically, when the TCP proxy receives the N response packets sent by the TCP client, the TCP proxy may send, according to the sending time of the packet corresponding to the sample TCP response packet, the TCP response message. The sample transmission bandwidth of the TCP connection is calculated by the reception time of the sample TCP response message and the length of the message corresponding to the sample TCP response message.
203、TCP代理根据样本传输带宽确定估算带宽样本集;203. The TCP proxy determines an estimated bandwidth sample set according to the sample transmission bandwidth.
本发明实施例中,TCP代理根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽后,可以根据计算得到的样本传输带宽确定估算带宽样本集,其中,该估算带宽样本集包括TCP代理根据每个样本TCP响应报文计算得到的样本传输带宽。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, the estimated bandwidth sample set may be determined according to the calculated sample transmission bandwidth, where The estimated bandwidth sample set includes a sample transmission bandwidth calculated by the TCP proxy according to each sample TCP response message.
需要说明的是,该估算带宽样本集也可以包括TCP代理根据至少一个样本TCP响应报文计算得到的样本传输带宽,具体此处不做限定。It should be noted that the estimated bandwidth sample set may also include a sample transmission bandwidth calculated by the TCP proxy according to the at least one sample TCP response packet, which is not limited herein.
204、TCP代理根据估算带宽样本集确定估算带宽;204. The TCP proxy determines an estimated bandwidth according to the estimated bandwidth sample set.
本发明实施例中,TCP代理可以根据得到的估算带宽样本集确定估算带宽,具体地,TCP代理可以对估算带宽样本集包含的样本TCP响应报文计算得到的样本传输带宽进行简单的计算,如算出平均带宽作为估算带宽,可以理解的是,还可以通过其他的计算方法,如进行加权平均计算得到估算带宽,具体此处不做限定。In the embodiment of the present invention, the TCP proxy may determine the estimated bandwidth according to the obtained estimated bandwidth sample set. Specifically, the TCP proxy may perform simple calculation on the sample transmission bandwidth calculated by the sample TCP response packet included in the estimated bandwidth sample set, for example, The average bandwidth is calculated as the estimated bandwidth. It can be understood that the estimated bandwidth can be obtained by other calculation methods, such as weighted average calculation, which is not limited herein.
205、TCP代理根据估算带宽确定目标带宽;205. The TCP proxy determines the target bandwidth according to the estimated bandwidth.
本发明实施例中,在根据估算带宽样本集确定估算带宽后,TCP代理可以根据估算带宽确定目标带宽。需要说明的是,根据估算带宽确定目标带宽之前,TCP代理还可以获取策略配置信息,策略配置信息包含目标带宽的调整比例与业务类型的对应关系,该策略配置信息由用户通过TCP代理提供的产品配置界面进行设置,并根据TCP代理所识别的业务类型确定目标带宽的调整比例。In the 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 also obtain policy configuration information, where the policy configuration information includes a correspondence between the adjustment ratio of the target bandwidth and the service type, and the policy configuration information is provided by the user through the TCP proxy. The configuration interface is set, and the adjustment ratio of the target bandwidth is determined according to the type of service identified by the TCP proxy.
本实施例中,TCP代理根据估算带宽确定目标带宽的具体方式可以为: In this embodiment, the specific manner in which the TCP proxy determines the target bandwidth according to the estimated bandwidth may be:
TCP代理根据估算带宽以及策略配置信息确定目标带宽;The TCP proxy determines the target bandwidth based on the estimated bandwidth and policy configuration information;
此时,TCP代理根据估算带宽以及策略配置信息确定目标带宽具体包括:At this time, the TCP proxy determines the target bandwidth according to the estimated bandwidth and the policy configuration information, and specifically includes:
TCP代理按照以下公式计算得到目标带宽:The TCP proxy calculates the target bandwidth according to the following formula:
目标带宽=目标带宽的调整比例×估算带宽。Target bandwidth = adjustment ratio of target bandwidth × estimated bandwidth.
需要说明的是,该目标带宽的调整比例具体可以为目标带宽的浮动上限值或目标带宽的浮动下限值或目标带宽的调整百分比,其中,该策略配置信息可以通过TCP代理提供的配置界面输入。例如,根据实际的业务类型需求,可以通过TCP代理提供的产品配置界面进行设置,配置界面上有目标带宽的浮动上限选项或目标带宽的浮动下限选项或目标带宽的调整百分选项供用户输入对应的目标带宽的浮动上限值、目标带宽的浮动下限值以及目标带宽的调整百分,这里以目标带宽调整比例为目标浮动上限值为例,则TCP代理根据估算带宽以及策略配置信息确定目标带宽具体可以为:It should be noted that the adjustment ratio of the target bandwidth may be a floating upper limit value of the target bandwidth or a floating lower limit value of the target bandwidth or a percentage adjustment of the target bandwidth, where the policy configuration information may be provided through a configuration interface provided by the TCP proxy. Input. For example, according to the actual service type requirement, it can be set through the product configuration interface provided by the TCP proxy. The configuration interface has a floating upper limit option of the target bandwidth or a floating lower limit option of the target bandwidth or a target percentage adjustment option for the user input. The floating upper limit of the target bandwidth, the floating lower limit of the target bandwidth, and the adjustment percentage of the target bandwidth. Here, the target bandwidth adjustment ratio is taken as the target floating upper limit value, and the TCP proxy determines according to the estimated bandwidth and the policy configuration information. The target bandwidth can be:
目标带宽=目标带宽的浮动上限值×估算带宽。Target bandwidth = floating upper limit of the target bandwidth × estimated bandwidth.
需要说明的是,上述公式描述的目标带宽的计算方法只是其中一种计算方法,除此之外,根据目标带宽调整比例和估算带宽还可以有其它计算目标带宽的方法,具体此处不做限定。It should be noted that the calculation method of the target bandwidth described by the above formula is only one of the calculation methods. In addition, according to the target bandwidth adjustment ratio and the estimated bandwidth, there may be other methods for calculating the target bandwidth, which is not limited herein. .
206、TCP代理根据目标带宽设置token数目增长速率;206. The TCP proxy sets a growth rate of the number of tokens according to the target bandwidth.
本发明实施例中,TCP代理确定目标带宽后,可以根据目标带宽设置token数目增长速率。In the embodiment of the present invention, after the TCP proxy determines the target bandwidth, the token number growth rate may be set according to the target bandwidth.
207、TCP代理设置token资源队列以及token资源队列的最大深度;207. The TCP proxy sets the maximum depth of the token resource queue and the token resource queue.
本发明实施例中,TCP代理可以设置token资源队列,用于存放TCP代理按照token数目增长速率获得的token,还可以设置token资源队列的最大深度,用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数目。In the embodiment of the present invention, the TCP proxy may set a token resource queue, which is used to store a token obtained by the TCP proxy according to the number of tokens, and a maximum depth of the token resource queue, which is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained by the growth rate.
本发明实施例中,在一定的时间周期内,若没有报文需要被TCP代理发送,此时按照token数目增长速率会生成出较多的token,而该token资源队列的最大深度约束了token的增长不可能超过一定的阈值,另一方面,当一段时间周期内TCP代理没有报文需要发送时,token资源队列可以保存一定数量的token,此时,若突然有大量报文需要发送时,可以最大的提高允许被发送 的报文数量,最终达到发送报文的相对速率比较均匀的效果。In the embodiment of the present invention, if no packet needs to be sent by the TCP proxy in a certain period of time, at this time, more tokens are generated according to the token growth rate, and the maximum depth of the token resource queue constrains the token. The growth cannot exceed a certain threshold. On the other hand, when there is no packet to be sent by the TCP proxy in a period of time, the token resource queue can store a certain number of tokens. In this case, if a large number of packets need to be sent suddenly, The biggest increase is allowed to be sent The number of packets eventually reaches the uniform rate of sending packets.
需要说明的是,步骤207与步骤201至步骤206之间并无时序先后关系,具体此处不做限定。It should be noted that there is no sequence relationship between step 207 and step 201 to step 206, which is not limited herein.
208、TCP代理设置发送定时器并启动该发送定时器,当该发送定时器定时达到预置时长时,执行步骤209;208, the TCP proxy sets the sending timer and starts the sending timer, when the sending timer reaches the preset duration, step 209 is performed;
本发明实施例中,TCP代理可以设置发送定时器,并启动该定时器,当该发送定时器定时达到预置时长时,执行步骤209。In the embodiment of the present invention, the TCP proxy may set a sending timer and start the timer. When the sending timer reaches the preset duration, step 209 is performed.
本发明实施例中,当TCP代理确定按照token数目增长速率获得的token的数目未达到预置数值时,需要被发送的报文会缓存在TCP代理侧的socket缓冲区中等待被发送,此时,需要等待触发发送报文的指令的到来,即,TCP代理需要等待上次发送的报文已经发送成功时,TCP客户端反馈的ACK,此时TCP代理才会再次执行确定按照token数目增长速率获得的token的数目是否达到预置数值的步骤,但是,由于网络故障或其它通信原因,常常会导致ACK的RTT太长,在这种情况下,即使token的数目已经达到预置数值,socket缓冲区中的数据也会长时间无法发送出去,此时为了避免这种情况的出现,本发明实施例中,TCP代理通过设置一个发送定时器,只要该发送定时器定时达到预置时长时,就会执行确定按照token数目增长速率获得的token的数目是否达到预置数值的步骤,即可以有效地避免了socket缓冲区中的数据长时间无法发送出去的情况。In the embodiment of the present invention, when the TCP agent determines that the number of tokens obtained according to the number of tokens has not reached the preset value, the packets to be sent are buffered in the socket buffer of the TCP proxy side and are waiting to be sent. Waiting for the instruction to trigger the sending of the message, that is, the TCP proxy needs to wait for the ACK of the TCP client to feed back when the last sent message has been sent successfully. At this time, the TCP proxy will perform the determination again according to the number of tokens. The step of obtaining the number of tokens reaches the preset value. However, due to network failure or other communication reasons, the RTT of the ACK is often too long. In this case, even if the number of tokens has reached the preset value, the socket buffer In the embodiment of the present invention, the TCP proxy sets a sending timer, as long as the sending timer reaches the preset duration, when the data in the area is not sent out for a long time. The step of determining whether the number of tokens obtained according to the growth rate of the token reaches a preset value is performed, that is, it can be effectively Avoid the situation data socket buffer for a long time can not be sent out.
可以理解的是,步骤208在步骤206之后即可执行,具体此处不做限定。It can be understood that step 208 can be executed after step 206, which is not limited herein.
209、TCP代理确定当前按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则执行步骤210;209, the TCP proxy determines whether the number of tokens currently obtained according to the number of token growth rate reaches a preset value, if yes, step 210 is performed;
本发明实施例中,TCP代理将需要转发给TCP客户端的报文存放到TCP代理socket缓冲区中等待被发送,此时,TCP代理判断token资源队列中token的数目是否达到预置数值的步骤,若确定若达到,则执行步骤210。另外可以理解的是,该预置数值的具体数值具体此处不做限定。In the embodiment of the present invention, the TCP proxy stores the packet that needs to be forwarded to the TCP client to the TCP proxy socket buffer for waiting to be sent. At this time, the TCP proxy determines whether the number of tokens in the token resource queue reaches the preset value. If it is determined that it is reached, then step 210 is performed. In addition, it can be understood that the specific value of the preset value is not limited herein.
210、TCP代理向TCP客户端发送报文。210. The TCP proxy sends a packet to the TCP client.
本发明实施例中,当TCP代理确定token资源队列中token的数目达到预置数值时,则TCP代理向TCP客户端发送报文。 In the embodiment of the present invention, when the TCP proxy determines that the number of tokens in the token resource queue reaches a preset value, the TCP proxy sends a packet to the TCP client.
为了便于理解,下面以预置数值为3个token为例进行说明:For ease of understanding, the following is an example of a preset value of 3 tokens:
TCP代理将需要转发给TCP客户端的8个报文存放到TCP代理socket缓冲区中等待被发送,此时,若TCP代理检测到token资源队列中的token的数目为5个,则TCP代理从socket缓冲区中取出3个报文,并将这3个报文发送至TCP客户端,需要说明的是,TCP代理也可以从缓冲区中取出4个,或其它数目的报文发送至TCP客户端,具体此处不做限定。需要说明的是,当上述被发送的报文成功发送至TCP客户端后,根据传输控制协议/因特网互联协议(英文全称:Transmission Control Protocol/Internet Protocol,英文简称:TCP/IP)TCP/IP协议,TCP客户端会向TCP代理发送一个ACK,当TCP代理收到该ACK后,重新执行确定token资源队列中token的数目是否达到预置数值的步骤,若达到预置,且socket缓冲区中还有报文未被发送出去,则继续发送socket缓冲区中的报文,具体此处不再赘述。The TCP proxy stores 8 packets that need to be forwarded to the TCP client to the TCP proxy socket buffer for waiting to be sent. At this time, if the TCP proxy detects that the number of tokens in the token resource queue is five, the TCP proxy is from the socket. Three packets are fetched from the buffer, and the three packets are sent to the TCP client. It should be noted that the TCP proxy can also take out four packets from the buffer, or send other packets to the TCP client. , specifically here is not limited. It should be noted that, after the above-mentioned transmitted message is successfully sent to the TCP client, according to the Transmission Control Protocol/Internet Protocol (English: Voice Control Protocol/Internet Protocol, TCP/IP) TCP/IP protocol The TCP client sends an ACK to the TCP proxy. When the TCP proxy receives the ACK, it re-executes the step of determining whether the number of tokens in the token resource queue reaches a preset value. If the preset is reached, and the socket buffer is still If the packet is not sent, the packet in the socket buffer is sent. The details are not mentioned here.
若TCP代理检测token资源队列中的token的数目少于3个,则上述8个报文继续存放在socket缓冲区中等待被发送。If the TCP proxy detects that the number of tokens in the token resource queue is less than three, the above eight packets continue to be stored in the socket buffer and are waiting to be sent.
另外需要说明的是,每当TCP代理将需要转发给TCP客户端的报文存放到TCP代理侧socket缓冲区中时,即会判断token资源队列中token的数目是否达到预置数值。In addition, it should be noted that whenever the TCP proxy needs to forward the packet forwarded to the TCP client to the TCP proxy side socket buffer, it will determine whether the number of tokens in the token resource queue reaches the preset value.
本发明实施例中,TCP代理向TCP客户端发送M个报文,接收TCP客户端发送的M个报文的N个TCP响应报文,根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,根据目标带宽设置token数目增长速率,确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则向TCP客户端发送报文。相较于现有技术,当发送报文时,报文的发送受限于token数,即对报文的发送速率进行了控制,有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。In the embodiment of the present invention, the TCP proxy sends M packets to the TCP client, receives N TCP response packets of M messages sent by the TCP client, and calculates TCP proxy and TCP client according to each sample TCP response packet. The sample transmission bandwidth of the TCP connection between the terminals, the sample TCP response message is at least one of N TCP response messages, and the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes a TCP response report according to each sample. Calculate the sample transmission bandwidth, determine the estimated bandwidth according to the estimated bandwidth sample set, determine the target bandwidth according to the estimated bandwidth, set the token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token number growth rate reaches a preset value. If it is reached, it sends a message to the TCP client. Compared with the prior art, when a packet is sent, the packet transmission is limited to the number of tokens, that is, the packet transmission rate is controlled, thereby effectively preventing the network from entering too many packets in an instant and improving the TCP throughput. .
二、TCP代理将目标带宽发送至所述TCP客户端,以使得TCP客户端根据目标带宽设置token数目增长速率,并确定按照所述token数目增长速率获 得的token的数目是否达到预置数值,若达到,则发送所述报文:2. The TCP proxy sends the target bandwidth to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines that the token growth rate is obtained according to the token number. Whether the number of obtained tokens reaches a preset value, and if so, the message is sent:
请参阅图4,本发明实施例一种报文发送方法另一实施例,包括:Referring to FIG. 4, another embodiment of a packet sending method according to an embodiment of the present invention includes:
步骤401至步骤405分别与上述实施例中的步骤201至步骤205相同,具体此处不再赘述。Steps 401 to 405 are the same as steps 201 to 205 in the foregoing embodiment, and details are not described herein again.
406、TCP代理将目标带宽发送至TCP客户端;406. The TCP proxy sends the target bandwidth to the TCP client.
本发明实施例中,当TCP代理根据估算带宽确定目标带宽之后,可以向TCP客户端发送该目标带宽,TCP客户端可以接到收该目标带宽。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、TCP客户端根据目标带宽设置token数目增长速率;407. The TCP client sets a growth rate of the number of tokens according to the target bandwidth.
本发明实施例中,TCP客户端可以设置token资源队列,用于存放按照token数目增长速率获得的token,还可以设置token资源队列的最大深度,用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数目。In the embodiment of the present invention, the TCP client may set a token resource queue, which is used to store the token obtained according to the growth rate of the token number, and may also set the maximum depth of the token resource queue, which is used to indicate that the token resource queue can be stored according to the number of tokens. The maximum number of tokens obtained by the rate.
本发明实施例中,在一定的时间周期内,若TCP客户端没有报文需要发送,此时按照token数目增长速率会生成出较多的token,而该token资源队列的最大深度约束了token增长不可能超过一定的阈值,另一方面,当一段时间周期内TCP代理没有报文需要发送时,token资源队列可以保存一定数量的token,此时,若突然有大量报文需要发送时,可以最大的提高允许被发送的报文数量,最终达到发送报文的相对速率比较均匀的效果。In the embodiment of the present invention, if there is no packet to be sent by the TCP client in a certain period of time, more tokens are generated according to the number of tokens, and the maximum depth of the token resource queue constrains the token growth. It is impossible to exceed a certain threshold. On the other hand, when there is no packet to be sent by the TCP proxy in a period of time, the token resource queue can store a certain number of tokens. In this case, if a large number of packets need to be sent suddenly, the maximum can be The increase allows the number of packets to be sent, and finally achieves a relatively uniform rate of sending packets.
需要说明的是,步骤408与步骤401至步骤407之间并无时序先后关系,具体此处不做限定。It should be noted that there is no sequence relationship between the step 408 and the step 401 to the step 407, which is not limited herein.
409、TCP客户端设置发送定时器并启动发送定时器,当该发送定时器定时达到预置时长时,执行步骤410;409, the TCP client sets the sending timer and starts the sending timer, when the sending timer reaches the preset duration, step 410 is performed;
本发明实施例中,TCP客户端可以设置发送定时器,并启动该定时器,当该发送定时器定时达到预置时长时,执行步骤410。In the embodiment of the present invention, the TCP client may set a sending timer and start the timer. When the sending timer reaches the preset duration, step 410 is performed.
本发明实施例中,当TCP客户端确定按照token数目增长速率获得的token的数目未达到预置数值时,需要被发送的报文会缓存在TCP客户端侧的socket缓冲区中等待被发送,此时,需要等待触发发送报文的指令的到来,即,TCP客户端等待上次发送的报文已经发送成功时反馈回来的ACK,此时TCP客户端才会再次执行确定按照token数目增长速率获得的token的数目是否达到预 置数值的步骤,但是,由于网络故障或其它通信原因,常常会导致ACK的RTT太长,在这种情况下,即使token的数目已经达到预置数值,socket缓冲区中的数据也会长时间无法发送出去,此时为了避免这种情况的出现,本发明实施例中,TCP客户端通过设置一个发送定时器,只要该发送定时器定时达到预置时长时,就会执行确定当前按照token数目增长速率增长的token的数目是否达到预置数值的步骤,即可以有效地避免了socket缓冲区中的数据长时间无法发送出去的情况。In the embodiment of the present invention, when the TCP client determines that the number of tokens obtained according to the number of tokens has not reached the preset value, the packets to be sent are buffered in the socket buffer of the TCP client side and are waiting to be sent. At this time, it is necessary to wait for the arrival of the instruction for triggering the transmission of the message, that is, the TCP client waits for the ACK that is sent back when the last transmitted message has been sent successfully, and the TCP client will perform the determination again according to the number of tokens. Whether the number of tokens obtained reaches the pre- The step of setting the value, however, due to network failure or other communication reasons, the RTT of the ACK is often too long. In this case, even if the number of tokens has reached the preset value, the data in the socket buffer will be long. 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 current number of tokens is determined. The step of increasing the number of tokens for increasing the rate reaches a preset value, that is, the situation in which the data in the socket buffer cannot be sent for a long time can be effectively avoided.
可以理解的是,步骤409在步骤407之后即可执行,具体此处不做限定。It can be understood that step 409 can be executed after step 407, which is not limited herein.
410、TCP客户端确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则执行步骤411;410, the TCP client determines whether the number of tokens obtained according to the number of token growth rate reaches a preset value, if yes, step 411;
TCP客户端通过套接字socket将需要发送的报文存放到TCP客户端侧socket缓冲区中等待被发送,此时,执行TCP客户端确定token资源队列中token的数目是否达到预置数值的步骤,若确定若达到,则执行步骤411。可以理解的是,该预置数值的具体数值此处不做限定。The TCP client stores the packet to be sent to the TCP client side socket buffer through the socket socket, and waits for the TCP client to determine whether the number of tokens in the token resource queue reaches the preset value. If it is determined that it is reached, step 411 is performed. It can be understood that the specific value of the preset value is not limited herein.
411、TCP客户端发送报文。411. The TCP client sends a packet.
本发明实施例中,当TCP客户端确定当前按照token数目增长速率增长的token的数目达到预置数值时,则TCP客户端发送报文。In the embodiment of the present invention, when the TCP client determines that the number of tokens currently increasing according to the number of tokens reaches a preset value, the TCP client sends a packet.
为了便于理解,下面以预置数值为3个token为例进行说明:For ease of understanding, the following is an example of a preset value of 3 tokens:
TCP客户端将需要转发给TCP客户端的8个报文存放到TCP客户端侧socket缓冲区中等待被TCP客户端发送,此时,若TCP客户端检测token资源队列中的token的数目为5个,则TCP客户端从socket缓冲区中取出3个报文,并发送所述3个报文至TCP代理,需要说明的是,TCP客户端也可以从缓冲区中取出4个报文,或其它数目的报文发送至TCP代理,具体此处不做限定。需要说明的是,当上述被发送的报文成功发送后,根据TCP/IP协议,TCP代理会向TCP客户端反馈一个ACK,当TCP客户端收到该ACK后,重新执行确定token资源队列中token的数目是否达到预置数值的步骤,若达到预置数值,且socket缓冲区中还有报文未被发送出去,则继续发送socket缓冲区中的报文,具体此处不再赘述。The TCP client stores the eight packets that need to be forwarded to the TCP client to the TCP client side socket buffer for transmission by the TCP client. In this case, if the TCP client detects the number of tokens in the token resource queue is 5 The TCP client extracts three packets from the socket buffer and sends the three packets to the TCP proxy. It should be noted that the TCP client can also take out four packets from the buffer, or other The number of packets is sent to the TCP proxy, which is not limited here. It should be noted that, after the above-mentioned transmitted message is successfully sent, according to the TCP/IP protocol, the TCP proxy feeds back an ACK to the TCP client, and when the TCP client receives the ACK, it re-executes the determination of the token resource queue. If the number of the tokens reaches the preset value, if the preset value is reached, and the packet in the socket buffer is not sent, the packet in the socket buffer is sent, which is not described here.
若TCP客户端检测token资源队列中的token的数目少于3个,则上述8 个报文继续存放在socket缓冲区中等待被发送。If the TCP client detects that the number of tokens in the token resource queue is less than three, the above 8 The message continues to be stored in the socket buffer waiting to be sent.
另外需要说明的是,每当TCP客户端通过套接字socket将需要发送给TCP代理的报文存放到TCP客户端侧socket缓冲区中时,即会执行TCP客户端确定token资源队列中token的数目是否达到预置数值的步骤。In addition, it should be noted that whenever the TCP client stores the packet to be sent to the TCP proxy through the socket socket to the TCP client side socket buffer, the TCP client determines the token in the token resource queue. The step of whether the number reaches the preset value.
通过TCP代理向TCP客户端发送M个报文,接收TCP客户端发送的M个报文的N个TCP响应报文,根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,将目标带宽发送至TCP客户端,以使得TCP客户端根据目标带宽设置token数目增长速率,并确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送报文。相较于现有技术,当发送报文时,报文的发送受限于token数,即对报文的发送速率进行了控制,有效地避免网络瞬间进入过多的报文,提高TCP吞吐量。Sending M packets to the TCP client through the TCP proxy, receiving N TCP response packets of the M packets sent by the TCP client, and calculating the TCP between the TCP proxy and the TCP client according to each sample TCP response packet. The sample transmission bandwidth of the connection, the sample TCP response message is at least one of N TCP response messages, and the estimated bandwidth sample set is determined according to the sample transmission bandwidth, and the estimated bandwidth sample set includes the sample calculated according to each sample TCP response message. The transmission bandwidth is determined according to the estimated bandwidth sample set, and the target bandwidth is sent to the TCP client, so that the TCP client sets the token growth rate according to the target bandwidth, and determines whether the number of tokens obtained according to the token growth rate reaches the pre-predetermined rate. Set the value, if it is reached, send a message. Compared with the prior art, when a packet is sent, the packet transmission is limited to the number of tokens, that is, the packet transmission rate is controlled, thereby effectively preventing the network from entering too many packets in an instant and improving the TCP throughput. .
以上对本发明实施例中的一种报文发送方法进行了描述,下面对本发明实施例中TCP代理进行描述。A packet sending method in the embodiment of the present invention has been described above. The following describes the TCP proxy in the embodiment of the present invention.
具体请参阅图5,本发明TCP代理的一个实施例,包括:发送模块501、接收模块502以及处理模块503。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.
发送模块501,用于向TCP客户端发送M个报文;The sending module 501 is configured to send M messages to the TCP client.
接收模块502,用于接收TCP客户端发送的M个报文的N个TCP响应报文;The receiving module 502 is configured to receive N TCP response messages of M messages sent by the TCP client.
处理模块503,用于根据接收模块502接收的每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接的样本传输带宽,样本TCP响应报文为N个TCP响应报文中的至少一个,根据样本传输带宽确定估算带宽样本集,估算带宽样本集包括根据每个样本TCP响应报文计算得到的样本传输带宽,根据估算带宽样本集确定估算带宽,根据估算带宽确定目标带宽,根据目标带宽设置token数目增长速率,确定按照token数目增长速率获得的token的数目是否达到预置数值;The processing module 503 is configured to calculate, according to each sample TCP response message received by the receiving module 502, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is in the N TCP response packets. At least one, determining an estimated bandwidth sample set according to the sample transmission bandwidth, the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each sample TCP response message, determining an estimated bandwidth according to the estimated bandwidth sample set, and determining a target bandwidth according to the estimated bandwidth, according to The target bandwidth sets the rate of increase of the number of tokens, and determines whether the number of tokens obtained according to the growth rate of the number of tokens reaches a preset value;
发送模块501还用于若处理模块503确定按照token数目增长速率获得的 token的数目达到预置数值,则向TCP客户端发送报文;The sending module 501 is further configured to: if the processing module 503 determines that the rate is increased according to the number of tokens If the number of tokens reaches a preset value, the packet is sent to the TCP client;
结合上述实施例,该处理模块503还用于:In combination with the foregoing embodiment, the processing module 503 is further configured to:
设置发送定时器并启动所述发送定时器;Setting a sending timer and starting the sending timer;
当发送定时器定时达到预置时长时,则确定按照token数目增长速率获得的token的数目是否达到预置数值;When the sending timer reaches the preset duration, it is determined whether the number of tokens obtained according to the token number increasing rate reaches a preset value;
设置token资源队列以及token资源队列的最大深度,token资源队列用于存放按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数;Set the token resource queue and the maximum depth of the token resource queue. The token resource queue is used to store the token obtained according to the growth rate of the token. The maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate.
对于每个样本TCP响应报文,根据样本TCP响应报文对应的报文的发送时间、样本TCP响应报文的接收时间,以及样本TCP响应报文对应的报文的长度计算TCP连接的样本传输带宽;For each sample TCP response message, the sample transmission of the TCP connection is calculated according to the transmission time of the packet corresponding to the sample TCP response message, the reception time of the sample TCP response message, and the length of the packet corresponding to the sample TCP response message. bandwidth;
获取策略配置信息,策略配置信息包括目标带宽的调整比例与业务类型的对应关系;Obtaining policy configuration information, where the policy configuration information includes a correspondence between a target bandwidth adjustment ratio and a service type;
根据估算带宽、TCP连接对应的业务类型以及策略配置信息确定目标带宽。The target bandwidth is determined according to the estimated bandwidth, the service type corresponding to the TCP connection, and the policy configuration information.
上面从模块化功能实体的角度对本发明实施例中的TCP代理进行描述,下面从硬件处理的角度对本发明实施例中的TCP代理进行描述,请参阅图6,本发明实施例提供的一种TCP代理结构示意图,该TCP代理600可因配置或性能不同而产生比较大的差异,如可以包括一个或多个上述实施例处理模块503对应的实体装置处理器(例如,一个或一个以上处理器),与上述实施例中发送模块501对应的实体装置发送器602,接收模块502对应的实体装置接收器603以及存储器604,一个或一个以上数据608或存储程序代码609的存储介质605(例如一个或一个以上海量存储设备)。其中,存储器604和存储介质605可以是短暂存储或持久存储。存储在存储介质605的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对TCP代理中的一系列指令操作。更进一步地,中央处理器601可以设置为与存储介质605通信,在TCP代理600上执行存储介质605中的一系列指令操作。The TCP proxy in the embodiment of the present invention is described above from the perspective of a modular functional entity. The following describes the TCP proxy in the embodiment of the present invention from the perspective of hardware processing. Referring to FIG. 6, a TCP provided by the embodiment of the present invention is provided. Schematic diagram of the proxy structure, the TCP proxy 600 may be relatively different due to different configurations or performances, such as may include one or more physical device processors (eg, one or more processors) corresponding to the processing module 503 of the above embodiment. The physical device transmitter 602 corresponding to the sending module 501 in the above embodiment, the physical device receiver 603 and the memory 604 corresponding to the receiving module 502, one or more data 608 or a storage medium 605 storing the program code 609 (for example, one or A storage device in Shanghai). Among them, the memory 604 and the storage medium 605 may be short-term storage or persistent storage. The program stored on storage medium 605 can include one or more modules (not shown), each of which can include a series of instruction operations in a TCP proxy. Still further, central processor 601 can be configured to communicate with storage medium 605 to perform a series of instruction operations in storage medium 605 on TCP proxy 600.
TCP代理600还可以包括一个或一个以上电源606,一个或一个以上操作系统607。 TCP proxy 600 may also include one or more power sources 606, one or more operating systems 607.
本实施例中由TCP代理所执行的步骤可以基于该图6所示的TCP代理结构示意图,具体可以参考前述实施例中的对应过程,在此不再赘述。The steps performed by the TCP proxy in this embodiment may be based on the schematic diagram of the TCP proxy structure shown in FIG. 6. For details, refer to the corresponding process in the foregoing embodiment, and details are not described herein again.
请参阅图7,本发明实施例TCP代理另一实施例,包括:发送模块701接收模块702以及处理模块703。Referring to FIG. 7, another embodiment of a TCP proxy according to an embodiment of the present invention includes: a sending module 701 receiving a module 702 and a processing module 703.
发送模块701,用于向TCP客户端发送M个报文;The sending module 701 is configured to send M messages to the TCP client.
接收模块702,用于接收所述TCP客户端发送的所述M个报文的N个TCP响应报文;The receiving module 702 is configured to receive N TCP response packets of the M packets sent by the TCP client.
处理模块703,用于根据所述接收模块702接收的每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接的样本传输带宽,所述样本TCP响应报文为所述N个TCP响应报文中的至少一个,根据所述样本传输带宽确定估算带宽样本集,所述估算带宽样本集包括根据每个所述样本TCP响应报文计算得到的样本传输带宽,根据所述估算带宽样本集确定估算带宽,根据所述估算带宽确定目标带宽;The processing module 703 is configured to calculate, according to each sample TCP response message received by the receiving module 702, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is Determining, by the at least one of the N TCP response messages, 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 of the sample TCP response messages, according to The estimated bandwidth sample set determines an estimated bandwidth, and the target bandwidth is determined according to the estimated bandwidth;
发送模块701还用于将目标带宽发送至TCP客户端,以使得TCP客户端根据目标带宽设置token数目增长速率,并确定按照token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送报文。The sending module 701 is further configured to send the target bandwidth to the TCP client, so that the TCP client sets the token growth 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, Then send a message.
同理,本实施例中对应的实体装置可以参阅图6所示的结构示意图,相对应执行的步骤可以参阅上述实施例,具体此处不再赘述。For the same reason, the corresponding physical device in this embodiment can refer to the structural diagram shown in FIG. 6. For the corresponding steps, refer to the foregoing embodiment, and details are not described herein again.
上面对本发明实施例中的TCP代理进行了描述,下面对本发明实施例中的TCP客户端进行描述,请参阅图8,本发明实施例TCP客户端一个实施例,包括:接收模块801、处理模块802以及发送模块803。The TCP proxy in the embodiment of the present invention is described above. The following describes the TCP client in the embodiment of the present invention. Referring to FIG. 8, an embodiment of the TCP client in the embodiment of the present invention includes: a receiving module 801, and a processing module. 802 and a transmitting module 803.
接收模块801,用于接收TCP代理发送的目标带宽,目标带宽由TCP代理根据估算带宽确定,估算带宽由TCP代理根据估算带宽样本集确定,估算带宽样本集由TCP代理根据样本传输带宽确定,样本传输带宽由TCP代理根据每个样本TCP响应报文计算TCP代理和TCP客户端之间的TCP连接得到,样本TCP响应报文为N个TCP响应报文中的至少一个,N个TCP响应报文为TCP客户端接收到TCP代理发送的M个报文后反馈至TCP代理的报文;The receiving module 801 is configured to receive a target bandwidth sent by the TCP proxy, where the target bandwidth is determined by the TCP proxy according to the estimated bandwidth, and the estimated bandwidth is determined by the TCP proxy according to the estimated bandwidth sample set, and the estimated bandwidth sample set is determined by the TCP proxy according to the sample transmission bandwidth, and the sample is determined. The transmission bandwidth is obtained by the TCP proxy to calculate the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message. The sample TCP response packet is at least one of N TCP response packets, and N TCP response packets. The message that the TCP client receives back to the TCP proxy after receiving the M packets sent by the TCP proxy;
处理模块802,用于根据目标带宽设置token数目增长速率,确定按照token数目增长速率获得的token的数目是否达到预置数值; The processing module 802 is configured to set a token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the token growth rate reaches a preset value;
发送模块803,用于若处理模块802确定按照token数目增长速率获得的token的数目达到预置数值,则发送报文。The sending module 803 is configured to send a message if the processing module 802 determines that the number of tokens obtained according to the number of tokens increases to a preset value.
结合上述实施例,该处理模块802还用于:In combination with the foregoing embodiment, the processing module 802 is further configured to:
设置发送定时器并启动发送定时器;Set the send timer and start the send timer;
当发送定时器定时达到预置时长时,则确定按照token数目增长速率获得的token的数目是否达到预置数值;When the sending timer reaches the preset duration, it is determined whether the number of tokens obtained according to the token number increasing rate reaches a preset value;
设置token资源队列以及token资源队列的最大深度,token资源队列用于存放按照token数目增长速率获得的token,最大深度用于指示token资源队列能存放的按照token数目增长速率获得的token的最大数。Set the token resource queue and the maximum depth of the token resource queue. The token resource queue is used to store the token obtained according to the growth rate of the token. The maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the token growth rate.
上面从模块化功能实体的角度对本发明实施例中的TCP客户端进行描述,下面从硬件处理的角度对本发明实施例中的TCP客户端进行描述,如图9所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例对应的方法部分,请参阅图9,本发明实施例提供的一种TCP客户端结构示意图:The TCP client in the embodiment of the present invention is described above from the perspective of a modular functional entity. 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 For a part related to the embodiment of the present invention, the specific technical details are not disclosed. Please refer to the method part corresponding to the embodiment of the present invention. Referring to FIG. 9, a schematic diagram of a TCP client structure is provided in the embodiment of the present invention:
该TCP客户端包括:与上述实施例接收模块801以及发送模块803对应的实体装置为接收器901以及发送器903、处理模块802对应的实体装置处理器902,该TCP客户端还包括存储器904,用于存储程序代码,当所述程序代码被所述处理器902执行时,可以实现本发明上述各实施例的方法。本领域技术人员可以理解,图9中示出的TCP客户端结构并不构成对TCP客户端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The TCP client includes: a physical device corresponding to the receiving module 801 and the sending module 803 of the foregoing embodiment, and a physical device processor 902 corresponding to the receiver 901 and the processing module 802. The TCP client further includes a memory 904. For storing program code, when the program code is executed by the processor 902, the methods of the above-described embodiments of the present invention can be implemented. It will be understood by those skilled in the art that the TCP client structure shown in FIG. 9 does not constitute a limitation to the TCP client, and may include more or less components than those illustrated, or combine some components, or different component arrangements. .
本实施例中由TCP客户端所执行的步骤可以基于该图9所示的TCP客户端结构示意图,具体可以参考前述实施例中的对应过程,在此不再赘述。The steps performed by the TCP client in this embodiment may be based on the structure of the TCP client shown in FIG. 9. For details, refer to the corresponding process in the foregoing embodiment, and details are not described herein again.
需要说明的是,上述装置实施例所涉及到的处理器可以是中央处理器(英文全称:central processing unit,英文简称:CPU),网络处理器(英文全称:network processor,英文简称:NP)或者CPU和NP的组合。处理器还可以进一步包括硬件芯片,具体可以是专用集成电路(英文全称:application-specific integrated circuit,英文简称:ASIC),可编程逻辑器(英文全称:programmable logic device,英文简称:PLD)或其组合。另外PLD可以是复杂可编程逻辑 器件(英文全称:complex programmable logic device,英文简称:CPLD),现场可编程逻辑门阵列(英文全称:field-programmable gate array,英文简称:FPGA),通用阵列逻辑(英文全称:generic array logic,英文简称:GAL)或其任意组合,在本发明中不做任何限定。It should be noted that the processor involved in the foregoing device embodiment may be a central processing unit (English name: central processing unit, English abbreviation: CPU), a network processor (English full name: network processor, English abbreviation: NP) or A combination of CPU and NP. The processor may further include a hardware chip, which may be an application-specific integrated circuit (English name: ASIC), a programmable logic device (English full name: programmable logic device, English abbreviation: PLD) or combination. In addition, PLD can be complex programmable logic Device (English full name: complex programmable logic device, English abbreviation: CPLD), field programmable logic gate array (English full name: field-programmable gate array, English abbreviation: FPGA), general array logic (English full name: generic array logic, English The abbreviation: GAL) or any combination thereof is not limited in the present invention.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,模块和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed systems, modules, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的模块果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文全称:Read-Only Memory,英文简称:ROM)、随机存取存储器(英文全称:Random Access Memory英文简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated modules, when implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (English full name: Read-Only Memory, English abbreviation: ROM), a random access memory (English full name: Random Access Memory English: RAM), a disk Or a variety of media such as optical discs that can store program code.
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制; 尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。 The above embodiments are only used to illustrate the technical solutions of the present invention, and are not limited thereto; Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or equivalently replace some of the technical features. Modifications or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the invention.

Claims (20)

  1. 一种报文发送方法,其特征在于,所述方法由TCP代理执行,所述方法包括:A packet sending method, characterized in that the method is performed by a TCP proxy, the method comprising:
    向TCP客户端发送M个报文;Send M messages to the TCP client;
    接收所述TCP客户端发送的所述M个报文的N个TCP响应报文;Receiving N TCP response messages of the M packets sent by the TCP client;
    根据每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接的样本传输带宽,所述样本TCP响应报文为所述N个TCP响应报文中的至少一个;Calculating, according to each sample TCP response message, a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is at least one of the N TCP response packets;
    根据所述样本传输带宽确定估算带宽样本集,所述估算带宽样本集包括根据每个所述样本TCP响应报文计算得到的样本传输带宽;Determining 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 of the sample TCP response messages;
    根据所述估算带宽样本集确定估算带宽;Determining an estimated bandwidth according to the estimated bandwidth sample set;
    根据所述估算带宽确定目标带宽;Determining a target bandwidth according to the estimated bandwidth;
    根据所述目标带宽确定可用令牌token数,根据所述可用token数控制报文的发送。Determining the number of available token tokens according to the target bandwidth, and controlling transmission of the packet according to the available token number.
  2. 根据权利要求1所述的报文发送方法,其特征在于,所述根据所述目标带宽确定可用令牌token数,根据所述可用token数控制报文的发送包括:The packet sending method according to claim 1, wherein the determining the number of available token tokens according to the target bandwidth, and controlling the sending of the packet according to the available token number comprises:
    根据所述目标带宽设置token数目增长速率;Setting a token growth rate according to the target bandwidth;
    确定按照所述token数目增长速率获得的token的数目是否达到预置数值,若达到,则向所述TCP客户端发送所述报文。Determining whether the number of tokens obtained according to the rate of increase of the number of tokens reaches a preset value, and if so, sending the message to the TCP client.
  3. 根据权利要求1所述的报文发送方法,其特征在于,所述根据所述目标带宽确定可用令牌token数,根据所述可用token数控制报文的发送包括:The packet sending method according to claim 1, wherein the determining the number of available token tokens according to the target bandwidth, and controlling the sending of the packet according to the available token number comprises:
    将所述目标带宽发送至所述TCP客户端,以使得所述TCP客户端根据所述目标带宽设置token数目增长速率,并确定按照所述token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送所述报文。Sending the target bandwidth to the TCP client, so that the TCP client sets a token growth 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. If yes, the message is sent.
  4. 根据权利要求2所述的报文发送方法,其特征在于,所述方法还包括:The method for transmitting a message according to claim 2, wherein the method further comprises:
    设置发送定时器并启动所述发送定时器;Setting a sending timer and starting the sending timer;
    当所述发送定时器定时达到预置时长时,则执行所述确定按照所述token数目增长速率获得的token的数目是否达到预置数值的步骤。When the sending timer reaches the preset duration, the step of determining whether the number of tokens obtained according to the token number increasing rate reaches a preset value is performed.
  5. 根据权利要求4所述的报文发送方法,其特征在于,所述方法还包括:The method for transmitting a message according to claim 4, wherein the method further comprises:
    设置token资源队列以及所述token资源队列的最大深度,所述token资 源队列用于存放按照所述token数目增长速率获得的token,所述最大深度用于指示所述token资源队列能存放的按照所述token数目增长速率获得的token的最大数。Setting a token resource queue and a maximum depth of the token resource queue, the token resource The source queue is configured to store a token obtained according to the rate of increase of the number of tokens, where the maximum depth is used to indicate the maximum number of tokens that can be stored in the token resource queue according to the growth rate of the number of tokens.
  6. 根据权利要求5所述的报文发送方法,其特征在于,所述根据每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接的样本传输带宽包括:The packet transmission method according to claim 5, wherein the calculating a sample transmission bandwidth of the TCP connection between the TCP proxy and the TCP client according to each sample TCP response message comprises:
    对于每个样本TCP响应报文,根据所述样本TCP响应报文对应的报文的发送时间、所述样本TCP响应报文的接收时间,以及所述样本TCP响应报文对应的报文的长度计算所述TCP连接的样本传输带宽。For each sample TCP response message, according to the sending time of the packet corresponding to the sample TCP response message, the receiving time of the sample TCP response message, and the length of the packet corresponding to the sample TCP response message. Calculating the sample transmission bandwidth of the TCP connection.
  7. 根据权利要求6所述的报文发送方法,其特征在于,所述TCP代理根据估算带宽确定目标带宽之前还包括:The packet sending method according to claim 6, wherein the determining, by the TCP proxy, the target bandwidth according to the estimated bandwidth, further comprises:
    获取策略配置信息,所述策略配置信息包括所述目标带宽的调整比例与业务类型的对应关系;Obtaining policy configuration information, where the policy configuration information includes a correspondence between the adjustment ratio of the target bandwidth and a service type;
    所述根据所述估算带宽确定目标带宽包括:The determining the target bandwidth according to the estimated bandwidth includes:
    根据所述估算带宽、所述TCP连接对应的业务类型以及所述策略配置信息确定所述目标带宽。Determining the target bandwidth according to the estimated bandwidth, a service type corresponding to the TCP connection, and the policy configuration information.
  8. 一种报文发送方法,其特征在于,包括:A message sending method, comprising:
    TCP客户端接收TCP代理发送的目标带宽,所述目标带宽由所述TCP代理根据估算带宽确定,所述估算带宽由所述TCP代理根据估算带宽样本集确定,所述估算带宽样本集由所述TCP代理根据样本传输带宽确定,所述样本传输带宽由所述TCP代理根据每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接得到,所述样本TCP响应报文为N个TCP响应报文中的至少一个,所述N个TCP响应报文为所述TCP客户端接收到所述TCP代理发送的M个报文后反馈至所述TCP代理的报文;The TCP client receives a target bandwidth sent by the TCP proxy, the target bandwidth being determined by the TCP proxy based on the estimated bandwidth, the estimated bandwidth being determined by the TCP proxy according to the estimated bandwidth sample set, the estimated bandwidth sample set being The TCP proxy determines, according to the sample transmission bandwidth, that the TCP transmission bandwidth is obtained by the TCP proxy according to each sample TCP response message, and the TCP connection between the TCP proxy and the TCP client is obtained, and the sample TCP response report is obtained. The message is at least one of the N TCP response messages, and the N TCP response messages are the messages that the TCP client feeds back to the TCP proxy after receiving the M messages sent by the TCP proxy;
    所述TCP客户端根据所述目标带宽设置token数目增长速率;Setting, by the TCP client, a token growth rate according to the target bandwidth;
    所述TCP客户端确定按照所述token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送报文。The TCP client determines whether the number of tokens obtained according to the growth rate of the number of tokens reaches a preset value, and if so, sends a message.
  9. 根据权利要求8所述的报文发送方法,其特征在于,所述方法还包括:The method for transmitting a message according to claim 8, wherein the method further comprises:
    所述TCP客户端设置发送定时器并启动所述发送定时器; Setting, by the TCP client, a sending timer and starting the sending timer;
    当所述发送定时器定时达到预置时长时,则执行所述确定按照所述token数目增长速率获得的token的数目是否达到预置数值的步骤。When the sending timer reaches the preset duration, the step of determining whether the number of tokens obtained according to the token number increasing rate reaches a preset value is performed.
  10. 根据权利要求8或9中任一项所述的报文发送方法,其特征在于,所述方法还包括:The method for transmitting a message according to any one of claims 8 to 9, wherein the method further comprises:
    所述TCP客户端设置token资源队列以及所述token资源队列的最大深度,所述token资源队列用于存放所述token,所述最大深度用于指示所述token资源队列能存放的所述token的最大数。The TCP client sets a token resource queue and a maximum depth of the token resource queue, the token resource queue is used to store the token, and the maximum depth is used to indicate that the token resource queue can be stored by the token. The maximum number.
  11. 一种TCP代理,其特征在于,包括:A TCP proxy, comprising:
    发送模块,用于向TCP客户端发送M个报文;a sending module, configured to send M packets to the TCP client;
    接收模块,用于接收所述TCP客户端发送的所述M个报文的N个TCP响应报文;a receiving module, configured to receive N TCP response messages of the M packets sent by the TCP client;
    处理模块,用于根据所述接收模块接收的每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接的样本传输带宽,所述样本TCP响应报文为所述N个TCP响应报文中的至少一个,根据所述样本传输带宽确定估算带宽样本集,所述估算带宽样本集包括根据每个所述样本TCP响应报文计算得到的样本传输带宽,根据所述估算带宽样本集确定估算带宽,根据所述估算带宽确定目标带宽,根据所述目标带宽确定可用令牌token数,根据所述可用token数控制报文的发送。a processing module, configured to calculate, according to each sample TCP response message received by the receiving module, a sample transmission bandwidth of a TCP connection between the TCP proxy and the TCP client, where the sample TCP response packet is Determining, according to the sample transmission bandwidth, an estimated bandwidth sample set, where the estimated bandwidth sample set includes a sample transmission bandwidth calculated according to each of the sample TCP response messages, according to the at least one of the N TCP response messages, The estimated bandwidth sample set determines an estimated bandwidth, determines a target bandwidth according to the estimated bandwidth, determines an available token token number according to the target bandwidth, and controls transmission of the packet according to the available token number.
  12. 根据权利要求11所述的TCP代理,其特征在于,所述处理模块用于:The TCP proxy according to claim 11, wherein the processing module is configured to:
    根据所述目标带宽设置token数目增长速率;Setting a token growth rate according to the target bandwidth;
    确定按照所述token数目增长速率获得的token的数目是否达到预置数值;Determining whether the number of tokens obtained according to the growth rate of the number of tokens reaches a preset value;
    所述发送模块,用于若所述处理模块确定按照所述token数目增长速率获得的token的数目达到预置数值,则向所述TCP客户端发送所述报文。The sending module is configured to send the message to the TCP client if the processing module determines that the number of tokens obtained according to the rate of increase of the token reaches a preset value.
  13. 根据权利要求11所述的TCP代理,其特征在于,所述发送模块用于:The TCP proxy according to claim 11, wherein the sending module is configured to:
    将所述目标带宽发送至所述TCP客户端,以使得所述TCP客户端根据所述目标带宽设置token数目增长速率,并确定按照所述token数目增长速率获得的token的数目是否达到预置数值,若达到,则发送所述报文。Sending the target bandwidth to the TCP client, so that the TCP client sets a token growth 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. If yes, the message is sent.
  14. 根据权利要求12所述的TCP代理,其特征在于,所述处理模块用于: The TCP proxy according to claim 12, wherein the processing module is configured to:
    设置发送定时器并启动所述发送定时器;Setting a sending timer and starting the sending timer;
    当所述发送定时器定时达到预置时长时,则确定按照所述token数目增长速率获得的token的数目是否达到预置数值。When the sending timer reaches the preset duration, it is determined whether the number of tokens obtained according to the token number increasing rate reaches a preset value.
  15. 根据权利要求14所述的TCP代理,其特征在于,所述处理模块用于:The TCP proxy according to claim 14, wherein the processing module is configured to:
    设置token资源队列以及所述token资源队列的最大深度,所述token资源队列用于存放按照所述token数目增长速率获得的token,所述最大深度用于指示所述token资源队列能存放的按照所述token数目增长速率获得的token的最大数。Setting a token resource queue and a maximum depth of the token resource queue, where the token resource queue is used to store a token obtained according to the growth rate of the token number, where the maximum depth is used to indicate that the token resource queue can be stored according to the The maximum number of tokens obtained by increasing the number of tokens.
  16. 根据权利要求15所述的TCP代理,其特征在于,所述处理模块用于:The TCP proxy according to claim 15, wherein said processing module is configured to:
    对于每个样本TCP响应报文,根据所述样本TCP响应报文对应的报文的发送时间、所述样本TCP响应报文的接收时间,以及所述样本TCP响应报文对应的报文的长度计算所述TCP连接的样本传输带宽。For each sample TCP response message, according to the sending time of the packet corresponding to the sample TCP response message, the receiving time of the sample TCP response message, and the length of the packet corresponding to the sample TCP response message. Calculating the sample transmission bandwidth of the TCP connection.
  17. 根据权利要求16所述的TCP代理,其特征在于,所述处理模块用于:The TCP proxy according to claim 16, wherein the processing module is configured to:
    获取策略配置信息,所述策略配置信息包括所述目标带宽的调整比例与业务类型的对应关系;Obtaining policy configuration information, where the policy configuration information includes a correspondence between the adjustment ratio of the target bandwidth and a service type;
    根据所述估算带宽、所述TCP连接对应的业务类型以及所述策略配置信息确定所述目标带宽。Determining the target bandwidth according to the estimated bandwidth, a service type corresponding to the TCP connection, and the policy configuration information.
  18. 一种TCP客户端,其特征在于,包括:A TCP client, comprising:
    接收模块,用于接收TCP代理发送的目标带宽,所述目标带宽由所述TCP代理根据估算带宽确定,所述估算带宽由所述TCP代理根据估算带宽样本集确定,所述估算带宽样本集由所述TCP代理根据样本传输带宽确定,所述样本传输带宽由所述TCP代理根据每个样本TCP响应报文计算所述TCP代理和所述TCP客户端之间的TCP连接得到,所述样本TCP响应报文为N个TCP响应报文中的至少一个,所述N个TCP响应报文为所述TCP客户端接收到所述TCP代理发送的M个报文后反馈至所述TCP代理的报文;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, where the estimated bandwidth is determined by the TCP proxy according to an estimated bandwidth sample set, where the estimated bandwidth sample set is determined by Determining, by the TCP proxy, that the sample transmission bandwidth is obtained by the TCP proxy according to each sample TCP response message, and calculating a TCP connection between the TCP proxy and the TCP client, where the sample TCP is obtained. The response message is at least one of the N TCP response messages, and the N TCP response messages are sent back to the TCP proxy by the TCP client after receiving the M messages sent by the TCP proxy. Text
    处理模块,用于根据所述目标带宽设置token数目增长速率,确定按照所述token数目增长速率获得的token的数目是否达到预置数值;a processing module, configured to set a token growth rate according to the target bandwidth, and determine whether the number of tokens obtained according to the growth rate of the number of tokens reaches a preset value;
    发送模块,用于若所述处理模块确定按照所述token数目增长速率获得的 token的数目达到预置数值,则发送所述报文。a sending module, if the processing module determines that the rate is increased according to the number of tokens The number of tokens reaches a preset value, and the message is sent.
  19. 根据权利要求18所述的TCP客户端,其特征在于,所述处理模块用于:The TCP client according to claim 18, wherein the processing module is configured to:
    设置发送定时器并启动所述发送定时器;Setting a sending timer and starting the sending timer;
    当所述发送定时器定时达到预置时长时,则确定按照所述token数目增长速率获得的token的数目是否达到预置数值。When the sending timer reaches the preset duration, it is determined whether the number of tokens obtained according to the token number increasing rate reaches a preset value.
  20. 根据权利要求18或19所述的TCP客户端,其特征在于,所述处理模块用于:The TCP client according to claim 18 or 19, wherein the processing module is configured to:
    设置token资源队列以及所述token资源队列的最大深度,所述token资源队列用于存放按照所述token数目增长速率获得的token,所述最大深度用于指示所述token资源队列能存放的按照所述token数目增长速率获得的token的最大数。 Setting a token resource queue and a maximum depth of the token resource queue, where the token resource queue is used to store a token obtained according to the growth rate of the token number, where the maximum depth is used to indicate that the token resource queue can be stored according to the The maximum number of tokens obtained by increasing the number of tokens.
PCT/CN2016/111079 2015-12-30 2016-12-20 Packet sending method, tcp proxy, and tcp client WO2017114231A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

Publication Number Publication Date
WO2017114231A1 true WO2017114231A1 (en) 2017-07-06

Family

ID=59225630

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/111079 WO2017114231A1 (en) 2015-12-30 2016-12-20 Packet sending method, tcp proxy, and tcp client

Country Status (2)

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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109245981A (en) * 2018-10-25 2019-01-18 浙江中控技术股份有限公司 A kind of dispatching method and system of field bus communication
CN113821410A (en) * 2021-09-23 2021-12-21 新华三信息安全技术有限公司 Log processing method and device
CN114157727A (en) * 2021-12-10 2022-03-08 北京华环电子股份有限公司 Application method and device of TCP acceleration in OSU
CN114173428A (en) * 2021-10-21 2022-03-11 北京连山科技股份有限公司 Method for improving data transmission speed of multilink equipment

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1518285A (en) * 2003-01-16 2004-08-04 华为技术有限公司 A network bandwidth detection method for streaming media service
CN101075918A (en) * 2006-05-15 2007-11-21 中兴通讯股份有限公司 Method for inspecting network band width
CN101873634A (en) * 2010-06-18 2010-10-27 杭州华三通信技术有限公司 Method and device for scheduling bandwidth on WLAN basis
US20140269292A1 (en) * 2013-03-14 2014-09-18 Vivint, Inc. Dynamic adjustment of quality of service parameters

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070104132A1 (en) * 2005-11-07 2007-05-10 Bala Rajagopalan Techniques capable of providing efficient scheduling of packet data traffic in wireless data networks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1518285A (en) * 2003-01-16 2004-08-04 华为技术有限公司 A network bandwidth detection method for streaming media service
CN101075918A (en) * 2006-05-15 2007-11-21 中兴通讯股份有限公司 Method for inspecting network band width
CN101873634A (en) * 2010-06-18 2010-10-27 杭州华三通信技术有限公司 Method and device for scheduling bandwidth on WLAN basis
US20140269292A1 (en) * 2013-03-14 2014-09-18 Vivint, Inc. Dynamic adjustment of quality of service parameters

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109245981A (en) * 2018-10-25 2019-01-18 浙江中控技术股份有限公司 A kind of dispatching method and system of field bus communication
CN109245981B (en) * 2018-10-25 2021-06-22 浙江中控技术股份有限公司 Scheduling method and system for field bus communication
CN113821410A (en) * 2021-09-23 2021-12-21 新华三信息安全技术有限公司 Log processing method and device
CN114173428A (en) * 2021-10-21 2022-03-11 北京连山科技股份有限公司 Method for improving data transmission speed of multilink equipment
CN114157727A (en) * 2021-12-10 2022-03-08 北京华环电子股份有限公司 Application method and device of TCP acceleration in OSU
CN114157727B (en) * 2021-12-10 2024-05-14 北京华环电子股份有限公司 Application method and device of TCP acceleration in OSU

Also Published As

Publication number Publication date
CN106936730B (en) 2020-04-03
CN106936730A (en) 2017-07-07

Similar Documents

Publication Publication Date Title
WO2017114231A1 (en) Packet sending method, tcp proxy, and tcp client
US10367922B2 (en) Method and apparatus for sending transmission control protocol TCP data packet and system
EP3780542B1 (en) Data transmission method and device
CN112104562B (en) Congestion control method and device, communication network and computer storage medium
EP3525406A1 (en) Method and apparatus for determining tcp congestion window
KR102187810B1 (en) Apparatus and method for controlling data flow in a communication system
CN106612284B (en) Streaming data transmission method and device
US20050213507A1 (en) Dynamically provisioning computer system resources
EP2992648A1 (en) Rate control
JP2016527579A (en) Data communication system and method
CN111372283B (en) Congestion control method and base station, user plane functional entity
WO2021008562A1 (en) Flow rate control method and apparatus
US10868839B2 (en) Method and system for upload optimization
WO2024113459A1 (en) Double unidirectional optical gate system based data transmission methods and apparatuses, device and medium
CN117813595A (en) Apparatus and method for remote direct memory access
EP1395000A1 (en) A method of transmitting data streams dependent on the monitored state of the client application buffer
CN117135117A (en) Near-end control-based cross-data center RDMA network congestion control method and device
CN108370327A (en) More truck data stream regulating systems and method
WO2014000467A1 (en) Method for adjusting bandwidth in network virtualization system
CN112887218A (en) Message forwarding method and device
US20060209687A1 (en) Communication rate control method and device
KR101609922B1 (en) Apparatus and method for peer-to-peer based data trasnfer
Ku et al. Improving end-to-end performance by active queue management
Khademi et al. Improving the Fairness of Alternative Backoff with ECN (ABE)
Kim et al. TCP acknowledgement compression for fairness among uplink TCP flows in IEEE 802.11 n WLANs

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

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

Country of ref document: EP

Kind code of ref document: A1