Adjust gitlab_rails['db_pool'] settings
By default, gitlab_rails['db_pool']
is set to 10, which means that there is 10 database connections that are pooled by ActiveRecord (https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ConnectionPool.html).
For Sidekiq, we dynamically set this value to the number of threads (https://gitlab.com/gitlab-org/gitlab-ce/blob/da573ae259f132e8a557001f54d58037f2534753/config/initializers/sidekiq.rb#L86).
On GitLab.com, we have a pool size set to 1 because Unicorn runs a single thread.
Proposal:
- Bring the
db_pool
setting down from 10 to 1. We are just wasting unnecessary connections. - When Puma is in use, set it to the number of threads by default.