Is my understanding of Unicorn, Sidekiq and DB Pool size correct?

送分小仙女□ 提交于 2019-12-02 19:17:58

In Unicorn each process establishes its own connection pool, so you if your db pool setting is 5 and you have 5 Unicorn workers then you can have up to 25 connections. However, since each unicorn worker can handle only one connection at a time, then unless your app uses threading internally each worker will only actually use one db connection.

In Sidekiq, the connections in the pool are shared across threads, so you need to have at least one connection available per worker. If you have a concurrency of 5, then your pool needs to be at least 5.

Having a pool size greater than 1 means each Unicorn worker has access to connections it can't use, but it won't actually open the connections, so that doesn't matter.

The total number of actual connections your app requires, unless you're using threads in your application code (and they don't share a db connection), is one per Sidekiq worker plus one per Unicorn worker.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!