Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Fix postgresql shared_buffers size?

Fix postgresql shared_buffers size?

Scheduled Pinned Locked Moved Support
postgresqlservices
4 Posts 2 Posters 244 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic was forked from MySQL service still runs with the default 128M innodb_buffer_pool_size girish
This topic has been deleted. Only users with topic management privileges can see it.
  • imc67I Offline
    imc67I Offline
    imc67
    translator
    wrote last edited by girish
    #1

    @girish Following up on this one for PostgreSQL, since you're in that code anyway: shared_buffers there is still at the built-in default of 128 MB, on a service that had a 4 GB limit here.

    shared_buffers         16384 (8kB)  = 128 MB
    effective_cache_size  524288 (8kB)  = 4 GB    (also the built-in default)
    work_mem                4 MB
    

    Postgres leans on the OS page cache far more than InnoDB does, so this is less dramatic than the MySQL case. But the usual guidance is somewhere around 25% of available memory, and 3% is a long way below that. effective_cache_size is a planner hint and is also left at its default, so it does not track the limit either.

    Would the same clamp you just added for MySQL make sense here, with a smaller fraction?

    1 Reply Last reply
    2
    • girishG Offline
      girishG Offline
      girish
      Staff
      wrote last edited by
      #2

      I forked this from https://forum.cloudron.io/topic/15767/mysql-service-still-runs-with-the-default-128m-innodb_buffer_pool_size/ to track it separately

      1 Reply Last reply
      0
      • girishG girish marked this topic as a regular topic
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote last edited by
        #3

        Not so sure about this. shared_buffers is a fixed reservation. The recommendation in the docs is for dedicated dbs - https://www.postgresql.org/docs/current/runtime-config-resource.html . On Cloudron, we have a shared environment. Postgres allocates it at startup and keeps it. It does not shrink when other apps or containers need RAM. It’s not like the OS page cache, which the kernel can reclaim under pressure.

        IOW, if you have 6GB for postgres, it will hog 25% of this. It's not a soft memory where it will relinquish this if other apps need it.

        1 Reply Last reply
        0
        • imc67I Offline
          imc67I Offline
          imc67
          translator
          wrote last edited by
          #4

          That makes sense, I hadn't looked at it that way. The page cache gives the memory back and shared_buffers doesn't, which matters a lot more on a box with thirty containers than on a dedicated database server β€” and the 25% guidance assumes the latter.

          What might still be worth it is effective_cache_size, which doesn't allocate anything and only tells the planner how much cache it can expect. On three of my servers with 8, 8 and 10 GB limits it reads 4GB everywhere, straight from boot_val β€” it doesn't track the limit at all. Deriving that one from the memory limit would improve plan choices without reserving any RAM.

          No rush on this one, it's much smaller than the MySQL case. It just seemed inconsistent that the buffer pool now follows the memory limit while the planner hint doesn't.

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better πŸ’—

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Bookmarks
          • Search