Reduce SQL timings in Projects::MergeRequests::DiffsController#show.json
The controller Projects::MergeRequests::DiffsController#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:
- 33 000 requests per 12 hours
- 7.5% of the request time is spent in SQL
SQL timings per request:
- Mean: 94.64 ms
- 95th percentile: 159.39 ms
- 99th percentile: 709.33 ms
This controller should be improved so that the 99th percentile is consistently below 200 milliseconds, with an ideal target of 100 - 150 milliseconds.
Blocked By
- https://gitlab.com/gitlab-org/gitlab-ce/issues/38067: this will make it easier/faster to get notes with the right indexes
-
https://gitlab.com/gitlab-org/gitlab-ce/issues/38068: this will remove the need for
COUNT(*)
queries just to get the number of commits per diff
Edited by yorickpeterse-staging