Forum OpenACS Q&A: Any linux kernel tuning instructions

Collapse
Posted by Li-fan Chen on

I got a few errors after recompiling PostgreSQL 7.0.2 with the #define BLCKSZ 16384 adjustment. Maybe my kernel is misconfigured. Any particular notes floating around for tuning a OpenACS linux kernel? (or did Don meant the Pg "kernel" when he said kernel in the PostgreSQL tuning instructions)

bash$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
IpcMemoryCreate: shmget failed (Invalid argument) key=5432001, size=1670144, permission=600
This type of error is usually caused by an improper
shared memory or System V IPC semaphore configuration.
For more information, see the FAQ and platform-specific
FAQ's in the source directory pgsql/doc or on our
web site at http://www.postgresql.org.
FATAL 1:  ShmemCreate: cannot create region
Collapse
Posted by Dan Wickstrom on
I compiled pg 7.0.2 with the default block size, and I had the same error as you.  I rebuilt the kernel by following the directions.  When doing the configuration for the kernel, I just answered yes to any questions regarding ipc and shared memory (I think they were selected as yes for the defaults).  After building the kernel, I copied the new kernel to /boot and made it the default kernel using lilo, and after that everything worked fine.  cd into /usr/src/linux, and you should find some documention there or somewhere below there for rebuilding your kernel (I don't have a linux machine handy, so I can't check for sure).
Collapse
Posted by Don Baccus on
Don meant the Linux kernel ...

What distro are you two running?  RH comes with shmem configured reasonably, you don't need to recompile the kernel to get things up and running (though you do need to if you're to use more than 16MB for  the Postgres shared buffer space).

Since you didn't specify "-B" when trying to run the postmaster, it's only asking for 64 blocks of shared memory, a bit over a megabyte.  Any kernel with shmem or semaphores configured to a reasonable value should have no problem with this.

So ... try Dan's recompile-the-kernel suggestion.

Collapse
Posted by Dan Wickstrom on
That makes sense.  I start the postmaster with -B set to 1000.  I'm currently using mandrake 7.0 or redhat 6.0 depending on which half I dual-boot to, and if I remember correctly I had to rebuild the kernel for both redhat 6 and mandrake 7.  I think mandrake 7 is basically redhat 6.1, but it seems that they compile their own kernel.  I've compiled kernels several times without really knowing anything about how to do it.  It seems that if you follow the documentation and use the defaults when you don't know what option to choose, everything turns out o.k.
Collapse
Posted by Don Baccus on
"-B 1000" should work fine, as 16KB * 1000 = 16MB, which is 1/2 the shmem default that has shipped with RH at least for a long, long time.  It's only if you go above that level that you should run into problems.

Then, again, my two latest "vanilla" installs of RH were 6.1 and 6.2 respectively, so perhaps with older versions there was a problem.  Not sure.

In 6.1 (maybe 6.0) you can change the shmem size without a kernel recompile but you can't change the default allocation addresses, which  Postgres uses for portability reasons (I keep meaning to suggest a command-line switch to override these values).

Collapse
Posted by Li-fan Chen on

The System V option was set to YES during the last compile and registered via lilo. So that's fine. So I just went ahead and implemented the rest of the OpenACS instructions and did a reboot. I guess that maybe some of the earlier PostgreSQL? or NSD crashes (with the incomplete nsd.tcl modifications and lack of relevant Pg accounts and data models and all) caused the Shmem errors. There were no such complaints with the new boot. Both unpatched (8192) and patched (16384) versions of Pg seems to work fine.

This is now appended to the /etc/rc.d/rc.local:

nohup su -c '/usr/local/pgsql/bin/postmaster -B 1000 -o "-S 2000" -D /usr/local/pgsql/data > /usr/local/pgsql/data/server.log 2>&1' postgres &

I got the main form on lynx localhost and see a set of nsd and postgres daemon in ps aux. Just one question, are the NSD threads suppose to show up on PS? I always thought PS only show processes, not sure.

nsadmin    476  0.1  1.7  9928 9024 ?        S    14:21   0:02 /home/aolserver/b
nsadmin    484  0.0  1.7  9928 9024 ?        S    14:21   0:00 /home/aolserver/b
nsadmin    485  0.0  1.7  9928 9024 ?        S    14:21   0:00 /home/aolserver/b
postgres   486  0.0  0.1  1644  748 ?        SN   14:21   0:00 bash -c /usr/loca
postgres   487  0.0  0.2 20208 1220 ?        SN   14:21   0:00 /usr/local/pgsql/
nsadmin    488  0.0  1.7  9928 9024 ?        S    14:21   0:00 /home/aolserver/b
nsadmin    490  0.0  1.7  9928 9024 ?        S    14:21   0:00 /home/aolserver/b
Collapse
Posted by Don Baccus on
Linux threads are kernel threads, which show up as processes, yes.  In  Unix systems that implement threads as user threads, you don't see them in the process table.