I am running a docker instance at Hetzner on a dedicated box with 32GB of ram and I was wondering if there is a standard way to tweak Discourse, postgres, etc to use as much memory as possible.
- And Increase your db pool size in database.yml (unless it’s managed somewhere else).
- You can also bump concurrency for sidekiq Advanced Options · mperham/sidekiq Wiki · GitHub
- Maybe allocate more RAM to the postgres process?
Since this was asked, @sam added a db cache size setting to app.yml. It defaults to 256mb but should definitely be increased if you have lots of memory.
If you have a system with 1GB or more of RAM, a reasonable starting value for shared_buffers is 1/4 of the memory in your system. If you have less RAM you’ll have to account more carefully for how much RAM the OS is taking up; closer to 15% is more typical there. There are some workloads where even larger settings for shared_buffers are effective, but given the way PostgreSQL also relies on the operating system cache, it’s unlikely you’ll find using more than 40% of RAM to work better than a smaller amount.
I added some comments in our standard and data templates:
As a general rule our defaults are good for 2GB installs, as you raise memory on the box you want to increase both params. (db_shared_buffers and db_work_mem)
It really depends on the size of your site and memory on the box, some ground rules:
- You never want to be swapping to disk, if memory is highly constrained, consider decreasing.
- You do not want to have a 4GB instance that has 2GB free memory all the time, it is a waste. (unless its a tiny db and you have no way of using the memory)
- If you have lots of CPUs you may want to increase the number of unicorn workers which in turn uses memory more efficiently.
i guess a High Performance option where it favors discourse on backend would be nice