Use read replica for GLQL queries if available

What does this MR do and why?

The current MR will make sure that all request coming from GLQL are routed to read replica. Overall, we only read data with GLQL, there are no writes.

Please refer to this discussion for more details on the implementation and why choosing this approach https://gitlab.com/gitlab-org/gitlab/-/issues/517543#note_2392996635.

This documentation provides more information about how use_replicas_for_read_queries works https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/merge_request_concepts/performance.md#use-read-replicas-when-possible.

How to set up and validate locally

  • Enable GLQL feature flag by running Feature.enable(:glql_integration) in rails console
  • Follow this guide to setup replication locally in GDK
  • Find or create an issue in gdk and add there in a comment box or in a description any GLQL query and save it, for example:
```glql
display: table
fields: title, labels("workflow::*"), author, weight, assignees
query: group = "gitlab-org" and label = "Brantforge"
```
  • In the performance bar, choose POST glql request, click on pg data and see that all GLQL requests are now routed to the replica. image

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #517543

Edited by Alisa Frunza

Merge request reports

Loading