Abstract:
Reducing buffer usage for a TCP proxy session between a client and a server by a service gateway includes: determining a first round trip time (RTT) for a server side TCP session and determining a second RTT for a client side TCP session; comparing the first RTT with the second RTT; determining whether the second RTT exceeds the first RTT beyond a threshold; if so, then calculating a desired RTT based on the second RTT; and setting a timer according to the calculated desired RTT, where a TCP acknowledgement for the server side TCP session is delayed until the timer expires. The desired RTT may be calculated as a percentage of the second RTT or as the second RTT minus a predetermined value. The service gateway waits until the timer has expired before sending a TCP acknowledgement data packet to the server.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is a continuation of U.S. patent application Ser. No. 13/747,545, filed Jan. 23, 2013 and entitled “Reducing Buffer Usage for TCP Proxy Session Based on Delayed Acknowledgement,” issued Dec. 27, 2016 as U.S. Pat. No. 9,531,846. The disclosure of the above reference application is hereby incorporated by reference herein. 
     
    
     FIELD 
       [0002]    The present invention relates generally to data communications, and more specifically, to a service gateway. 
       BACKGROUND 
       [0003]    Many service gateways such as firewalls and server load balancers provide Transmission Control Protocol (TCP) proxy functionality for some time. Typical service applications of TCP proxy include network analysis, security, and traffic adaptation due to asymmetric client and server condition. A TCP proxy server typically allocates an amount of memory buffer to handle the data packet buffering of a TCP proxy session between a client device and a server. The memory buffer is used to handle data packet buffers for client side session and server side session. The allocation of memory space among the client side session send and receive buffers, and server side session send and receive buffers does not often take performance into consideration. A TCP proxy server receives a data packet from the server side session, processes the data packet according to the necessary service applications, and transmits the resulting data packet to the client side session. In an ideal scenario, these steps are completed before the next data packet from the server side session is delivered to the TCP proxy server. However, in many deployed situations, client devices access services through mobile broadband access or residual Internet access where such access has a longer transmission time due to long distance wide area network and a slower transmission bandwidth based on subscriber access services. Nevertheless, the TCP proxy server and the servers reside in a same data center, and enjoy short transmission time and high capacity bandwidth. In such deployment scenarios, when the TCP proxy server receives a data packet from the server side session, the received data packet is placed in the server side session receive buffer, and waits for its turn to be processed by the service applications, which in turn waits for the client side session to free up client side session sending buffer, which is filled with pending data packets processed earlier, which in turn are waiting for their turn of transmission due to slow transmission of previously transmitted data packets. 
         [0004]    In a typical situation, the TCP proxy server sends a TCP acknowledgement, according to the TCP protocol, upon successfully receiving appropriate amount of TCP data from the server. When the server receives the TCP acknowledgement of prior transmitted TCP data, the server would send additional TCP data packets to the TCP proxy server. The TCP proxy server would further increase memory space for the server side session receive buffer in order to store the additional TCP data packets, while waiting for the prior TCP data to be processed and sent to the client. The cascading effect causes the TCP proxy server to consume large amount of memory space for the server side session receive buffer necessary to hold the received TCP data packets of the server side session. The more buffer space is used, the less the memory resource becomes available for the TCP proxy server to handle additional TCP proxy sessions; despite the TCP proxy server may have other abundant resources to handle additional load. 
       BRIEF SUMMARY OF THE INVENTION 
       [0005]    According to one embodiment of the present invention, a method for reducing buffer usage for a Transmission Control Protocol (TCP) proxy session between a client and a server, comprising: determining a first round trip time (RTT) for a server side TCP session of the TCP proxy session between a service gateway and the server, and determining a second RTT for a client side TCP session of the TCP proxy session between the service gateway and the client; comparing the first RTT with the second RTT by the service gateway; determining whether the second RTT exceeds the first RTT; in response to determining that the second RTT exceeds the first RTT, calculating by the service gateway a desired RTT based on the second RTT; and setting a timer by the service gateway according to the calculated desired RTT, wherein a TCP acknowledgement for the server side TCP session is delayed until the timer expires. 
         [0006]    In one aspect of the present invention, the determining whether the second RTT exceeds the first RTT and the calculating a desired RTT based on the second RTT comprise: determining whether the second RTT exceeds the first RTT beyond a predetermined threshold; and in response to determining that the second RTT exceeds the first RTT beyond the predetermined threshold, calculating by the service gateway the desired RTT based on the second RTT. 
         [0007]    In one aspect of the present invention, the calculating a desired RTT based on the second RTT comprises: calculating by the service gateway the desired RTT as a percentage of the second RTT. 
         [0008]    In one aspect of the present invention, the calculating a desired RTT based on the second RTT comprises: calculating by the service gateway the desired RTT as the second RTT minus a predetermined value. 
         [0009]    In one aspect of the present invention, the setting a times by the service gateway according to the calculated desired RTT comprises: receiving by the service gateway a data packet from the server over the server side TCP session; determining by the service gateway a need to send the TCP acknowledgement to the server; setting a timer to the desired RTT by the service gateway; and in response to an expiration of the timer, sending the TCP acknowledgement to the server by the service gateway. 
         [0010]    System and computer readable medium corresponding to the above-summarized methods are also described and claimed herein. 
     
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE FIGURES 
         [0011]      FIG. 1  illustrates a service gateway servicing a TCP proxy session between a client device and a server according to an embodiment of the present invention. 
           [0012]      FIG. 1A  illustrates components of a service gateway according to an embodiment of the present invention. 
           [0013]      FIG. 2  illustrates a process to delay sending a TCP ACK packet according to an embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0014]    The present invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment containing both hardware and software elements. In a preferred embodiment, the present invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc. 
         [0015]    Furthermore, the present invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system. For the purposes of this description, a computer-usable or computer readable medium can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. 
         [0016]    The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk-read only memory (CD-ROM), compact disk-read/write (CD-R/W) and DVD. 
         [0017]    A data processing system suitable for storing and/or executing program code will include at least one processor coupled directly or indirectly to memory elements through a system bus. The memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during execution. 
         [0018]    Input/output or I/O devices (including but not limited to keyboards, displays, point devices, etc.) can be coupled to the system either directly or through intervening I/O controllers. 
         [0019]    Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters. 
         [0020]    The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified local function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. 
         [0021]    The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. 
         [0022]    The embodiments of the present invention, as described below, adjusts the server side session transmission time, in order to reduce the buffer usage, which in turn increases the capacity of TCP proxy sessions of a TCP proxy server. According to embodiments of the present invention, a TCP proxy server delays a server from sending the additional TCP data, where the delay allows the TCP proxy server to process and send the current TCP data in the server side session receive buffer to be processed and sent to the client. When the server sends the additional TCP data after a delay, the TCP proxy server would have sufficient space in the server side session receive buffer to receive the additional TCP data. Such a delay lengthens the transmission time for the server side session between the server and the TCP proxy server. 
         [0023]      FIG. 1  illustrates a service gateway  300  servicing a TCP proxy session  400  between a client device  100  and server device  200  via a data network  153  according to an embodiment of the present invention. 
         [0024]    In one embodiment, data network  153  includes an Internet Protocol (IP) network, a corporate data network, a regional corporate data network, an Internet service provider network, a residential data network, a wired network such as Ethernet, a wireless network such as a WiFi network, or a cellular network. In one embodiment, data network  153  resides in a data center, or connects to a network or application network cloud. 
         [0025]    Client device  100  is typically a computing device with network access capabilities. In one embodiment, client device  100  is a workstation, a desktop personal computer or a laptop personal computer, a Personal Data Assistant (PDA), a tablet computing device, a smartphone, or a cellular phone, a set-top box, an Internet media viewer, an Internet media player, a smart sensor, a smart medical device, a net-top box, a networked television set, a networked DVR, a networked Blu-ray player, a networked handheld gaming device, or a media center. 
         [0026]    In one embodiment, client device  100  is a residential broadband gateway, a business Internet gateway, a business Web proxy server, a network customer premise device (CPE), or an Internet access gateway. 
         [0027]    In one embodiment, client device  100  includes a broadband remote access server (BRAS), a Digital Subscriber Line Access Multiplexer (DSLAM), a Cable Modem Terminating System (CMTS), or a service provider access gateway. 
         [0028]    In one embodiment, client device  100  includes a mobile broadband access gateway such as a Gateway GPRS Support Node (GGSN), a Home Agent (HA), or a PDN Gateway (PGW). 
         [0029]    In one embodiment, client device  100  includes a server load balancer, an application delivery controller, a traffic manager, a firewall, a VPN server, a remote access server, or an enterprise or data center access gateway. 
         [0030]    In one embodiment, client device  100  is a device similar to service gateway  300 . 
         [0031]    Client device  100  initiates TCP proxy session  400  towards server  200  via service gateway  300 . 
         [0032]    Server  200  is a computing device typically coupled to a processor and a computer readable medium which stores computer readable program code. Server  200 , with the processor and the computer readable program code, implements functionality of a Web server, a file server, a video server, a database server, an application server, a voice system, a conferencing server, a media gateway, a media center, an application server or a network server providing a TCP-based service or an application service to client device  100  using the TCP proxy session  400 . 
         [0033]    In one embodiment, server  200  is a device similar to service gateway  300 . 
         [0034]    In one embodiment, TCP proxy session  400  includes a HTTP session, a FTP file transfer session, a TCP-based video streaming session, a TCP-based music streaming session, a file download session, a group conferencing session, a database access session, a remote terminal access session, a Telnet session, an e-commerce transaction, a remote procedure call, or a TCP-based network communication session. 
         [0035]    Service gateway  300 , illustrated in  FIG. 1A , is operationally coupled to a processor  310 , a memory module  320 , a network interface module  330 , and a computer readable medium  340 . The computer readable medium  340  stores computer readable program code, which when executed by the processor  310  using the memory module  320 , implements the various embodiments of the present invention as described herein. In some embodiments, service gateway  300  is implemented as a server load balancer, an application delivery controller, a service delivery platform, a traffic manager, a security gateway, a component of a firewall system, a component of a virtual private network (VPN), a load balancer for video servers, a gateway to distribute load to one or more servers, a Web or HTTP server, a network address translation (NAT) gateway, or a TCP proxy server. 
         [0036]    In one embodiment, computer readable medium  340  includes instructions for a service application  350  and processor  310  executes service application  350 . 
         [0037]    In one embodiment, service application  350  implements functionality of a VPN firewall, a gateway security application, a HTTP proxy, a TCP-based audio or video streaming session proxy, a Web session proxy, content filtering, server load balancing, firewall, or a network application session proxy. 
         [0038]    Returning to  FIG. 1 , in one embodiment of servicing TCP proxy session  400  between client device  100  and server  200 , service gateway  300  establishes a client side TCP session  420  with client device  100 , and a server side TCP session  470  with server  200 . 
         [0039]    In one embodiment, service gateway  300  allocates a receive buffer  474  for server side TCP session  470 . In one embodiment, receive buffer  474  resides in memory module  320 . 
         [0040]    In one embodiment, service gateway  300  monitors performance of server side TCP session  470  using round trip time (RTT)  497  of server side TCP session  470 . Service gateway  300  measures or estimates RTT  497  for server side TCP session  470 . In one example embodiment, service gateway  300  measures RTT  497  based on a time duration between a time service gateway  300  sends a data packet of server side TCP session  470  to server  200  and a time service gateway  300  receives an acknowledgement for the sent data packet. In one embodiment, service gateway  300  measures RTT  497  periodically or occasionally during server side TCP session  470 . In one embodiment, service gateway  300  estimates RTT  497  based on one or more prior server side TCP sessions with server  200 . In one embodiment, service gateway  300  estimates RTT  497  to be 10 milliseconds, 100 milliseconds, 3 milliseconds, 22 milliseconds, or 3 seconds. 
         [0041]    In one embodiment, service gateway  300  retrieves data from receive buffer  474 , processes the data by, in one embodiment, service application  350 , and transmits the processed data to client device  100  through client side TCP session  420 . In one embodiment, service gateway  300  processes data from receive buffer  474  whenever client side TCP session  420  is ready for transmission. A slow transmission of client side TCP session  420  causes delay for service gateway  300  to process data from receive buffer  474 . In one embodiment, service gateway  300  monitors performance of client side TCP session  420  using round trip time (RTT)  492  of client side TCP session  420 . Service gateway  300  measures or estimates RTT  492  for client side TCP session  420 . In one example embodiment, service gateway  300  measures RTT  492  based on a time duration between a time service gateway  300  sends a data packet of client side TCP session  420  to client device  100  and a time service gateway  300  receives an acknowledgement for the sent data packet. In one embodiment, service gateway  300  measures RTT  492  periodically or occasionally during client side TCP session  420 . In one embodiment, service gateway  300  estimates RTT  492  based on one or more prior client side TCP sessions with client device  100 . In one embodiment, service gateway  300  estimates RTT  492  to be 10 milliseconds, 100 milliseconds, 3 milliseconds, 22 milliseconds, or 3 seconds. 
         [0042]    In one embodiment, service gateway  300  compares RTT  497  with RTT  492 . In one embodiment, when service gateway  300  determines RTT  492  exceeds RTT  497  beyond a certain threshold, service gateway  300  applies a processing, described further below, in order to adjust RTT  497  to narrow the gap between RTT  492  and RTT  497 . In one embodiment, RTT  492  is determined to exceed RTT  497  beyond the threshold when RTT  492  is at least 2 times higher than RTT  497 , 5 times higher, or 10 times higher; or when RTT  492  is at least larger than RTT  497  by a predetermined amount such as 20 milliseconds, 50 milliseconds, or 200 milliseconds. 
         [0043]    In one embodiment, service gateway  300  determines RTT  492  does not exceed RTT  497  beyond the threshold, and service gateway  300  does not adjust RTT  497 . 
         [0044]    In one embodiment, service gateway  300  measures RTT  492  and RTT  497  regularly or occasionally, and compares RTT  492  with RTT  497 . 
         [0045]      FIG. 2  illustrates a process for adjusting RTT  497  for server side TCP session  470  according to an embodiment of the present invention. In one embodiment, service gateway  300  receives data packet  480  over server side TCP session  470  from server  200 . Service gateway  300  stores data packet  480  into receive buffer  474 . In one embodiment, service gateway  300  determines from receive buffer  474  a need to send a TCP acknowledge (i.e., TCP ACK data packet  479 ) per TCP protocol. Instead of sending TCP ACK data packet  479  immediately, service gateway  300  schedules to send TCP ACK data packet  479  at a later time, using timer  487 . Service gateway  300  sets timer  487  to a desired RTT  498 . When timer  487  expires, service gateway  300  sends TCP ACK data packet  479 . In one embodiment, service gateway  300  includes a clock (not shown) which allows service gateway  300  to determine if timer  487  expires. 
         [0046]    In one embodiment, service gateway  300  calculates desired RTT  498  based on RTT  492 . In one embodiment, desired RTT  498  is computed to within a substantial range of RTT  492 . For example, desired RTT  498  is computed as a predetermined percentage of RTT  492 , such as 30%, 40%, 60% or 75% of RTT  492 . In one embodiment, desired RTT  498  is computed to RTT  492  minus a predetermined value, such as 10 millisecond, 5 milliseconds, or 25 milliseconds. Desired RTT  498  provides a timed delay of sending TCP Acknowledgement for server side TCP session  470  and thus increases round trip time of server side TCP session  470 . When service gateway  300  measures RTT  497  as illustrated in  FIG. 1  after sending TCP ACK data packet  479 , RTT  497  is expected have a value similar to desired RTT  498 . 
         [0047]    In one embodiment, service gateway  300  performs the process of measuring RTT  497 , RTT  492 , comparing RTT  492  to RTT  497 , and processing steps in  FIG. 2  when service gateway  300  determines RTT  492  is substantially larger than RTT  497 , in order to reduce the memory capacity of receive buffer  474 , which in turn increases the capability for service gateway  300  to process additional TCP proxy sessions. 
         [0048]    In one embodiment, the predetermined percentage or predetermined value of RTT  492  is determined by a user through experiments using various percentages and values for different TCP proxy sessions for different clients and servers. Typically, the smaller the difference between RTT  492  and RTT  497 , the smaller the memory capacity of receive buffer  474  is necessary. In one embodiment, the user configures a desired RTT  498  so as to reduce the difference between RTT  497  and RTT  492 . In one embodiment, the predetermined percentage is between 30% and 50%, and is configured by a user to the service gateway  300 . The user may configure a higher value for the predetermined percentage or desired RTT  498  for smaller receive buffer  474  capacity, and configure a smaller value for the predetermined percentage or desired RTT  498  for larger receive buffer  474  capacity. The user may consider a predetermined percentage or predetermined value in order to balance between the receive buffer  474  capacity and the desired RTT  498 . 
         [0049]    Although the present invention has been described in accordance with the embodiments shown, one of ordinary skill in the art will readily recognize that there could be variations to the embodiments and those variations would be within the spirit and scope of the present invention. Accordingly, many modifications may be made by one of ordinary skill in the art without departing from the spirit and scope of the appended claims.