Is there any formula to discover the number of workers and threads in a Rails application using puma ? Worker would be the number of cores ? How about threads ?? I've tried to search in similar topics, but it was not clear to me...
Even if your not on Heroku they have good doc about Puma. Like this one: link
This answer helped me when I was asking myself the same question.
Basically I set the number of workers matching the number of cores and the number of threads according to the ram amount. But I'm not doing this with a rocket science formula (maybe I should), it's more like a try and adjustment process.
As a bonus reading I would suggest this article about how to scale a rails app to 1000 req/sec, it gives interesting suggestions: link
Number of Worker * Number of threads inside the worker = Database Connection pool size
For example, if you are using 2.5 GB RAM's plan and you want to make use of it up around 2 GB.
1 worker * 8 threads = 8(DB pool size)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With