Default SQLite or MariaDB for Personal Use

Hi, I will be setting up NextCloud as a Docker container on my Ubuntu Docker server. I am wondering if I should use the default SQlite database or set up a MySQL/MariaDB instance. The NextCloud instance will have 4-5 users and will likely be < 1TB in total size. Will I see any benefit from using something other than SQLite and what is “safest” (with regards to corruption etc.) and easiest to back up?

Edit: On the same note. Will I have any benefit from memory cache using redis on a personal server setup?

Hey! At Nextcloud we really like MariaDB and I believe this is most commonly used
and I use redis on my personal server setup too

I could use som additional opinions here. I am setting NextCloud up in a Docker environment. If I do not get any benefits from using a MariaDB database (or redis), I would prefer sticking with SQLite. I imagine it is easier to manage in relation to backup etc. As mention my setup is only for personal use with a few users.

MariaDB and Redis have nothing to do with each other.
MariaDB is the Nextcloud Database (like SQLite or PostgreSQL).

“Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.” Wikipedia
Read also Memory caching in Nextcloud.

I think SQLite is only for test installations. It also works “perhaps” with only one user. SQLite is a file based database. But please do not use it in production.

Thanks for your input @devnull.

My question was probably poorly laid out. I am aware of the difference between MariaDB and Redis. It was actually ment to be two different questions.

I have read some blogs where it has been mentioned that SQLite is more than enough for home use (without any more reasoning behind that statement), hense my question regarding SQLite vs MariaDB for my purpose. From how I understand your reply you would never use that SQLite even for personal setup.

Regarding Redis memcache, I have read that it is supposed to improve the performance when used, but I wonder if this is a noticeable performance improvement in all use-cases of NextCloud or just for larger deployment. Will I for my use case see any significant improvements by using Redis?

Hi @norsemangrey

Actualy SQlite is quite robust. But at a certain point (rather sooner than later ) there will be massive performance problems, especially when the instance is accessed by several users at the same time. Also the database is only one factor. In addition to MariaDB I would strongly recommend you to set up and use Redis and PHP-FPM. The performance gains are huge, especially with frequent and concurrent requests. And if you also want to use additional functionlaity beside of just synchronizing and sharing files, like e.g. Calendar, Contacts, Tasks and Nextcloud Office, or if you are using the WebUI a lot, a proper database, Redis and PHP-FPM are a must imho. If everyone just uses the sync client, and not too many changes are made all the time, you can maybe get away without PHP-FPM and memory cache. But even then I would recommend to set these things up, if you have more than one or two users.

Thanks for the reply. Seems the general consensus is not to use SQLite for the long term at least.

I am not familiar with PHP-FPM and I’m not getting any wiser reading the NextCloud documentation. Could you explain what it is and how it is used in relation to NextCloud?

Frequent and concurrent requests is most likely not an issue for my use case. At the most the server will see concurrent requests from max two clients occasionally. The primary purpose for my NextCloud setup will be as a file server and I will most likely not use the additional functionality you mention.

I’m not a developer and can’t give you in-depth explenation how this all works, but this write up sums it up pretty nice…

https://www.digitalocean.com/community/tutorials/how-to-configure-apache-http-with-mpm-event-and-php-fpm-on-ubuntu-18-04

PHP-FPM is the FastCGI Process Manager for PHP. The FastCGI protocol is based on the Common Gateway Interface (CGI), a protocol that sits between applications and web servers like Apache HTTP. This allows developers to write applications separately from the behavior of web servers. Programs run their processes independently and pass their product to the web server through this protocol. Each new connection in need of processing by an application will create a new process.

By combining the MPM Event in Apache HTTP with the PHP FastCGI Process Manager (PHP-FPM) a website can load faster and handle more concurrent connections while using fewer resources.

In this tutorial you will improve the performance of the LAMP stack by changing the default multi-processing module from pre-fork to event and by using the PHP-FPM process manager to handle PHP code instead of the classic mod_php in Apache HTTP.

Then you will probbaly not necessarily need FPM/FastCGI. I still would recommend using MariaDB though.