From owner-freebsd-net Sat Jul 24 15: 7: 7 1999 Delivered-To: freebsd-net@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id 3666F14C13 for ; Sat, 24 Jul 1999 15:07:04 -0700 (PDT) (envelope-from aron@cs.rice.edu) Received: (from aron@localhost) by cs.rice.edu (8.9.0/8.9.0) id RAA03294 for freebsd-net@freebsd.org; Sat, 24 Jul 1999 17:05:41 -0500 (CDT) From: Mohit Aron Message-Id: <199907242205.RAA03294@cs.rice.edu> Subject: FreeBSD tuning for webserver performance To: freebsd-net@freebsd.org Date: Sat, 24 Jul 1999 17:05:41 -0500 (CDT) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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