nextcloud / nextcloud/server

Redis prefix causes ever-growing redis cache size

Open
#32,203 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: caching
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Whenever Nextcloud or an app is updated the Memcache prefix is changing and old stored keys without an expiry would just stay around forever. Since the prefix is also hashed and not easily genera table due to the app version list in place there is also currently no good way to clean them up manually.

https://github.com/nextcloud/server/blob/781784553889601d02553931aed8ff1fde95640b/lib/private/Server.php#L712-L726

Maybe we could consider having a predictable global prefix, so we could also introduce a nightly job to delete outdated keys?

On the other hand deleting keys by prefix is a rather heavy operation as it requires a KEYS and then a DEL for each key on the Redis side, so maybe a default expiry of some weeks would also be something that we could consider.

cc @nextcloud/server-backend

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 reading lib/private/Server.php around lines 712-726 to understand how the Redis Memcache prefix is built. The issue needs a decision between predictable-prefix cleanup and default expiry behavior; it is done when one approach is specified, implemented, and its handling of old keys is verified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.