Skip to content

Allow `AuthorizedProjectsWorker` to use database replica for reads

In #292242 (closed), we investigate improving the read workload coming from he AuthorizedProjectsWorker. This worker has two phases:

  1. Read: Calculate "fresh" permissions for the user
  2. Write: In a transaction, remove full set of old permissions and insert full set of new ones

sidekiq jobs generally don't use read-only load balancing. This issue is about allowing this worker to perform its reads from replicas (if we can) - which offloads the heavy query from the primary.

This is a specific example worker for the broader topic discussed in gitlab-com/gl-infra/scalability#566.