Skip to content

Eliminate N+1 queries for pipeline show jobs

Furkan Ayhan requested to merge 330707-pipeline-show-jobs-nplusone into master

What does this MR do?

This MR removes N+1 queries from the project pipeline show page.

  • The user relation is the most common N+1 query.
  • The downstream_pipeline relation is for bridge jobs, not so common.

Related to #330707 (closed)

detailed comment: #330707 (comment 658019136)

Screenshots or Screencasts (strongly suggested)

Screen_Shot_2021-08-23_at_16.33.51

How to setup and validate locally (strongly suggested)

  1. Run the development env with RAILS_PROFILE=true.
  2. Create a pipeline with some jobs.
  3. Make a request to the pipeline show page; curl http://gdk.test:3000/root/big-ci/-/pipelines/107.
  4. Trace the logs tail -f log/development.log in gitlab.

Metrics

This will help us to check later:

75th and 99th percentiles of duration and db count: https://log.gprd.gitlab.net/goto/0c32a928ed7751fe5d37f2f0b6f79220

Last 7 days:

Screen_Shot_2021-08-23_at_19.37.54

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • [-] 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
Edited by Mayra Cabrera

Merge request reports

Loading