diff options
Diffstat (limited to 'doc/administration/postgresql/database_load_balancing.md')
-rw-r--r-- | doc/administration/postgresql/database_load_balancing.md | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/doc/administration/postgresql/database_load_balancing.md b/doc/administration/postgresql/database_load_balancing.md index d5cf93a135a..cc550dbe389 100644 --- a/doc/administration/postgresql/database_load_balancing.md +++ b/doc/administration/postgresql/database_load_balancing.md @@ -76,22 +76,31 @@ Database Load Balancing can be configured in one of two ways: ### Hosts -To configure a list of hosts, perform these steps on all GitLab Rails (Sidekiq) +<!-- Including the Primary host in Database Load Balancing is now recommended for improved performance - Approved by the Reference Architecture and Database groups. --> + +To configure a list of hosts, perform these steps on all GitLab Rails and Sidekiq nodes for each environment you want to balance: 1. Edit the `/etc/gitlab/gitlab.rb` file. -1. In `gitlab_rails['db_load_balancing']`, create an array of the read-only - replicas you want to balance. Do not add the primary host. For example, on +1. In `gitlab_rails['db_load_balancing']`, create the array of the database + hosts you want to balance. For example, on an environment with PostgreSQL running on the hosts `primary.example.com`, - `host1.example.com`, `host2.example.com`, and `host3.example.com`: + `secondary1.example.com`, `secondary2.example.com`: ```ruby - gitlab_rails['db_load_balancing'] = { 'hosts' => ['host1.example.com', 'host2.example.com', `host3.example.com`] } + gitlab_rails['db_load_balancing'] = { 'hosts' => ['primary.example.com', 'secondary1.example.com', 'secondary2.example.com'] } ``` - These replicas must be reachable on the same port configured with `gitlab_rails['db_port']`. + These hosts must be reachable on the same port configured with `gitlab_rails['db_port']`. + +1. Save the file and [reconfigure GitLab](../restart_gitlab.md#reconfigure-a-linux-package-installation). -1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure). +NOTE: +Adding the primary to the hosts list is optional, but recommended. +This makes the primary eligible for load-balanced read queries, improving system performance +when the primary has capacity for these queries. +Very high-traffic instances may not have capacity on the primary for it to serve as a read replica. +The primary will be used for write queries whether or not it is present in this list. ### Service Discovery @@ -121,7 +130,7 @@ record. For example: } ``` -1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure) for the changes to take effect. +1. Save the file and [reconfigure GitLab](../restart_gitlab.md#reconfigure-a-linux-package-installation) for the changes to take effect. | Option | Description | Default | |----------------------|---------------------------------------------------------------------------------------------------|-----------| @@ -173,7 +182,7 @@ To configure these options with a hosts list, use the following example: ```ruby gitlab_rails['db_load_balancing'] = { - 'hosts' => ['host1.example.com', 'host2.example.com', `host3.example.com`] + 'hosts' => ['primary.example.com', 'secondary1.example.com', 'secondary2.example.com'] 'max_replication_difference' => 16777216 # 16 MB 'max_replication_lag_time' => 30 'replica_check_interval' => 30 |