Re: Shared Memory Issues

[ Available lists | Index of freebsd-hackers | Month of Sep 2000 | Week of 8 Sep 2000 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
John Toon <j.a.toon@btinternet.com>
Date
8 Sep 2000 07:05:05
Subject
Re: Shared Memory Issues
Message-ID
39B8EFFA.785E6D46@btinternet.com

Referenced by

[ Hide this part ]
Lance Rocker wrote:

> Hello,
>
> I too had problems with running out of shared mem segments, so I wrote
> my first ever perl script that does something useful for me. I've
> attached it to this email and I'll paste it in below too, for
> convenience.
>
> I noticed that many (most?) of the shared mem segments in use, when I
> was running out of them, didn't actually have any processes attached to
> them. This perl script just goes through, finds those non-attached
> shared mem segments, and deletes them. I've found running it
> periodically works great for me, you may even want to put it in your
> crontab and let it run once a day, just as a little proactive
> housekeeping.

Hey, nice script. Is there anything Perl can't do these days? ;^)

I'm currently just enjoying the power of awk. I hope it doesn't get
forgotten in the shadow of Perl.

However, it seems strange that you're getting non-attached memory
segments. Surely it is the job of the kernel to clean up after processes
(if they're badly programmed and don't do it themselves)? Perhaps one
program is leaking?

My system has been up for two days now since last reboot, I just ran
your program, and I had 55 shared memory segments, 0 non-attached...

> For the record, here are the kernel options I use with this kernel:
>
> options SYSVSHM #SYSV-style shared memory
> options SYSVMSG #SYSV-style message queues
> options SYSVSEM #SYSV-style semaphores
> options SHMALL=16384
> options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)"
> options SHMMAXPGS=8192
> options SHMMIN=128
> options SHMMNI=128
> options SHMSEG=96
>
> I think that last one makes the biggest difference, and is the one you
> may want to make as large as possible, though 96 works fine for my 64MB
> of ram. This is a 4.0-release kernel, and I use XFree86 4.0 with
> Enlightenment as my window manager.

It definitely does! The default setting, as someone correctly pointed
out, in LINT, is SHMSEG=9. As you can see above, my system is currently
using 55, more than 5X that limit! I've sent in a brief e-mail to
freebsd-stable, suggesting that the GENERIC kernel default is altered to
something a little higher. The SHMSEG setting is under the
"undocumented" options in LINT, which is not helpful or conducive to
people fixing this problem. It's a good job freebsd-hackers exists...
;^)

The SHMSEG=1024 setting I've got is probably excessive, but I would
guess the performance degradation is negligible to non-existent in
having more than you need, especially due to FreeBSD's unmatched memory
management, as I've noticed no difference in performance.

> yes, ipcs and ipcrm are the ones my perl script uses. Check out the
> manpage for each of them. . . I like to run "ipcs -mbop" to get a lot
> of info about used shared mem segments.
>
> -Lance

Yes, they both have more settings than I was aware of. Oh, the joy of
manpages...

--
"I'm entirely unaccountable for any moments of sanity contained herein."
:s/Windows/UNIX
John Toon | j.a.toon@btinternet.com | "Sonnilon"




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Elapsed time: 0.345 seconds