On Sat, Jan 23, 2010 at 4:20 AM, Willy Tarreau <[email protected]> wrote: > Hi, > > On Thu, Jan 21, 2010 at 05:01:24PM +0800, Delta Yeh wrote: >> Hi, >> I use nginx + haproxy , in one box , to load balance 4 web server. >> The load is about 5000 request/second for haproxy. >> Sometimes there is tcp port is not available error. > > This is not normal. This probably means that your TCP stack is not > correctly tuned. TCP allows you to have up to 64k source ports to > establish an outgoing connection. I think you're far below that at > 5k requests/s. Also, recent versions of haproxy let you use one > full source port range per server. This was needed because some > people on the list run with 150k concurrent connections ;-) > >> Does haproxy support listening on unix domain socket, so ,in theory, we >> won't have such error again? > > It does only for the stats right now, but it should be fairly easy > to enable this for HTTP too. I wanted to extend the "bind" statement > to support unix-domain socket paths, but this remained very low in > my priority list. I know that David Birdsong (CCed) was interested > in this too, though I don't know if he had any time to look at that.
I would also love this option, but having little c/c++ experience I've not made much progress. > >> And does anyone compare local loop tcp connection against unix socket under >> linux? > > What do you mean precisely ? The only real advantage I see to unix > sockets right now is that they don't require IP:ports, which make it > possible to chain multiple components more easily, without having to > worry about what port may be used. Also, unix sockets do not support > splicing under linux, which means that we can't use kernel zero-copy > optimizations to forward data, and we must copy it ourselves using > the standard recv/send() method. > > If you want to release your TCP source ports faster, you can also > enable the "nolinger" option on the server side (so in the backend > only and not in the frontend nor the defaults section). > > Regards, > Willy > >

