Use search service for project autocomplete
What does this MR do and why?
Autocomplete is slow for searching projects
and groups
. This is because these are doing global searches using database calls and on every call it has to compute current_user.authorized_projects
and current_user.authorized_groups
.
This MR changes the projects autocomplete from always using a database search to using the SearchService
which uses Elasticsearch if it's available which should be quicker.
The change is behind a feature flag: autocomplete_projects_use_search_service
Future
I'm thinking we can extend this to search over fewer fields (just project name, namespace name) which will be much faster and better aligned with autocomplete behaviour.
We can also cache heavy operations like determining a user's authorized projects and groups for a few minutes so that subsequent autocomplete and search calls are much faster. I think this will have the biggest impact on autocomplete slowness.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Disable the feature flag:
Feature.disable(:autocomplete_projects_use_search_service)
- Perform an autocomplete: type
s
or/
in gitlab. Note the results - Enable the feature flag:
Feature.enable(:autocomplete_projects_use_search_service)
- Perform the same autocompletes and note the same results are returned
Related to #472011 (closed)
Merge request reports
Activity
changed milestone to %17.6
assigned to @maddievn
added pipelinetier-1 label
- A deleted user
added backend feature flag labels
- Resolved by Madelein van Niekerk
Reviewer roulette
Category Reviewer Maintainer backend @hmerscher
(UTC+2, same timezone as author)
@lma-git
(UTC-7, 9 hours behind author)
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Ghost User- Resolved by John Mason
- Resolved by Madelein van Niekerk
- Resolved by John Mason
Hi @rkumar555
can you please review this and send to@terrichu
once you're happy?
requested review from @rkumar555
@terrichu Could you please do the maintainer review?
requested review from @terrichu and removed review request for @rkumar555
added pipeline:mr-approved label
added pipelinetier-3 pipeline:run-e2e-omnibus-once labels and removed pipelinetier-1 label