[Bug]: Caching in background jobs (almost) worthless when instance uses APCu for local caching
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
APCu cache memory is volatile. For web servers it lives as long as the webserver process. For CLI it lives as long as the cache.
We recommend APCu for local caching because it's faster than Redis and the TCP roundtrip.
Nextcloud uses a lot of background (cron) processes. When set up for performance, background jobs are triggered by a system cron. Within this cron, the APCu cache does work. Between two cron executions all cached values are lost. This severely limits the usefulness of caching.
Steps to reproduce
- Set up an instance with APCu as local cache
- Cache data in a background job
- Build on the cached value later on
Expected behavior
Cached value is there
Installation method
None
Nextcloud Server version
27
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named. Start by reproducing the APCu behavior across separate system-cron executions and trace the local-cache configuration and background-job cache access; done means values cached by one execution remain usable by a later execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100