Skip to content

Add support for configuring Redis client timeouts

Stan Hu requested to merge sh-add-redis-connect-timeout into master

What does this MR do?

For some installations, the default 1-second Redis connect timeout may not sufficient. Just as PostgreSQL has the ability to configure connectTimeout, add the same for Redis. Add read and write timeouts for completness.

Related issues

Relates to gitlab-org/gitlab#466271

Also see https://gitlab.com/gitlab-com/ops-sub-department/section-ops-request-for-help/-/issues/189.

Author checklist

For general guidance, please follow our Contributing guide.

Testing

  1. Leave the global.redis.connectTimeout as the default.
  2. Deploy the cluster.
  3. Check /srv/gitlab/config/resque.yml it has the config.
  4. In /srv/gitlab, run bin/rails console.
  5. To check that the Redis client is using this timeout:
Sidekiq.redis { |redis| redis.config.inspect }
Gitlab::Redis::Cache.with { |redis| puts redis.instance_variable_get(:@client).config.inspect }
  1. Update the settings:
global:
  redis:
    connectTimeout: 3
    readTimeout: 4
    writeTimeout: 5

Repeat steps 2-5.

Required

For anything in this list which will not be completed, please provide a reason in the MR discussion.

  • Merge Request Title and Description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline.
  • Documentation created/updated.
  • Tests added/updated, and test plan for scenarios not covered by automated tests.
  • Equivalent MR/issue for omnibus-gitlab opened: gitlab-org/omnibus-gitlab!7749 (merged)

Reviewers checklist

Edited by Stan Hu

Merge request reports