newBike
newBike

Reputation: 15002

What's the difference between workers and threads on puma server

suppose there are 100 users on the site at the same time,

What's the difference between the following settings

Which setting is more sensible/practical ?

Setting 1

workers Integer(ENV['WEB_CONCURRENCY'] || 10)
threads_count = Integer(10)

Setting 2

workers Integer(ENV['WEB_CONCURRENCY'] || 20)
threads_count = Integer(5)

Setting 3

workers Integer(ENV['WEB_CONCURRENCY'] || 5)
threads_count = Integer(20) 

Upvotes: 0

Views: 572

Answers (1)

Marcus Walser
Marcus Walser

Reputation: 5829

This is a difficult decision to make without knowing more about the characteristics of your application, and it takes a bit of tuning to get it right.

Naively, if you have a high proportion of long-running blocking requests (calls to an external API, something like that 100+ms or so) you want more threads so that your workers are not idle while that request is processed. If you have high throughput but all the requests are fast, you want more workers with fewer threads.

Upvotes: 1

Related Questions