Nextcloud felt sluggish, MariaDB was the bottleneck

My personal Nextcloud in Docker started feeling slow after updating to 33.0.0 (especially image browsing) even though the app container wasn’t busy. docker stats showed the DB container pegged while previews/thumbnails were generating.

What was happening:

  • lots of churn in oc_filecache (tons of DELETE … WHERE path_hash=…)
  • DB CPU stayed high while UI felt laggy
  • Nextcloud would hang and load endlessly after browsing a folder with lots of images or videos without thumbnails.

The Fix:

  • InnoDB buffer pool: bumped to 16GB so filecache queries stop hitting disk constantly.
  • Redo log sizing: increased redo logs (e.g. innodb_log_file_size = 2G) to handle heavy write bursts more smoothly.
  • Nextcloud DB recommendations: ensured DB is running READ-COMMITTED + binlog_format = ROW.
  • Indexes/repair: ran Nextcloud’s DB maintenance commands (missing indices / repair) to reduce expensive scans.
  • Throttled preview workload: reduced preview/imaginary concurrency so DB wasn’t being hammered by too many parallel preview jobs.

Lesson: when Nextcloud feels “slow”, check DB CPU + filecache churn first. Redis can be working perfectly and you’ll still feel lag if MariaDB is the bottleneck.