nextcloud / nextcloud/server

Expensive share queries called multiple times

Open
#46,546 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 30-feedback bug feature: sharing performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

While looking into performance optimizations around the deck share provider I noticed that its method to get the shares for a user is called twice when browsing the webdav directory that has those share mounts.

Two call stacks for the two callers, first from the mountpoint setup and then from the dav SharesPlugin:

Screenshot 2024-07-15 at 20 00 51 Screenshot 2024-07-15 at 19 59 58

This seems recently introduced in: https://github.com/nextcloud/server/pull/45698/files#diff-5947edd0e3a7f223b815d6508d2906e2ead1c15583df9e6a240bc2a4c150a2e3R102-R107

Now we should only call the individual providers once but I'm unsure where to best put in a caching layer and how.

@nickvergessen I assume the talk getSharedWith method is also not the lightest?

While I'm about to optimize the deck one a bit more, i think this is something we should think about how we can avoid calling this logic twice.

cc @artonge @skjnldsv as mostly related to sharing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the two call stacks described for mountpoint setup and the DAV SharesPlugin, then review the referenced pull request that introduced the repeated provider calls. Determine where the individual provider results can be reused without changing behavior. Done means browsing the affected WebDAV directory invokes each provider only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.