nextcloud / nextcloud/server

Warn about potentially slow method

Open
#44,033 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop performance 🚀 technical debt
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

ICache::clean is potentially slow on Redis as removing all keys by prefix requires us to use KEYS which is a slow operation as it needs to walk all keys of the redis instance.

We cannot easily avoid this, but we should somehow make people aware of this and avoid merging cases where this is avoidable.

We could either

  • Log any clean calls as debug
  • Annontate the method in some way (e.g. @slow) and write a custom psalm plugin to catch those cases with static analysis

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 at ICache::clean and trace its Redis implementation and callers to identify where the potentially slow operation is triggered. Compare the proposed debug logging with the @slow and Psalm-plugin approach, then confirm which direction maintainers want. Done means the chosen warning or analysis mechanism is implemented and its affected call sites are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, redis
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.