From owner-freebsd-questions Wed Mar 20 8:53:52 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.tiscalinet.it (mail-1.tiscalinet.it [195.130.225.147]) by hub.freebsd.org (Postfix) with ESMTP id 0B3AB37B400 for ; Wed, 20 Mar 2002 08:53:37 -0800 (PST) Received: from [217.133.244.87] (217.133.244.87) by mail.tiscalinet.it (5.5.057) id 3C985B2800022E67 for freebsd-questions@FreeBSD.org; Wed, 20 Mar 2002 17:53:33 +0100 Received: (qmail 2589 invoked by uid 1000); 20 Mar 2002 16:43:29 -0000 Date: Wed, 20 Mar 2002 17:43:29 +0100 From: Francesco Casadei To: Dmitry Mottl Cc: freebsd-questions@FreeBSD.org Subject: Re: mbufs, nmbclusters Message-ID: <20020320174329.E2375@goku.kasby> Mail-Followup-To: Dmitry Mottl , freebsd-questions@FreeBSD.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="3O1VwFp74L81IIeR" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from dima@sinp.msu.ru on Mon, Mar 18, 2002 at 06:14:23PM +0300 X-Operating-System: FreeBSD 4.5-STABLE i386 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --3O1VwFp74L81IIeR Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 18, 2002 at 06:14:23PM +0300, Dmitry Mottl wrote: > Hi >=20 > How can I find which program uses a lot of kernel mbufs and nmbclusters? > Is the maximum number of nmbclusters that can be occupied by program is > N*(net.inet.tcp.sendspace+net.inet.tcp.recvspace)/2048, where N is number > of tcp connections opened by the program? >=20 > Thank you >=20 > Best regards, > Dmitry Mottl >=20 >=20 > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message >=20 > end of the original message =46rom tuning(7) manual page: [...] kern.ipc.nmbclusters may be adjusted to increase the number of network mbufs the system is willing to allocate. Each cluster represents appr= ox=AD imately 2K of memory, so a value of 1024 represents 2M of kernel memory reserved for network buffers. You can do a simple calculation to figu= re out how many you need. If you have a web server which maxes out at 10= 00 simultaneous connections, and each connection eats a 16K receive and 1= 6K send buffer, you need approximate 32MB worth of network buffers to deal with it. A good rule of thumb is to multiply by 2, so 32MBx2 =3D 64MB= /2K =3D 32768. So for this case you would want to set kern.ipc.nmbclusters to 32768. We recommend values between 1024 and 4096 for machines with mo= d=AD erates amount of memory, and between 4096 and 32768 for machines with greater amounts of memory. Under no circumstances should you specify = an arbitrarily high value for this parameter, it could lead to a boot-time crash. The -m option to netstat(1) may be used to observe network clu= s=AD ter use. Older versions of FreeBSD do not have this tunable and requi= re that the kernel config(8) option NMBCLUSTERS be set instead. [...] So I would say yes the number of nmbclusters is: N*(net.inet.tcp.sendspace+net.inet.tcp.recvspace)/2048 Francesco Casadei --=20 You can download my public key from http://digilander.iol.it/fcasadei/ or retrieve it from a keyserver (pgpkeys.mit.edu, wwwkeys.pgp.net, ...) Key fingerprint is: 1671 9A23 ACB4 520A E7EE 00B0 7EC3 375F 164E B17B --3O1VwFp74L81IIeR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE8mLwxfsM3XxZOsXsRAjyVAKCzBGAc9IoumepA1MH7jj4RnLkSAgCdHL4E xtLn6j/TP2dnFG2DYZruBXw= =VpW0 -----END PGP SIGNATURE----- --3O1VwFp74L81IIeR-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message