> > Hello all, THis is a bit off topic, but sure this is a good place to > > ask this question. > > Yeah. We have nothing better to do anyway, iptables is already perfect! > > > I'm sitting here getting frustrated on how to get my http > > server tuned for a large connection load. > > > > I have a server performace problems after about 50 TIME_WAITs show up in > > my connection table. > > > > My question is what's significant about 50? > > Probably nothing. You most likely have a general performance problem > with the server you are using, and the 50 TIME_WAITs are just a coincidence. > > In general, if you have 'N' TIME_WAIT connections, given 60 seconds for > the normal TIME_WAIT state, you have 60/N connections per second. This > is about the only sensible thing counting TIME_WAITs can tell you. > > So don't waste your time with them: look at your application, and where > it spends its time waiting / why it does not handle new connections. > The best tool for this is understanding the application. The second > best tool is strace.
I've tested an profiled my application and it is spending most of it's time in accept. I just don't understand it. I will serve up to 50 connections perfectly and then it will hang for a few seconds, sitting in accept, and then serve 3 requests, then hang for a few seconds in accept, then serve 3 request, then hang ... Here is the strace for the socket bind and listen... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_IGN}, 8) = 0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(3, {sin_family=AF_INET, sin_port=htons(8000), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0 listen(3, 50) = 0 accept(3, Then a request... {sin_family=AF_INET, sin_port=htons(35186), sin_addr=inet_addr("127.0.0.1")}}, [16]) = 4 socket(PF_UNIX, SOCK_STREAM, 0) = 7 connect(7, {sin_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) = -1 ENOENT (No such file or directory) shutdown(4, 1 /* send */) = 0 accept(3, Anyone see anything strange here?