Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2004 17:42:43 +0000
From:      Chris Smith <chris@nfluid.co.uk>
To:        freebsd-hackers@freebsd.org
Subject:   Kernel SysV IPC defaults.
Message-ID:  <200403031742.43986.chris@nfluid.co.uk>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403031742.43986.chris>