RE: SUMMARY:RE: TCP_keepalive

From: Rich Bonfoey (Rich.Bonfoey_at_thenewstribune.com)
Date: 04/04/05

  • Next message: Z H: "summary:problem with npasswd program"
    To: "'Sun Managers (sunmanagers@sunmanagers.org)'" <sunmanagers@sunmanagers.org>
    Date: Mon, 4 Apr 2005 10:04:43 -0700 
    
    

    Apologies , fat finger does it again. Here are Eric and Sam's replies

    Eric's:

    We had to tweak around with the keepalive here.

    Typically, short keepalive values are good for web servers in example (lots
    of short and unreliable connections). Obvisouly long keepalive are good for
    long term connections such as applications having a connection to a
    database...

    We had to shorten this value and the "time wait" one because we had lots of
    open unused client sockets which were left open, consuming resources.

    But there is something: the keep alive parameter on the server will only be
    taken into account if "keep alive" is specified in the options when
    creating a TCP socket. For example, it will have no effect if a client
    application doesn't explicitely set the keep alive flag when connecting to
    a server...

    You might want to have a look at the "tcp_time_wait_interval" parameter as
    well...

    Sam's :

    I'm a sysadmin at an ISP in the UK - as such I deal with many busy
    machines in a production environment. In my experience you don't want to
    go lower than 60000ms (even on an extremely busy machine) with
    tcp_keepalive. I usually dump into /etc/rc2.d in this simple script on
    my boxes as a baseline to work with:

    #!/bin/sh
    # --------------------------------------------------------------- #
    #
    # S70stacktune 0.13
    # 23/09/2004 Sam Nelson <sam@unix.ms>
    # Script to tune and sanitise the TCP stack on busy Solaris boxes.
    #

    UREVISION=`uname -r`

    fill () {
    awk '{leninput=length($($NF)); fill=63-leninput ; for (i=1; i< fill;
    i++) fillchar=fillchar"." ; printf $($NF) fillchar}'
    }

    setparams () {
    VAL=`/usr/sbin/ndd -set $1 $2 $3`
    printf "Value of $1 $2 is: " | fill
    printf " ${VAL} ($3)\n"
    }

    # Decrease the tcp time wait interval
    if [ ${UREVISION} = "5.6" ]; then
    printf "Decrease the tcp time wait interval\n"
       setparams /dev/tcp tcp_close_wait_interval 60000
    else
    printf "Decrease the tcp time wait interval\n"
       setparams /dev/tcp tcp_time_wait_interval 60000
    fi

    # Speed up the flushing of half-closed connection in state FIN_WAIT_2
    printf "Flushing of half-closed connection in state FIN_WAIT_2\n"
    setparams /dev/tcp tcp_fin_wait_2_flush_interval 67500ms

    # Increase the receive and transmit window sizes
    printf "Increase the receive and transmit window sizes\n"
    setparams /dev/tcp tcp_xmit_hiwat 65535
    setparams /dev/tcp tcp_recv_hiwat 65535

    # decrease the retransmit interval
    printf "Decrease the retransmit interval\n"
    setparams /dev/tcp tcp_rexmit_interval_max 60000ms

    # increase number of half-open connections
    printf "Increase number of half-open connections\n"
    setparams /dev/tcp tcp_conn_req_max_q0 4096

    # increase number of simultaneous connections
    printf "Increase number of simultaneous connections\n"
    setparams /dev/tcp tcp_conn_req_max_q 1024

    # Decrease TCP connection abort interval
    printf "Decrease TCP connection abort interval\n"
    setparams /dev/tcp tcp_ip_abort_interval 60000

    # Decrease TCP Keepalive Interval
    printf "Decrease TCP Keepalive Interval\n"
    setparams /dev/tcp tcp_keepalive_interval 60000

    printf "Ok, tuning complete\n"
    -------------------------------------------------------

    This usually does the trick.

    Hope this helps, and please summarise!

    Regards

    Sam

    -----Original Message-----
    From: Rich Bonfoey
    Sent: Friday, April 01, 2005 11:12 AM
    To: Rich Bonfoey; 'Sun Managers (sunmanagers@sunmanagers.org)'
    Subject: SUMMARY:RE: TCP_keepalive

    Many thanks to Eric Voisard and Sam Nelson for sharing their expertise.
    Eric provided
    insight to another variable tcp_time_wait_interval, that it can have an
    affect on connections. Sam , very graciously provided a script that he
    uses to tune and sanitize the tcp stack

    Below is the original message
    With Eric and Sam's replays

    Thanks again for the info

    Rich

    -----Original Message-----
    From: Rich Bonfoey
    Sent: Thursday, March 31, 2005 9:55 AM
    To: Sun Managers (sunmanagers@sunmanagers.org)
    Subject: TCP_keepalive

    Greetings

    Have any of you, had much dealings with the tcp_keepalive ?

    On Solaris 8 and 9 the value is 7200000 or 2 hours. What are some of the
    pit falls if this value was lowered to about 10 minutes. I have read the
    RFC but was looking for people who have had real experience with tweaking
    this value.

    Part of the reason for tweaking, is we have a large number of PC and OS 10
    users connecting to several different systems and they have been having
    performance issues. Our dba decided to bring in a consultant ( that's
    another story ) and they said this value should be 5 minutes. I am not
    quite buying it, as I have read that there are multiple opinion on the
    correct use of tcp_keepalive.

    Richard Bonfoey
    The News Tribune
    Information Systems
    Successfully Meeting the Business Needs of
    The News Tribune through Information Technology
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Z H: "summary:problem with npasswd program"

    Relevant Pages