简体   繁体   中英

Rails 4 Puma concurrency with Capistrano

I am trying to deploy a concurrent Rails 4 Puma app with capistrano and was confused by the example of capistrano-puma gem.

From the snipper from github

set :puma_threads, [0, 16]
set :puma_workers, 0
  1. What are the differences of threads and workers in puma?
  2. What does 0 puma worker means and [0, 16] threads mean?
  3. What are the parameters to achieve concurrency? My aim is to achieve simple SSE to send notification. What are the best parameters to do in puma?

I am sorry if these are simple questions but i am having hard time finding resources online even on the official site, if someone can point me to an article which answer my question, i am happy to accept it. Thanks.

在任何文档中都找不到,我想设置了:puma_workers,0表示无限的puma工人。

A worker is the number of processes running or instances of your application. Each instance can run multiple threads. So if you have 2 workers running with max 16 threads it means your server can serve 2 * 16 = 32 requests at a time and if avg response time of your request is 100ms it means per second requests that could serve = (1000/100) * 32 = 320rps approx.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM