Skip to content

Changes Usage Quota member query for performance

Vijay Hawoldar requested to merge vij-improve-usage-quotas-performance into master

What does this MR do and why?

Changes the Usage Quota page to stop counting and displaying the number of pending/awaiting members (part of the User Cap for groups feature).

Previously, we would count the number of pending members and conditionally display an alert if that count is greater than 0.

The downside to that approach is that the query performs really badly and for some of our larger customers, this would result in a failure of our apdex target (5 seconds).

In this MR, we switch to checking if there are any? records, which modifies the query with a LIMIT, to sufficiently drop the query performance to within the apdex target.

As a result, we now stop displaying the count in the UI, as confirmed here.

Please note, the query performance is still not good, but it is a significant improvement from where it was at, the following statistics are from using one of our largest groups:

Longer term, hopefully significant improvements can be made via initiatives such as https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/7130+

Shorter term, this should improve the experience for some of our larger groups.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2023-10-26_at_13.48.29 Screenshot_2023-10-26_at_15.01.16

How to set up and validate locally

  1. Ensure the User Caps feature is enabled:
      Feature.enable(:saas_user_caps)
  2. Goto a Group and set a low user cap, e.g. 1 (Group -> Settings -> General -> User Caps)
  3. Invite a new member to your group which will add them as a pending member (Group -> Manage -> Members -> Invite Member)
  4. View the Group Usage Quotas page (Group -> Settings -> Usage Qutoas)

You should see the new alert

MR acceptance checklist

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

Edited by Vijay Hawoldar

Merge request reports