Re: Setting kernel.shmmax

From: Mike Ivanov <mikei(at)activestate(dot)com>
To: fatih ozturk <ozturkfa(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Setting kernel.shmmax
Date: 2009-07-10 21:30:42
Message-ID: 4A57B302.9050600@activestate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

fatih ozturk wrote:

> In most of tuning guides setting shmmax
> parameter to %90 of total memory is advised.

Does not seem a good idea to me.

> is kernel.shmmax is about max connection to a database.
> So shmmax does not effects memory usage of querys directly.

No.

OK, there are two parameters. One is called shared_buffers in
posrgesql.conf. This parameter defines the size of a memory block used
by Postgres for buffers, cache and such. This memory region is called
Shared Memory (well, because it is shared between Postgres processes).

The operating system puts certain limits on how big those shared memory
regions could be. The maximum size is defined by kernel.shmmax parameter.

First you decide on how much memory Postgres should use. How much
exactly--it depends. In most cases it is safe to give 1/4 to 1/2 of all
the memory to Postgres, provided there are no other services (like
Apache) running on that machine. In your particular case I'd stick
closer to 1/4 side. Put that value in postgresql.conf.

Now, make kernel.shmmax slightly bigger than shared_buffers to
accommodate that value.

Cheers,
Mike

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2009-07-11 02:04:11 Re: Setting Shared-Buffers
Previous Message Anj Adu 2009-07-10 21:26:48 Re: Setting Shared-Buffers