[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Should a package increase a kernel parameter? (Re: Bug#67481)



Andrew is suggesting a mechanism for automatically increasing a kernel
parameter when postgresql is going to need more shared memory than the
default allocation.

While what he asks for is not difficult to do, I wonder if we should
not have a more general way of doing this.  If I do this in postgresql,
as I already do for KERNEL_FILE_MAX, it will not take into account the
needs of other packages.  Perhaps we should have a package that can be
used for other packages to register their requirements and thus raise
kernel limits to meet the demands of all packages that might encounter
those limits.

Example:
postgresql is configured to run 4096 backends (good grief!) and so
requires 33Mb of shared memory.  Another package, foo, requires 5Mb and
bar requires 6Mb; this gives a total requirement of 44Mb.  If I do the
operation in postgresql's scripts, I will only provide 33Mb.  My
suggested kernel limits package would know that it needed to provide
the full 44Mb.

Andrew McMillan wrote (2 emails conflated):
  >Package: postgresql
  >Version: 7.0.2-2
  >Severity: wishlist
  >
  >PostgreSQL as a database server can sometimes be installed in environments
  >which contain substantial amounts of physical RAM.  In these situations the
  >Linux default for shmmax is unreasonable.  In particular, if I try to start
  >PostgreSQL with 4096 (or more) buffers it will fail because it is trying to
      >use
  >more than 32M.
  >
  >It would be nice if the postmaster.init allowed configuration of SHMMAX
  >similarly to the configuration of KERNEL_FILE_MAX at the moment.
  >
  >It is possible to calculate a reasonable value for SHMMAX based on the setti
      >ng
  >of PGBUFFERS according to a recent message on pgsql-hackers by Peter Eisentr
      >aut
  >it seems that something like:
  >  let SHMMAX=(${PGBUFFERS}*8192)+(1024*1024)
  >would give a PostgreSQL requirement, with a little left over.  It is possibl
      >e that
  >the value for PGSORTMEM should go into that mix as well.
  >
  >It would probably be best to simply allow a variable 'X' megabytes to be con
      >figured
  >however as only the administrator can really be trusted to know what further
  >shared memory requirements there might be on the system.
  >
  >The value needs to be echoed into /proc/sys/kernel/shmmax to tell Linux to
  >allow allocations of that size.
 
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Behold, what manner of love the Father hath bestowed 
      upon us, that we should be called the sons of God..." 
                                I John 3:1 




Reply to: