Socket connections in TIME_WAIT and apache MaxClients setting

From: Lumpkin, Buddy (Buddy.Lumpkin_at_nordstrom.com)
Date: 01/09/04

  • Next message: Nguyen, David M: "Sendmail problem"
    Date: Fri, 9 Jan 2004 12:56:51 -0800
    To: <sunmanagers@sunmanagers.org>
    
    

    Hello All,

    I was wondering if TCP socket connections to port 80 on an apache web
    servers that show up in TIME_WAIT status count against the total number
    of concurrent connections to the web server?

    Last weekend I was called because a two web servers load balanced behind
    BigIP were not responding to connections. I tried telnetting to port 80
    on the localhost on each system, and it was not connected or rejected,
    simply hung waiting for a connection. I noted that a wc -l of socket
    connections to port 80 (netstat -n) was 255 or 256 (can't remember), and
    that many of them were in TIME_WAIT status. It just so happens that I
    have MaxClients set to 256 in httpd.conf.

    I have since dropped the tcp_time_wait_interval, and the ratio of
    TIME_WAIT to ESTABLISHED from netstat -n has improved considereably, I
    just want clarification as to exactly how the socket closes at the
    berkeley sockets level.

    Lets say there is a TCP socket connection established to port 80 on a
    web server (listen followed by accept I believe), then the client does a
    send or sendto() with a buffer of "get / http/1.1\n\n", I would expect
    apache to reply with a page, then close the socket descriptor at its end
    (FIN). I believe the TIME_WAIT happens when the client doesn't close the
    socket at it's end (FIN/ACK) correct?.

    If apache has issued a close() on the socket descriptor, shouldn't it
    regain that socket for use at the user sockets library level, even
    though the socket is still in TIME_WAIT?

    Im trying to figure out if it was just coincedence that the total number
    of connections to port 80 were 256, or if the web server could not serve
    pages any more because the socket connections in TIME_WAIT were counting
    toward the maximum allowable connections to the server.

    Also, there seemed to be some sort of global anomoly on this application
    because I had to restart the J2EE application servers that communicate
    with apache via mod_jk (I would not expect this, normally you can
    restart one independent of the other), and some stand alone java
    applications on the servers as well.

    So to summarize the question another way, if netstat -n show this:

    192.168.9.60.80 192.168.9.18.58168 16868 0 24616 0
    TIME_WAIT

    192.168.9.60.80 192.168.9.17.32849 16868 0 24616 0
    TIME_WAIT

    192.168.9.60.80 192.168.44.63.4800 64240 0 24820 0
    ESTABLISHED

    192.168.9.60.80 192.168.44.63.4801 62919 0 24820 0
    ESTABLISHED

    192.168.9.60.80 192.168.9.18.58185 16868 0 24616 0
    TIME_WAIT

    192.168.9.60.80 192.168.9.17.32880 16868 0 24616 0
    TIME_WAIT

    192.168.9.60.80 192.168.204.113.3116 63188 0 24820 0
    ESTABLISHED

    192.168.9.60.80 192.168.204.113.3117 64233 0 24820 0
    ESTABLISHED

    If the MaxClients setting in apache were set to 8, would new connections
    block, or would they block once the "ESTABLISHED" connections reached a
    total of 8?

    I will summarize,

    --Buddy
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Nguyen, David M: "Sendmail problem"

    Relevant Pages

    • Establishing a p2p connection in python
      ... programming PHP on a webdeveloper basis. ... I thought that one approach could be to write a small server for my ... users and establishing p2p connections on demand. ... It would seem like the socket ...
      (comp.lang.python)
    • Re: NLB Cluster, service restart and persistant socket connection
      ... MVP - Windows Server - Clustering ... opening a persistent socket client to another server. ... incoming socket connections are coming in ...
      (microsoft.public.windows.server.clustering)
    • Re: receiving data over socket
      ... I want to print the data the server received. ... anyone can recommend a good VB2005 book that deals with socket programming I ... if your server needs to support multiple connections ... You aren't guarenteed to recieve all your data ...
      (microsoft.public.dotnet.languages.vb)
    • Re: MSDN Using Asynchronous Server Socket ?
      ... I properly shutdown the socket after receiving the message. ... The problem is in your server code that handles the active connection. ... framework doesn't handle a lot of "idle" connections very well. ... client disconnects, do you shutdown and then close the client socket? ...
      (microsoft.public.dotnet.framework)
    • Re: closing a server socket
      ... When the server is threaded, it should be designed accordingly; ... > connections on it! ... sock.accepton the same socket sock. ... On _your_ platform, no doubt. ...
      (comp.lang.python)

    Loading