Skip to content
Snippets Groups Projects

Performance improvements after caching html fragments

Merged username-removed-444 requested to merge cache-commits-render into master
  • re-use event cache with other users
  • cache commit fragment
  • cache issue fragment in list
  • cache comment parsed with markdown

Merge request reports

Pipeline #56585 passed

Pipeline passed for 70666a52 on cache-commits-render

Approval is optional

Merged by avatar (Mar 28, 2025 5:57am UTC)

Merge details

  • Changes merged into master with 70666a52.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Added 1 commit:

    • 70666a52 - Use to_reference menthod when render issue id in list
  • username-removed-444 Status changed to merged

    Status changed to merged

  • mentioned in commit e934a62a

  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 56 56
    57 57
    58 58 .note-body{class: note_editable?(note) ? 'js-task-list-container' : ''}
    59 .note-text
    60 = preserve do
    61 = markdown(note.note, {no_header_anchors: true})
    59 = cache [note, 'markdown'] do
  • @dzaporozhets I just realized the "Push" event also depends on the current user since the "Create Merge Request" link is only shown if it concerns the user's own push.

  • @DouweM that bad. I dont want push to be cached with current_user - it does not give good benefits in this way.

  • I really don't like fact that shared resources like dashboard event or comment are rendered with current_user context. We should get rid of this.

  • Basecamp has a really cool idea for this, where they render both the the author == current_user and author != current_user Versions at the same time, with `data-user="username"

  • Commented too soon, and can't edit on phone :(

    Continuing:

    data-user-is="DouweM" on the one and data-user-is-not="DouweM" on the other, and then use dynamic CSS to show the appropriate one:

    [data-user-is="DouweM"] {
      display: block;
    }
    
    [data-user-is-not="DouweM"] {
      display: none;
    }
  • That way the whole thing can be cached, and the user will always see the appropriate parts.

  • (we'd also need to CSS to hide the one with data-user-is for everyone else, but that's really straightforward)

  • @DouweM interesting proposal. Please submit merge request!

  • mentioned in merge request !1014 (merged)

  • mentioned in issue #2033 (closed)

  • mentioned in issue #2034 (closed)

  • Valery Sizov mentioned in commit 95d89e44

    mentioned in commit 95d89e44

  • Again I will repeat:

    • markdown rendering is slow. It should be cached. Especially for comments which are rendered again and again in popular issues
    • events and comment rendering should not depends on current user context. Its bad architecture design. We pass current user variable so deep into code that it becomes scary.
    • if you revert caching in 7.13 make sure to create issue and bring it back in 7.14 with proper fixes

    Cc @vsizov @DouweM

  • markdown rendering is slow. It should be cached. Especially for comments which are rendered again and again in popular issues

    Agreed.

    events and comment rendering should not depends on current user context. Its bad architecture design. We pass current user variable so deep into code that it becomes scary.

    It seems to be that this in inevitable, since group and project referencing (and following from that, issue, MR, commit, etc) inherently depends on what groups/projects exist as far as the user knows.

    if you revert caching in 7.13 make sure to create issue and bring it back in 7.14 with proper fixes

    That's the plan :)

  • @DouweM markdown processing and filtering what is available to user should be separated. Markdown != authorization. We can cache markdown output but always process authorization filter

  • mentioned in issue #2063 (closed)

  • Started a new issue for discussion, see system note above.

  • @dzaporozhets Rendering @private-group as a link leaks group existence. Rendering public-group/private-project#123 as a link leaks project and issue existence, and leaks the issue title since it's in the HTML link's title attribute. As far as I can see, Markdown and authorization need to go hand in hand, at least to some extent.

    Idea:

    Render every link in Markdown, regardless of the current_user's access level, adding data-group_id and data-project_id to all rendered links. Cache this output HTML. Upon rendering, run one last pipeline processor over this cached HTML, that will verify access to the group and project IDs, and replace the links by their text content if the user doesn't have access.

    This would allow caching of almost all of the overhead of Markdown rendering.

    cc @rspeicher

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading