sbwait state for loaded Apache server

Michael Conlen meconlen at
Tue Jul 22 09:49:12 PDT 2003

I'm working with an Apache webserver running 1400 apache processes and 
the system pusing somewhere in the area of 50-60Mbit/sec sustained. The 
system seems to top out around 60Mbit/sec and I see some minor 
degradation of server response times. The server response times are 
generally very very stable otherwise. Most of the apache processes are 
in the sbwait state. I've got 4Gig of memory, so I can play with some of 
the values (nmbclusters has been turned up and I never see delayed or 
dropped requests for mbufs).

I don't see in my old Design & Implementation of 4.4BSD (Red Book?) much 
about the state, and I don't a copy of TCP/IP Illustrated 2 handy these 
days, but if memory serves sbwait is waiting on a socket buffer 
resource. My guess is that these are processes waiting on the send 
buffer to drain.

$ netstat -an | egrep '[0-9]  3[0-9]{4}' | wc -l

seems to indicate that I've got a lot of processes waiting to drain. 
Looking at the actual output it shows most of these are ESTABLISHED.

So my thought is by increasing the send queue size I could reduce this. 
I've got a pretty good idea on the size of the files being sent and my 
thoughts were to increase the send-q size to where Apache can write() 
the file and go to the keep alive state quickly instead of waiting. So 
the questions are

Would this affect actual network performance
Would this reduce load on the machine (a handy thing to do, but secondary)
given c = number of connections and q = queue adjustment and s = size of 
mbuf do I just need to make sure I have (c*q)/s buffers available, and 
any fudge?
How do I know when I need to increase the overall system buffer size 
beyond 200 MB?

Michael Conlen

More information about the freebsd-performance mailing list