Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab FOSS
GitLab FOSS
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Issues
  • #61559

Closed
Open
Opened May 07, 2019 by Jan Provaznik@jprovaznikMaintainer

Use etag caching for Projects::MergeRequestsController#show widget serializer

Problem to solve

On every merge request page, frontend periodically (every 10 seconds by default) polls merge_requests/<id>.json?serializer=widget for changes. This query is very expensive because this widget contains a lot of information.

It also calls multiple gitaly calls (https://gitlab.com/gitlab-org/gitlab-ce/issues/37432#note_162513930) which is even more expensive for users using NFS storage.

Frequency of calls on gitlab.com:

  • json widget: https://log.gitlab.net/app/kibana#/discover/AWqSESGoLHa0LJnq82bT?_g=()
  • loading MR's html show page: https://log.gitlab.net/app/kibana#/discover/AWqSEnAALHa0LJnq9pDc?_g=()

Proposal

We could use etag caching for caching the whole request, as we already use this caching for some other endpoints. Etag cache would be invalidated when the merge request is changed or when other resources related to the merge request are changed.

The benefit is that it's easy to set up (as we already use it for other endpoints) and has big positive performance impact.

The challenging part is to make sure that we invalidate/expire etag cache key in all situations relevant to the merge request widget, but not impossible I think. Also this caching would be used for async polling only, if user reloads page he would always get fresh data, so even if we would forget about some situation when key should be invalidate, it's not a fatal problem.

We would also have to change the MR's widget path because currently etag caching doesn't support parameters (we use ?serializer=widget), or we would have to fix https://gitlab.com/gitlab-org/gitlab-ce/issues/58500 first. This is tracked by https://gitlab.com/gitlab-org/gitlab-ce/issues/62723 - which is prerequisite of this issue.

Links / references

  • https://gitlab.com/gitlab-org/gitlab-ce/issues/37432#note_162513930
  • &1190 (comment 162342027)
Edited Jul 04, 2019 by Douwe Maan
Assignee
Assign to
12.3
Milestone
12.3 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab-foss#61559