From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 3 09:40:14 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 041C716A4CE for ; Wed, 3 Mar 2004 09:40:14 -0800 (PST) Received: from nfluid.plus.com (unknown [62.254.241.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id BDC5743D2D for ; Wed, 3 Mar 2004 09:40:12 -0800 (PST) (envelope-from chris@nfluid.plus.com) Received: from localhost (localhost [[UNIX: localhost]]) by nfluid.plus.com (8.11.6/8.11.2) id i23HgiO02487 for freebsd-hackers@freebsd.org; Wed, 3 Mar 2004 17:42:44 GMT Content-Type: text/plain; charset="us-ascii" From: Chris Smith Organization: netFluid Technology Ltd To: freebsd-hackers@freebsd.org Date: Wed, 3 Mar 2004 17:42:43 +0000 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200403031742.43986.chris@nfluid.co.uk> X-Mailman-Approved-At: Thu, 04 Mar 2004 05:10:48 -0800 Subject: Kernel SysV IPC defaults. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: chris@nfluid.co.uk List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2004 17:40:14 -0000 Hi all. Probably no one has ever noticed, but if you look at the default ipc sett= ings=20 for message queues as defined by default are screwy. (ipcs -T if you want to have a look). Consider MSGMAX (max bytes in a message) and MSGMNB (max bytes in a queu= e) The defaults are MSGMAX > MSGMNB, which is clearly backwards. I forget what the default kernel values actually are as I've recompiled t= he=20 kernel to sort them out for my server, but it's something like MSGMAX =3D= 4096=20 and MSGMNB =3D 2048. I ported my middleware a while ago to freebsd, but it failed to run as it= was=20 trying to put messages of 4096 bytes into a queue that can only contain a= t=20 most 2048 bytes _in total_ for all messages in the queue. Basically it allows someone to put half a message in a queue. Hehe :o) I had to put a kludge in my middleware to use the smaller of MSGMAX and M= SGMNB=20 as the maximum message size - however this is terribly inefficient as it=20 effectively means that you can only have one message in a queue at any on= e=20 time, which defeats the point of having a queue, and makes the middelware= =20 perform extremely poorly. The reason for emailing you is that for all my porting effort, you cannot= use=20 my middleware out-of-the-box on freebsd without a kernel rebuild - which = is a=20 shame, and has put people off. The fix to this is to alter the two defaults in the relevent header file = to=20 more sensible values. I wouldn't advocate making them too big, as it's=20 sensless 'reserving' kernel space for something that is (I admit) rarely = used=20 - but values of msgmax 2048 or 4096 and msgmnb 4096 or 8192 seem sensible= (if=20 msgmnb is at least twice msgmax). If you're going to use the middleware in anger, you'd tune your kernel by= =20 rebuilding anyway - but as it is, users are not getting this far! Regards, Chris --=20 Chris Smith Technical Architect - netFluid Technology Ltd. "Internet Technologies, Distributed Systems and Tuxedo Consultancy" E: chris@nfluid.co.uk W: http://www.nfluid.co.uk