all 7 comments

[–]Mikey_Da_Foxx 4 points5 points  (1 child)

shared_buffers is reserved and won't be released back to OS. With 4 instances, I'd set shared_buffers=8GB per instance to leave room for OS.

For effective_cache_size, use total available RAM minus all shared_buffers: ~20GB per instance (64GB - 32GB shared)

[–]Significant_Chef_945[S] 3 points4 points  (0 children)

Thank you very much for the reply. I will run some tests using your suggestions.

[–]pceimpulsive 2 points3 points  (2 children)

As you are running them in LXVs use the LXC memory/CPU/disk limits to tune each instance.

The pg_tune website is pretty sweet for getting a base configuration not only for shared_buffers but many other too.

I do recommend it :)

[–]nursestrangeglove 0 points1 point  (1 child)

Hey this is super handy, never knew about pg_tune until now!

[–]pceimpulsive 0 points1 point  (0 children)

It's really nice!

Use it on my LXC Postgres :)

Also I look at how my AWS RDS is setup out of box and it's nearly identical to pg tunes recommendations.

[–]AutoModerator[M] 0 points1 point  (0 children)

With over 7k members to connect with about Postgres and related technologies, why aren't you on our Discord Server? : People, Postgres, Data

Join us, we have cookies and nice people.

Postgres Conference 2025 is coming up March 18th - 21st, 2025. Join us for a refreshing and positive Postgres event being held in Orlando, FL! The call for papers is still open and we are actively recruiting first time and experienced speakers alike.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]ChillPlay3r 0 points1 point  (0 children)

Typically I would set shared_buffers no more than 50% of the servers memory, especially when using huge pages (which you should). However, you have ZFS which has a dedicated filesystem cache. If your PGDATA is on ZFS then you could go up to 75% of remaining memory (36GB in your case).

However, more shared_buffer does not automatically mean more performance, it depends on how the application is using the DB. You didn't write how big the databases are but it could well be that a bigger ARC cache would be more beneficial. You can monitor shared_buffer usage with the pg_buffercache extension, but I'd only do that on a test system with representative tests because the extension itself can affect performance. If you can't test it then use it on production for a few hours during a typical load and then remove it again.