Skip to content

Reduce SQL timings in Projects::MergeRequestsController#show.json

The controller Projects::MergeRequestsController#show.json is one of our most frequently requested controllers with a 99th percentile (of SQL query timings) above 200 milliseconds. According to our daily overview the statistics are as follows:

  • 1 million requests per 12 hours
  • 7.0% of the request time is spent in SQL

SQL timings per request:

  • Mean: 86.01 ms
  • 95th percentile: 148.03 ms
  • 99th percentile: 214.89 ms

This controller should be improved so that the 99th percentile is consistently below 200 milliseconds. The ideal target would be a p99 between 100 and 150 milliseconds (I doubt we'll be able to get it lower).

Grafana data: https://performance.gitlab.net/dashboard/db/rails-controllers?orgId=1&var-action=Projects::MergeRequestsController%23show.json&var-database=Production

Edited by Yorick Peterse