Fix blobs search API degradation
What does this MR do?
Affects only non Advanced Search queries.
This MR fixes a performance degradation of the Blobs search API when we get a lot of matches from Gitaly for the search string. We achieve that by limiting the number of results we receive from gitaly in Ruby code. The next step could be to limit the number of results in Gitaly itself.
The only user facing change is that at the search page we would show 99+
instead of the exact number when there are more than 100 results.
The issue originally was discovered in #33562 (closed)
Performance toolkit
Testing with theBefore:
NAME | RPS | RPS RESULT | TTFB AVG | TTFB P90 | REQ STATUS | RESULT |
---|---|---|---|---|---|---|
api_v4_projects_project_search_blobs | 2/s | 0.95/s (>1.60/s) | 1388.48ms | 1899.62ms (<500ms) | 100.00% (>95%) | FAILED² |
¹ Result covers endpoint(s) that have known issue(s). Threshold(s) have been adjusted to compensate.
² Failure may not be clear from summary alone. Refer to the individual test's full output for further debugging.
After:
NAME | RPS | RPS RESULT | TTFB AVG | TTFB P90 | REQ STATUS | RESULT |
---|---|---|---|---|---|---|
api_v4_projects_project_search_blobs | 2/s | 1.95/s (>1.60/s) | 242.60ms | 310.07ms (<500ms) | 100.00% (>95%) | Passed |
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team