Rescaling the server, which configs need to be changed? - unicorn workers, memory, etc

TLDR: Is there a guide or a list of recommended configurations to consider when rescaling a server?

When installing Discourse for the first time on a server, there are some settings that are auto-set.
One convenience that the cloud offers is to simply change the instance type to a different one with more/less cpus and memory.
As far as I understand, the automatic configurations don’t auto-adjust to the new server (it could be nice to have an alert on the Admin Dashboard that your Discourse configuration don’t seem to match the hardware it is running on).

For example, I considered these settings from the app.yml file:

## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
db_shared_buffers: "4096MB"

## can improve sorting performance, but adds memory usage per-connection
#db_work_mem: "40MB"

## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 4

That would assume that Discourse is the only thing running on the server, which isn’t always the case.

I usually specify two unicorn_workers per core, and 25% of the system memory as db_shared_buffers

3 Likes

If you run discourse-setup it will change to the suggested sizes. But you’re looking at the suggestions, so you can just do it yourself.

2 Likes

Hello. It’s time to increase server features. In order to change the processor and ram properties of the server, I need to turn it off. Is there anything important I should do before resizing the server? I want everything to be in place and working when I come back.

I’d download a full backup and a copy of the app.yml file in case it doesn’t come back.

2 Likes

Is it possible to change db_share_buffers without rebuild?

cd /var/discourse
./launcher destroy app
./launcher start app