Date: Sat, 24 Jul 1999 17:05:41 -0500 (CDT) From: Mohit Aron <aron@cs.rice.edu> To: freebsd-net@freebsd.org Subject: FreeBSD tuning for webserver performance Message-ID: <199907242205.RAA03294@cs.rice.edu>
next in thread | raw e-mail | index | archive | help
Hi, during my work on FreeBSD with Webservers, I've come across several minor tuning enhancements that need to be applied to the kernel for efficient performance with Web servers. I'm listing some of them below - perhaps these can be merged with other tuning information that the FreeBSD maintainers might be keeping with FreeBSD. Also I'd appreciate pointers to any other tuning information that people might have. - Mohit Aron aron@cs.rice.edu ------------------------------------------------------------------------------ Tuning FreeBSD-2.2.6 for Webserver Performance 1) Increase TCBHASHSIZE defined in netinet/tcp_subr.c. This speeds up the hash table lookup for a busy webserver that handles a lot of connections (can be as large as 50000 for Apache webserver). The default value of 512 can cause significant lookup delays. I usually increase this value to 16384. 2) Increase IP interface queue size (default 50). It can be changed by recompiling kernel after setting IFQ_MAXLEN in sys/net/if.h. This parameter determines the max number of packets in a burst that can be handled by the webserver. A value of 50 is rather small - SYN packets received from clients connecting simultaneously can overrun the IP queue. I usually increase this value to 1000. 3) Increase maxusers (default 10). This allocates more memory to mbuf pool. This is done in the kernel configuration file. I typically increase this value to 256. 4) Increase the number of connections that can be queued in the listen queue (default 128). This can be done by recompiling kernel after increasing SOMAXCONN in sys/socket.h. The above parameter determines the max number of clients that will be accepted assume they all connect simultaneously. I usually increase this value to 1024. 5) Increase the maximum socket send and receive buffer sizes (default 256K). This can be done by recompiling kernel after setting SB_MAX in sys/socketvar.h. A value of 256K can be short for high bandwidth-delay paths e.g. a 100Mbps link with a 60ms round-trip delay can contain 750K worth of data. Such WAN bandwidths are now becoming available. It might be worthwhile to set SB_MAX to 1024K. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907242205.RAA03294>