User Vencent noticed that their Discourse container has more worker processes than expected, with 4 workers shown in top despite setting UNICORN_WORKERS to 2. Falco explained that this is because other processes like Sidekiq and Nginx are running in the container.
Vencent then mentioned that their low-traffic site had OOM errors with a 1GB RAM limit. Schleifer recommended a minimum configuration of 2GB RAM + 2GB swap, but Vencent was looking for RAM optimization ideas to avoid upgrading their server.
RGJ suggested reducing the number of Unicorn and Sidekiq workers, but Vencent was concerned that this could cause their site to block if a single request is doing I/O. RGJ reassured that it won’t be that bad, and Vencent clarified that they were asking out of curiosity.
The discussion also highlighted the importance of having swap space, with Falco stating that disabling swap is an unsupported configuration, and RGJ and Corsterix advising against disabling swap.
That controle the number of unicorn workers but that isn’t the only thing in the container. We also run sidekiq, nginx, etc. Sidekiq also shows as Ruby in top until you press c
Thank you. I see. So is this the minimum configuration for a low-traffic site? I set a maximum memory usage of 1GB to the container and it got OOM a few times.
Yeah, I understand. The “recommended” configuration, I guess, is for a real “community”. My instance, however, is only a support forum for my personal project with really low traffic (really). I know bigger RAM can always solve the problem, but it would be great if I can get some ideas on RAM optimization so I don’t have to upgrade my server with actually no need:)
That is what I’m thinking. Does that mean my whole site will block if a single request is doing I/O (i.e. database read)? I’m not really familiar with the tech details in Discourse but it seems likely to happen.
No, I disabled swap because my cloud service provider suggests me to. I also heard it’s better to disable swap on a Kubernetes node. Maybe I should try to loose the RAM limit for Discourse and see what happens.