OpenVZ Forum


Home » General » Support » OpenVZ & PostgreSQL: shmpages, shared_buffers, kernel.shmmax
OpenVZ & PostgreSQL: shmpages, shared_buffers, kernel.shmmax [message #33801] Tue, 11 November 2008 09:16 Go to next message
cadiolis is currently offline  cadiolis
Messages: 2
Registered: June 2008
Junior Member
Hi everyone, I am wondering if someone can shed some light on some of the various settings required for running PostgreSQL on OpenVZ

We have a server that has 8GB of ram that is running just one container that has Postgres. I have been trying in vain to figure out some of the above settings

I have read this page (http://wiki.openvz.org/Postgresql_and_shared_memory) but haven't gotten to far. From what I can tell there are 4 adjustments that need to be made

  • /sbin/sysctl kernel.shmmax in the host node
  • /sbin/sysctl kernel.shmmax in the VE
  • shmpages for the VE
  • shared_buffers in PostgreSQL


Can someone give me some pointers on what kinda values I should be putting in here? Does the shmmax in the host node need to be set the highest, and then each of the other values set to lower amounts? How much can I set for shmpages and shmmax? We would like to give as much of the 8GB as possible

Regards,
Collin
Re: OpenVZ & PostgreSQL: shmpages, shared_buffers, kernel.shmmax [message #33811 is a reply to message #33801] Wed, 12 November 2008 07:19 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
Hi Collin,

1) you don't need to change /sbin/sysctl kernel.shmmax in the host node as those setting would not affect Container's settings.

2) if you really want to run just a single Container on a Node, you can just disable memory limitation for the Container - just set "shmpages" and "privvmpages" UBC to any _big_ number, greater than 8Gb.
And you can also set /sbin/sysctl kernel.shmmax in the Container to the 8Gb (so you'll never reach this limit).

3) i cannot tell you anything useful about shared_buffers in PostgreSQL - know nothing about it. i've googled a bit and seen that people mostly use from 128Mb to 1Gb but suggest to increase this value in case of memory PostreSQL allocation failures.
Don't know if it's useful for PostreSQL, but you may increase those parameters - i only guess! - up to 6-7Gb if you don't run anything else on the Node (i think it makes sense to leave some memory for system itself).
But i'd advise to play with that parameter - it might be optimal for the whole system not to provide ALL the memory to PostgreSQL.

BTW, it will be very useful if you post here values you chosen after your experiments.

Hope this helps.

--
Konstantin


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: OpenVZ & PostgreSQL: shmpages, shared_buffers, kernel.shmmax [message #33818 is a reply to message #33801] Wed, 12 November 2008 18:58 Go to previous messageGo to next message
cadiolis is currently offline  cadiolis
Messages: 2
Registered: June 2008
Junior Member
Thanks for the info Konstantin,

Interesting to know that the shmmax setting does not need to be adjusted in the host. Does that mean I just read the wiki page on the topic incorrectly? Or should it be updated

http://wiki.openvz.org/Postgresql_and_shared_memory

Also good to know about setting the memory options to max if you are only running one VE. I will do that and play around a bit with the shared_buffers in PG
Re: OpenVZ & PostgreSQL: shmpages, shared_buffers, kernel.shmmax [message #33831 is a reply to message #33818] Thu, 13 November 2008 15:25 Go to previous message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
No, wiki page is ok, it says:

Quote:

* The sysctl kernel.shmmax value set in the HN/CT0 applies only to the HN, not to containers.

and this is true. Setting kernel.shmmax sysctl won't affect containers in any way and thus no need to touch it if we run PG inside a Container.

--
Konstantin


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Previous Topic: High Memory Support
Next Topic: NFS + vzctl stop = full server hang up :(
Goto Forum:
  


Current Time: Sat Aug 17 10:16:47 GMT 2024

Total time taken to generate the page: 0.02825 seconds