The joys of running Mac OS X as a server

Mac OS X client makes a pretty good server.

There's not much I've had to adjust to get it to handle what I've been throwing at it.

I did mess with some default sysctl values so that I could give a larger block of shared memory to postgres:

kern.sysv.shmmax=136314880
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=33280

With 10.2 I made a copy of /System/Library/StartupItems/SystemTuning/ and put it in /Library/StarupItems/SystemTuning/ and then modified the script contained within with these new values. For 10.3, I could just paste them into /etc/sysctl.conf

... recently there have been a few power outages over by Jared, and when the machine comes back up the deluge of queued mail has pretty much melted the machine. Since all email is run through spamassassin, and the machine isn't the fastest server in the world, it was causing problems (the load would get extremely high and sendmail would stop accepting connections and it seemed that it was just unable to drain the queued up mail from the backup mx host).

I managed to fix this by giving spamd the -m 5 option to only spawn 5 scanning processes at a time. This keeps the load lower and allows things to move more quickly through the system. (Incidentally, I discovered this when perusing some documentation for the as-yet-unreleased 3.0 version of spamassassin).

The next time the power outage happened, though, I had a different problem. I ran out of processes.

See Mac OS X client has a relatively conservative setting of 512 for kern.maxproc, while Mac OS X Server sets this to 2048. So I upped this as well and things seem to be going more smoothly.

I also upped kern.ipc.somaxconn to 512 so that up to 512 pending messages will queue up waiting for an available spamassassin child. I am not sure, but I might have to recompile perl for this change to actually do anything (ie perl -MSocket -e'print SOMAXCONN' prints 128 after the change). I'm also not sure if this setting is a good idea, or if I need to change anything else along with it (I thought I might need to change kern.ipc.maxsockets, but that appears to be something you cannot change via sysctl (it may require a kernel recompile, I'm not sure)).

In any event, this entry is really just here so that I can remember to set things up like this when I move geeklair.net over to a 10.3 machine:

% cat /etc/sysctl.conf
kern.sysv.shmmax=136314880
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=33280
kern.maxproc=2048
kern.ipc.somaxconn=512

UPDATE: Since I don't feel like rebuilding perl and all my perl modules, and I don't actually know what other things this may effect, I've set kern.ipc.somaxconn back to it's deafult value (128) for now. This merits further investigation when I get some time.

Powered by Movable Type 4.34-en
Creative Commons License
This blog is licensed under a Creative Commons License.