Skip to content

Improve performance of users API under load

The TTFB P90 for the users API is taking longer then the expected 200ms

NAME         | RPS    | RPS RESULT           | TTFB AVG  | TTFB P90           | REQ STATUS     | RESULT
-------------|--------|----------------------|-----------|--------------------|----------------|-----------------
api_v4_users | 1000/s | 500.46/s (>800.00/s) | 1860.73ms | 4331.20ms (<200ms) | 100.00% (>99%) | FAILED²

This is based on the time to retrieve a full page of 20 users, when changing the pagination to 100 users per page the time increases.

NAME         | RPS    | RPS RESULT           | TTFB AVG  | TTFB P90            | REQ STATUS     | RESULT
-------------|--------|----------------------|-----------|---------------------|----------------|-----------------
api_v4_users | 1000/s | 108.97/s (>800.00/s) | 8317.08ms | 11324.43ms (<200ms) | 100.00% (>99%) | FAILED²

This was tested against a 50k Reference architecture. More information on the tests results with different user amounts can be found in gitlab-org/quality/performance#487 (closed).

As per our performance targets this endpoint's TTFB metric is above the target of X ms which is severity2. Task is to improve the endpoint's performance into next tier.

Steps to reproduce

  1. Check out the GitLab Performance Tool
  2. Run the specific test with the run-k6 command. For example against the 10k environment you would run this following from the project root: ./run-k6 -e environments/50k.json -o 60s_1000rps.json -t api_v4_users.js.
    • You will need an ACCESS_TOKEN for this endpoint as well.
    • Ensure you have more than 7 users to start seeing failures.
  3. If you're seeking to run the test against your own environment the Tool's documentation has details on how to achieve this.