Web: ownCloud Transactional file locking should be configured

By | June 12, 2021

Getting the following notice from your ownCloud administrator account setting page?

Transactional file locking should be configured

ownCloud have the capability of managing file/folder locking on its own, on top of the filesystem. This is a must-have feature especially for large, busy, multi-users servers, and especially when users use their account on multiple devices. You can implement this feature by adding Redis server.

Note: This example assume you are running Debian Linux.

1. Install Redis on your server:

apt-get install redis-server php-redis

Informational: See optional Redis tuning options at the end of this article.

2. Append the Redis connection parameters to ownCloud “config.php”:

  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => [
    'host' => 'localhost',
    'port' => 6379,
  ],

Note: for very large installation, distributing components such as the caching servers separately is a good idea. In that case just adjust the “host” parameter to point toward the separate instance of Redis server/cluster.

3. Make sure Redis server is started and restart Apache server as well:

systemctl status redis
systemctl status apache2

Reloading your ownCloud setting page should no longer have the notification about transactional file locking configuration.

Optional: Redis server tuning:

Create a file named “/etc/sysctl.d/Redis-Tuning.conf” with the following content:

net.core.somaxconn = 65365
vm.overcommit_memory = 1
vm.swappiness = 1

Add the following to “/etc/rc.local”:

echo never > /sys/kernel/mm/transparent_hugepage/enabled

Tune Redis server by editing “/etc/redis/redis.conf”:

# TCP Keepalive
tcp-keepalive 0

# RDB Persistence
save 900 1
save 300 10
save 60 10000
rdbcompression no
rdbchecksum no

# Append Only File
appendonly no

The settings above may not be appropriate for some use case or servers with low amount of resources. They have been proven to be ideal in my case for large and busy servers.