Skip to content

Reduce response cost of deploy keys autocompleter

What does this MR do and why?

The autocomplete URL for deploy keys uses a serializer that attempts to respond with every project the deploy key has been associated with.

When the list of projects associated to a few eligible keys exceeds 10-20k projects the autocompleter endpoint begins to time out and this causes various UIs to break.

For the purpose of the autocompleter only the relevant key list is required, and the projects are unnecessary.

This change splits the entity into a basic form and an extended form, with the extended form preserving the current behavior for other uses of the entity such as APIs.

The basic format will now exclude project list information which helps the autocompleter respond quicker.

The two frontend usage of this autocomplete endpoint use very few fields from the response, and do not use the field we're removing:

  1. https://gitlab.com/gitlab-org/gitlab/blob/1ca830d3eb61d088321261564adc4e5298ea7618/app/assets/javascripts/projects/settings/access_dropdown.js#L440-446
  2. https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/projects/settings/components/access_dropdown.vue#L202

Note: Some of the files were moved under a module due to a rubocop warning: #212156 (closed)

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Create a few projects and deploy keys and associate them together
  2. On a project visit the protected branches configuration
  3. Attempt to select a user for the protected branch permission to trigger the autocompleter
  4. Verify in network inspector of browser that the deploy keys autocompleter endpoint no longer responds with a projects listing per key

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related customer support ticket (internal link): https://gitlab.zendesk.com/agent/tickets/269240

Edited by Harsh Chouraria

Merge request reports