0

I have a Postgres 9.5 to serve a OpenStreetMap database (about 500GB of data)

I'm a realy newbie to configure the server and just follow these instructions: http://pgtune.leopard.in.ua/

But... after reading the araqnid's answer here I need to know if changing kernel.shmmax is realy important.

My server have 8 cores, a SATA HDD and 64 GB of RAM and running PostgreSQL + Tomcat + Geoserver and sometimes the map generation is painful (it is fine after all image caches generated).

Using htop I can see the cores and the memory running loose and a very high disk I/O.

what is the correct value for the kernel.shmmax and what more can I change?

Magno C
  • 103
  • 3
  • 1
    Install netdata, look at the metrics and you should find the cause of your slows. – ETL Mar 29 '18 at 13:37

2 Answers2

3

TL;DR: increasing kernel.shmmax is no longer necessary.

PostgreSQL used to need a large kernel.shmmax before version 9.3, as its "shared buffers" were allocated using SysV shared memory.

It used to have this recommendation: https://www.postgresql.org/docs/9.2/static/kernel-resources.html which is now obsolete (9.2 has been EOL'ed in 2017).

The most important shared memory parameter is SHMMAX, the maximum size, in bytes, of a shared memory segment. If you get an error message from shmget like "Invalid argument", it is likely that this limit has been exceeded. The size of the required shared memory segment varies depending on several PostgreSQL configuration parameters, as shown in Table 17-2. (Any error message you might get will include the exact size of the failed allocation request.) You can, as a temporary solution, lower some of those settings to avoid the failure. While it is possible to get PostgreSQL to run with SHMMAX as small as 2 MB, you need considerably more for acceptable performance. Desirable settings are in the hundreds of megabytes to a few gigabytes.


But that's not the version you're using. For 9.5, see the documentation at https://www.postgresql.org/docs/9.5/static/kernel-resources.html :

PostgreSQL requires a few bytes of System V shared memory (typically 48 bytes, on 64-bit platforms) for each copy of the server. On most modern operating systems, this amount can easily be allocated.

Daniel Vérité
  • 2,740
  • 14
  • 19
1

You should change your kernel.shmmax according shared_buffers parameter configured in your postgresql.conf. If kernel.shmmax would be lesser then configured in postgresql config, it just couldn't start.

Alexander Tolkachev
  • 4,513
  • 3
  • 14
  • 23