Skip to content

Make `LoadBalancer` to configure pool sizes of all classes

What does this MR do and why?

Safer variant of !72706 (closed). I will still get back to !72706 (closed), but for now this is way safer to rollout to production as it unifies when configuration is set.

This changes database_config.rb and moves connection pool size configuration to Load Balancer.

This is enabled by default with GITLAB_LB_CONFIGURE_CONNECTION=true as this is in general a safe change. The FF is just in-case.

Related to:

How to set up and validate locally (requires decomposition enabled in GDK/GCK)

Default state:

unset GITLAB_LB_CONFIGURE_CONNECTION # enabled by default

bin/rails console

[2] pry(main)> ActiveRecord::Base.connection_db_config.pool
=> 11 # in general value > 10
[3] pry(main)> Ci::CiDatabaseRecord.connection_db_config.pool
=> 11 # this is properly configured and have value > 10

Disabled (old behavior):

export GITLAB_LB_CONFIGURE_CONNECTION=1

bin/rails console

[1] pry(main)> ActiveRecord::Base.connection_db_config.pool
=> 11
[2] pry(main)> Ci::CiDatabaseRecord.connection_db_config.pool
=> 5 # this was not configured prior to this change, so 5 represents default

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kamil Trzciński (Back 2025-01-01)

Merge request reports

Loading