Configure database connection pool in K8s similar to how it is configured in VMs
Currently, all Sidekiq processes start with a connection pool size of 10, this is the default from the charts: https://gitlab.com/gitlab-org/charts/gitlab/-/blob/ce6d4c6f222ce51038690ebf7f67ab266e7da727/templates/_helpers.tpl#L236-242
We should change this to 1
to be inline with the default for omnibus: https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/af1b37b48400bc82263a1d7400447da4d3cc3d36/files/gitlab-cookbooks/gitlab/attributes/default.rb#L346
This will allow the application to pick the db_pool size it needs based on concurrency.
Then, we can add the DB_POOL_HEADROOM
env variable to our own configuration, this would live in
- https://gitlab.com/gitlab-com/gl-infra/k8s-workloads/gitlab-com/-/blob/8c55670396673d64ae10be8703161bbac8d4cc5f/releases/gitlab/values/gprd.yaml.gotmpl#L16-76 for gprd
- https://gitlab.com/gitlab-com/gl-infra/k8s-workloads/gitlab-com/-/blob/master/releases/gitlab/values/values.yaml.gotmpl#L658-711 for gstg
We can use extraEnv
to set the environment variable: https://docs.gitlab.com/charts/charts/gitlab/sidekiq/#extraenv