After having some issues with the amount of DB queries / connections I decided to try redis for file locking with nextcloud.

Works great and performance wise it seems at least the same (i do not have enough users/traffic to be noticeable anyway to be fair)

so .. how I set it up .. first install (on Gentoo), start and add to boot default (openrc)

emerge -av dev-db/redis dev-php/pecl-redis
/etc/init.d/redis start
rc-update add redis default

By default it binds to localhost (which is fine for me) but you can change the config in /etc/redis/redis.conf - I did not change anything from the default config.

Test it works:

 # redis-cli> ping

The rest is just set up the config for nextcloud in config.php (according to the nextcloud docs about redis (nextcloud 19) ):

  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\OC\Memcache\Redis,'
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  'memcache.locking' => '\\OC\\Memcache\\Redis',

I made sure to restart apache in case you just installed pecl-redis btw, since I am not sure it would find / load the new module properly. Might be optional, but for me a quick server restart is not an issue.