Re: Configuration settings for 32GB RAM server

Lists: pgsql-performance
From: "Mark Lonsdale" <mark(dot)lonsdale(at)wysdm(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Configuration settings for 32GB RAM server
Date: 2006-12-04 17:10:59
Message-ID: 673ECBB77DA91F47AD4902A5FD73BCE4D5ED15@mail3
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

Hi

We are migrating our Postgres 7.3.4 application to postgres 8.1.5 and also moving it to a server with a much larger hardware configuration as well. The server will have the following specification.

- 4 physical CPUs (hyperthreaded to 8)

- 32 GB RAM

- x86_64 architecture

- RedHat AS 4

- postgres 8.1.5

Ive been taking a look at the various postgres tuning parameters, and have come up with the following settings.

shared_buffers - 50,000 - From what Id read, increasing this number higher than this wont have any advantages ?

effective_cache_size = 524288 - My logic was I thought Id give the DB 16GB of the 32, and based this number on 25% of that number, sound okay?

work_mem - 32768 - I only have up to 30 connections in parallel, and more likely less than ½ that number. My sql is relatively simple, so figured even if there was 5 sorts per query and 30 queries in parallel, 32768 would use up 4GB of memory.. Does this number sound too high?

Maintenance_work_mem = 1048576 - Figured Id allocate 1GB for this.

fsm_relations = 2000 - I have about 200 tables plus maybe 4 or 5 indexes on each, and didn't want to have to worry about this number in future so doubled it.

fsm_pages = 200,000 - Based this on some statistics about the number of pages freed from a vacuum on older server. Not sure if its fair to calculate this based on vacuum stats of 7.3.4 server?

Do these numbers look reasonable given the machine above? Any other settings that I should be paying particular consideration too?

Thanks

Mark


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-04 17:42:57
Message-ID: 1165254177.25371.33.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On Mon, 2006-12-04 at 12:10 -0500, Mark Lonsdale wrote:

> - 4 physical CPUs (hyperthreaded to 8)
>
> - 32 GB RAM
>
> - x86_64 architecture
>
> - RedHat AS 4
>
> - postgres 8.1.5
>
>
>
> Ive been taking a look at the various postgres tuning parameters, and
> have come up with the following settings.
>
>
>
> shared_buffers – 50,000 - >From what Id read, increasing this
> number higher than this wont have any advantages ?
>

Where did you read that? You should do some tests. Generally 25% of
physical memory on a dedicated box is a good point of reference (on 8.1,
anyway). I've heard as high as 50% can give you a benefit, but I haven't
seen that myself.

> fsm_pages = 200,000 – Based this on some statistics about the number
> of pages freed from a vacuum on older server. Not sure if its fair
> to calculate this based on vacuum stats of 7.3.4 server?
>

Might as well make it a higher number because you have a lot of RAM
anyway. It's better than running out of space in the FSM, because to
increase that setting you need to restart the daemon. Increasing this by
1 only uses 6 bytes. That means you could set it to 10 times the number
you currently have, and it would still be insignificant.

Regards,
Jeff Davis


From: Vivek Khera <vivek(at)khera(dot)org>
To: "Pgsql-Performance ((((E-mail))))" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-04 18:44:59
Message-ID: 320E1EF2-FC6F-428E-88CB-DB0455CE2134@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance


On Dec 4, 2006, at 12:10 PM, Mark Lonsdale wrote:

> - 4 physical CPUs (hyperthreaded to 8)

i'd tend to disable hyperthreading on Xeons...
> shared_buffers – 50,000 - >From what Id read, increasing this
> number higher than this wont have any advantages ?
>
>
if you can, increase it until your performance no longer increases.
i run with about 70k on a server with 8Gb of RAM.

> effective_cache_size = 524288 - My logic was I thought Id give
> the DB 16GB of the 32, and based this number on 25% of that number,
> sound okay?
>
>

this number is advisory to Pg. it doesn't allocate resources, rather
it tells Pg how much disk cache your OS will provide.
> work_mem – 32768 - I only have up to 30 connections in parallel,
> and more likely less than ½ that number. My sql is relatively
> simple, so figured even if there was 5 sorts per query and 30
> queries in parallel, 32768 would use up 4GB of memory.. Does this
> number sound too high?
you need to evaluate how much memory you need for your queries and
then decide if increasing this will help. benchmarking your own use
patterns is the only way to do this.

> Maintenance_work_mem = 1048576 – Figured Id allocate 1GB for this.
>
>
I usually do this, too.

> fsm_relations = 2000 - I have about 200 tables plus maybe 4 or 5
> indexes on each, and didn’t want to have to worry about this number
> in future so doubled it.

i usually never need to go more than the default.
> fsm_pages = 200,000 – Based this on some statistics about the
> number of pages freed from a vacuum on older server. Not sure if
> its fair to calculate this based on vacuum stats of 7.3.4 server?
On my big DB server, this sits at 1.2 million pages. You have to
check the output of vacuum verbose from time to time to ensure it is
not getting out of bounds; if so, you need to either vacuum more
often or you need to pack your tables, or increase this parameter.

> Do these numbers look reasonable given the machine above? Any
> other settings that I should be paying particular consideration too?
They're a good starting point.


From: "Joshua Marsh" <icub3d(at)gmail(dot)com>
To: "Mark Lonsdale" <mark(dot)lonsdale(at)wysdm(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-04 18:57:04
Message-ID: 38242de90612041057j63672f7qafa6c6059e9901dc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On 12/4/06, Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com> wrote:
>
>
> Maintenance_work_mem = 1048576 – Figured Id allocate 1GB for this.
>

Do you know how often and when you will be creating indexes or clustering?
We set ours to 2GB because of the performance gains. We've also thought
about testing it at 4GB. We can do this because we know during the middle
of the night our server load drops to nearly zero. If you know you have
windows like that, then I would definitely suggest increasing your
maintenance_work_mem. It's halved the time for io intesive tasks like
cluster.


From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Joshua Marsh <icub3d(at)gmail(dot)com>
Cc: Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-04 19:23:04
Message-ID: 1165260184.14565.349.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On Mon, 2006-12-04 at 12:57, Joshua Marsh wrote:
>
> On 12/4/06, Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com> wrote:
> Maintenance_work_mem = 1048576 – Figured Id allocate 1GB for
> this.
>
>
>
> Do you know how often and when you will be creating indexes or
> clustering? We set ours to 2GB because of the performance gains.
> We've also thought about testing it at 4GB. We can do this because we
> know during the middle of the night our server load drops to nearly
> zero. If you know you have windows like that, then I would definitely
> suggest increasing your maintenance_work_mem. It's halved the time
> for io intesive tasks like cluster.
>

Also, remember that most of those settings (work_mem,
maintenance_work_mem) can be changed for an individual session. So, you
can leave work_mem at something conservative, like 8 meg, and for a
session that is going to run at 2am and iterate over billions of rows,
you can throw several gigabytes at it and not worry about that one
setting blowing out all the other processes on the machine.


From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-04 23:28:57
Message-ID: A67425AC-8FF8-438B-9678-862D3854FBD3@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance


On 4-Dec-06, at 12:10 PM, Mark Lonsdale wrote:

>
>
>
>
>
>
> Hi
>
>
>
> We are migrating our Postgres 7.3.4 application to postgres 8.1.5
> and also moving it to a server with a much larger hardware
> configuration as well. The server will have the following
> specification.
>
>
>
> - 4 physical CPUs (hyperthreaded to 8)
Try both hyperthreaded and not, there's been some evidence that HT
helps us now
> - 32 GB RAM
>
> - x86_64 architecture
>
> - RedHat AS 4
>
> - postgres 8.1.5
>
>
>
> Ive been taking a look at the various postgres tuning parameters,
> and have come up with the following settings.
>
>
>
> shared_buffers – 50,000 - From what Id read, increasing this
> number higher than this wont have any advantages ?
This is no longer true, 25% of available memory is a good starting
place, and go up from there
>
>
> effective_cache_size = 524288 - My logic was I thought Id give
> the DB 16GB of the 32, and based this number on 25% of that number,
> sound okay?
>
>
this should be around 3/4 of available memory or 24G
> work_mem – 32768 - I only have up to 30 connections in parallel,
> and more likely less than ½ that number. My sql is relatively
> simple, so figured even if there was 5 sorts per query and 30
> queries in parallel, 32768 would use up 4GB of memory.. Does this
> number sound too high?
>
>
>
> Maintenance_work_mem = 1048576 – Figured Id allocate 1GB for this.
>
>
>
> fsm_relations = 2000 - I have about 200 tables plus maybe 4 or 5
> indexes on each, and didn’t want to have to worry about this number
> in future so doubled it.
>
>
>
> fsm_pages = 200,000 – Based this on some statistics about the
> number of pages freed from a vacuum on older server. Not sure if
> its fair to calculate this based on vacuum stats of 7.3.4 server?
this is dependent on your application
>
>
> Do these numbers look reasonable given the machine above? Any
> other settings that I should be paying particular consideration too?

autovacuum settings.

>
>
> Thanks
>
>
> Mark
>
>
>
>


From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Mark Lonsdale <mark(dot)lonsdale(at)wysdm(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Configuration settings for 32GB RAM server
Date: 2006-12-07 06:03:20
Message-ID: 20061207060320.GV44124@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

On Mon, Dec 04, 2006 at 09:42:57AM -0800, Jeff Davis wrote:
> > fsm_pages = 200,000 ??? Based this on some statistics about the number
> > of pages freed from a vacuum on older server. Not sure if its fair
> > to calculate this based on vacuum stats of 7.3.4 server?
> >
>
> Might as well make it a higher number because you have a lot of RAM
> anyway. It's better than running out of space in the FSM, because to
> increase that setting you need to restart the daemon. Increasing this by
> 1 only uses 6 bytes. That means you could set it to 10 times the number
> you currently have, and it would still be insignificant.

You can also run vacuumdb -av and look at the last few lines to see what
it says you need. Or you can get that info out of
contrib/pg_freespacemap.
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)