Does Nextcloud Need Redis? Tested in Docker, With and Without

On a small home server you don't need Redis. The official Docker image already caches with APCu, Nextcloud's manual says a home server needs only that, and in our test Redis made uploads no faster. What it changes is file locking, which moves off the database. That matters on a busy server. Once you add it, Nextcloud answers Internal Server Error whenever Redis is down.

Watch on YouTube · published Nov 24, 2026 · 5:33

On a small home server you don't need Redis. The official Nextcloud Docker image already turns on a memory cache, APCu, and Nextcloud's own manual says that a small or private home server should only use APCu. We timed the same uploads with and without Redis, and they took the same time. What Redis changes is file locking: the locks move from the database into memory. That takes load off the database, which matters when lots of people use the server at once. And once you add Redis, Nextcloud depends on it. Stop Redis and Nextcloud answers Internal Server Error.

We tested this in November 2026 on Nextcloud 35.0.1 (nextcloud:35.0.1-apache) with postgres:16-alpine and redis:7-alpine, in Docker on a Linux server.

What does the "Transactional File Locking" note mean?

On a fresh Docker install, Administration settings → Overview shows a blue note: "The database is used for transactional file locking. To enhance performance, please configure memcache, if available." Blue is information, not an error. While a file is being saved, Nextcloud marks it as busy so that a second save cannot land on top of it. Those marks are file locks, and by default Nextcloud keeps them in the database. You will not see a warning about a missing memory cache on the Docker image, because the image already sets memcache.local to APCu.

Does Redis make Nextcloud faster?

Not on a small server, in our test. Same server, same work, with and without Redis:

TestWithout RedisWith Redis
200 small files uploaded one at a time (WebDAV)144.5 s, 141.3 s143.5 s, 146.4 s
The same, a later pair while the box was busier218.6 s218.2 s
10 clients at once, 300 files in total21.1 s, 20.5 s21.3 s, 20.1 s
Writes to the database's lock table, 200 uploads2,4100
Database transactions, 200 uploadsabout 23,600–24,000about 20,900

Every upload succeeded in every run. So Redis took the file locks off the database (about twelve percent less database work) without changing how long anything took. Nextcloud's manual on transactional file locking says database locking "places a significant load on your database" and that admins of servers with heavy workloads should install a memcache. A home server with a few people is not that workload. If your Nextcloud feels slow, Redis is unlikely to be the reason.

When should I add Redis to Nextcloud?

The manual's memory caching page recommends, by kind of server:

  • Small/private home server: only APCu.
  • Organization on a single server: APCu for the local cache, Redis for the distributed cache and for file locking.
  • Several web servers: a shared Redis (or Memcached) that every one of them points at, never localhost.

How do I add Redis to Nextcloud in Docker?

Two changes. Run a Redis container on the same Docker network as Nextcloud, then give the Nextcloud container REDIS_HOST and recreate it. Replace nextcloud-net and redis with your own names:

docker run -d --name redis --network nextcloud-net --restart unless-stopped redis:7-alpine
# then recreate the Nextcloud container with one more setting:
#   -e REDIS_HOST=redis

With Docker Compose:

services:
  redis:
    image: redis:7-alpine
    restart: unless-stopped
  app:
    image: nextcloud:35-apache
    restart: unless-stopped
    environment:
      REDIS_HOST: redis
    depends_on:
      - redis
    # …your existing volumes, database settings and ports

You don't edit config.php. The image ships a redis.config.php that switches on when REDIS_HOST is set, setting memcache.distributed and memcache.locking to Redis. memcache.local stays on APCu. The image also moves PHP sessions to Redis. To check it worked, reload the Overview: the Transactional File Locking note is gone. On the command line:

docker exec -u www-data nextcloud php occ config:system:get memcache.locking

To protect Redis with a password, set REDIS_HOST_PASSWORD on the Nextcloud container to match the password you give Redis.

What happens if Redis stops?

Nextcloud stops too. With Redis configured, we stopped the Redis container and reloaded: Internal Server Error, and nextcloud.log said RedisException: Redis server went away. It doesn't fall back to the database. Starting Redis again brought Nextcloud straight back, still signed in. So make Redis start whenever Nextcloud does: a restart policy such as unless-stopped, and in Compose, depends_on.

What about a plain Linux install, Valkey or Memcached?

On a non-Docker install you add the same lines to config.php by hand, after installing Redis and the PHP redis extension; the memory caching page has the exact block. The manual expects Valkey to work as a Redis-compatible server, and that Memcached can do distributed caching. We tested only Redis.

More guides to running your own Nextcloud are on the self-hosting page.

Full video transcript

1
00:00:00,000 --> 00:00:03,466
Do you need Redis for Nextcloud?
On a home server, no.

2
00:00:03,506 --> 00:00:06,907
The official Docker image
already has a memory cache,

3
00:00:06,947 --> 00:00:12,035
Nextcloud's own manual says a home server
needs only that, and when I timed it,

4
00:00:12,075 --> 00:00:13,918
Redis made uploads no faster.

5
00:00:13,958 --> 00:00:17,878
What Redis really does is take
file locking off the database.

6
00:00:17,918 --> 00:00:21,513
That matters when lots of
people use the server at once.

7
00:00:21,553 --> 00:00:26,681
And once you add it, Nextcloud can't run
without it. I'll show you all of that.

8
00:00:27,081 --> 00:00:28,947
This is Nextcloud thirty five.

9
00:00:28,987 --> 00:00:34,093
It runs in Docker, on a Linux server I
run myself, with Postgres as its database.

10
00:00:34,133 --> 00:00:37,905
It's a plain install, the way
the official image sets it up.

11
00:00:37,945 --> 00:00:41,438
We're in Administration
settings, on the Overview page.

12
00:00:42,697 --> 00:00:47,528
Here's the note that sends people looking
for Redis. Transactional file locking.

13
00:00:47,568 --> 00:00:50,694
The database is used for
transactional file locking.

14
00:00:50,734 --> 00:00:54,631
To enhance performance, please
configure memcache, if available.

15
00:00:55,884 --> 00:00:59,571
It's a blue note. Blue means
information, not a problem.

16
00:00:59,611 --> 00:01:01,967
And look at what isn't on this list.

17
00:01:02,007 --> 00:01:05,294
There's no warning that a
memory cache is missing.

18
00:01:05,334 --> 00:01:07,729
The Docker image already set one up.

19
00:01:08,991 --> 00:01:13,141
So there are two different things
here. The first is called APCu.

20
00:01:13,181 --> 00:01:16,429
It's a memory cache inside
PHP, on this one server.

21
00:01:16,469 --> 00:01:19,265
Nextcloud keeps things
it needs often there,

22
00:01:19,305 --> 00:01:21,972
so it doesn't have to work them out again.

23
00:01:22,012 --> 00:01:25,840
The official image turns it on
for you. The second is Redis.

24
00:01:25,880 --> 00:01:31,255
That's a small server of its own, running
beside Nextcloud. It can hold a cache too.

25
00:01:31,295 --> 00:01:34,196
But the job this note
is about is file locks.

26
00:01:35,519 --> 00:01:36,859
A file lock is simple.

27
00:01:36,899 --> 00:01:40,183
While a file is being saved,
Nextcloud marks it busy,

28
00:01:40,223 --> 00:01:43,758
so a second save can't land
on top of it halfway through.

29
00:01:43,798 --> 00:01:48,650
Those marks have to live somewhere. Out
of the box, they go into the database.

30
00:01:48,690 --> 00:01:50,884
Redis keeps them in memory instead.

31
00:01:52,164 --> 00:01:53,216
So do you need it?

32
00:01:53,256 --> 00:01:56,127
Nextcloud's manual has a
page on memory caching,

33
00:01:56,167 --> 00:01:58,956
with a recommendation
for each kind of server.

34
00:02:00,165 --> 00:02:03,959
For a small or private home
server: only use APCu.

35
00:02:03,999 --> 00:02:06,759
That's what this server already has.

36
00:02:07,990 --> 00:02:11,952
For an organisation on a single
server, the advice changes.

37
00:02:11,992 --> 00:02:15,208
Use Redis for everything
except the local cache.

38
00:02:15,248 --> 00:02:19,792
So APCu stays, and Redis takes the
shared cache and the file locks.

39
00:02:21,052 --> 00:02:24,071
The manual's page on
file locking says why.

40
00:02:25,281 --> 00:02:29,441
Locking through the database places
a significant load on your database.

41
00:02:29,481 --> 00:02:31,425
A memory cache relieves that load.

42
00:02:31,465 --> 00:02:35,082
And that load grows with the
number of people working at once.

43
00:02:36,324 --> 00:02:40,160
So I tested what that means on
a small server like this one.

44
00:02:40,200 --> 00:02:43,455
Same server, the same work,
with and without Redis.

45
00:02:43,495 --> 00:02:47,266
First, two hundred small files,
uploaded one after another.

46
00:02:47,306 --> 00:02:51,594
About two and a half minutes without
Redis. About the same with it.

47
00:02:51,634 --> 00:02:55,987
Then ten people uploading at once,
three hundred files between them.

48
00:02:56,027 --> 00:03:00,549
About twenty one seconds, either way.
Every upload worked, both times.

49
00:03:01,855 --> 00:03:05,674
So it wasn't faster. What did
change is where the locks went.

50
00:03:05,714 --> 00:03:07,762
During those two hundred uploads,

51
00:03:07,802 --> 00:03:13,076
the database's lock table took about two
thousand four hundred writes without Redis.

52
00:03:13,116 --> 00:03:17,757
With Redis, none. The database did
about twelve percent less work overall.

53
00:03:17,797 --> 00:03:22,122
With a few people on the server,
the database copes with that easily.

54
00:03:22,162 --> 00:03:25,895
On a busy one, that's the load
the manual is talking about.

55
00:03:28,409 --> 00:03:34,283
If your server is busy enough to need it,
adding Redis in Docker takes two changes.

56
00:03:34,323 --> 00:03:38,772
Run a Redis container, on the
same Docker network as Nextcloud.

57
00:03:38,812 --> 00:03:43,261
Then give the Nextcloud container
one more setting, REDIS_HOST,

58
00:03:43,301 --> 00:03:46,538
set to that container's
name, and recreate it.

59
00:03:46,578 --> 00:03:48,390
You don't edit config.php.

60
00:03:48,430 --> 00:03:54,343
The image already has a config file that
turns Redis on when that setting is there.

61
00:03:55,671 --> 00:03:57,692
The note about locking is gone now.

62
00:04:01,826 --> 00:04:04,428
The note about file locking is gone.

63
00:04:05,644 --> 00:04:10,530
Here's what Nextcloud's config says
now. The local cache stays on APCu.

64
00:04:10,570 --> 00:04:15,497
The shared cache and the file locks
go to Redis, at the host you named.

65
00:04:16,754 --> 00:04:21,341
Now the catch. Once Nextcloud uses
Redis, Redis is part of your server.

66
00:04:21,381 --> 00:04:25,421
Watch what happens if it stops.
I'll stop the Redis container.

67
00:04:27,896 --> 00:04:29,022
Reload.

68
00:04:29,722 --> 00:04:33,948
Internal Server Error. Nextcloud
doesn't fall back to the database.

69
00:04:33,988 --> 00:04:36,408
Without Redis, it can't answer at all.

70
00:04:38,857 --> 00:04:41,832
The log says why. Redis server went away.

71
00:04:41,872 --> 00:04:46,612
So if you add Redis, make sure it
starts whenever Nextcloud does.

72
00:04:46,652 --> 00:04:50,804
In Docker, give it a restart
policy, like unless stopped.

73
00:04:50,844 --> 00:04:55,035
In Compose, also list it under
depends on, for Nextcloud.

74
00:04:57,520 --> 00:05:00,200
Start Redis again, and reload.

75
00:05:01,818 --> 00:05:03,990
And Nextcloud is back.

76
00:05:05,807 --> 00:05:08,460
So. On a home server,
you don't need Redis.

77
00:05:08,500 --> 00:05:13,533
The Docker image already has APCu, and
that's what Nextcloud's manual recommends.

78
00:05:13,573 --> 00:05:16,602
In my test, Redis didn't
make uploads any faster.

79
00:05:16,642 --> 00:05:21,675
What it does is take file locks off the
database, which matters on a busy server.

80
00:05:21,715 --> 00:05:24,306
If you add it, it's two changes in Docker,

81
00:05:24,346 --> 00:05:27,250
and Redis has to start
whenever Nextcloud does.

82
00:05:27,290 --> 00:05:29,920
The commands are on the page linked below.


Related reading