Most performant File System for MariaDB databases living in LXC containers

One of the (many) reasons I choose LXC + LXD over Docker + K8S is the straight forward (traditional) approach to storage that LXD uses.

When I first started learning about LXD, I found ZFS to be about the most practical thing you could pair with LXD, so I used it for almost 2 years, and I am very happy with it, especially being able to snapshot containers on the fly and launching those snapshots as containers on a different “backup server” and being able to recover containers by just bringing back the copy from the backup host almost instantly.

Now I find myself re-evaluating the usage of ZFS for the database containers due to performance concerns. On dedicated hardware, where I can give ZFS direct control over full physical devices, it is less of an issue, however, when using networked block devices on the cloud, I’ve tried all sorts of combinations and the performance seems not to improve much if you add several disks (or even to degrade the more disks you add), so I tend to stick to one disk (block device).

I run many instances of a PHP APP on containers and then I run the one corresponding database for those instances on another container. Meaning I have n copies of the APP with exactly the same number of database containers (1 to 1). This setup gives me a few very important advantages over the traditional approaches of running one RDMS for all the databases (and a few drawbacks of course), so I would like to keep using it (but I am not closed to alternatives).

So the question is, what would you recommend to use as FS for MySQL/MariaDB database containers?
- In the cloud (AWS mostly).
- On bare-metal

1 Like

have you seen the following? Im no storage expert so I cant chime in much other than this link but I think a lot of it will come down to testing in your environments!


Thanks @turtle0x1, that’s a very good read indeed! I will certainly use it for improving my ZFS performance…

The question remains about what the most performant FS is for databases living on LXC containers.
(ZFS is clearly not it, as explained in that post. However if I could reach anything near 10% worst performance compared to ext4, I would gladly pay the price and to stay with ZFS).

By the way, is good old LXCFS still relevant today?
“Now with the introduction of the cgroup namespace in the Linux kernel, that part is no longer necessary on recent kernels and focus is now on making containers feel more like a real independent system through the proc masking feature.”
I guess not, but would be interesting to hear some thoughts about it.

Hey Yosu, think you might have misunderstood. ZFS is more performant with the right tweaking than ext4 for databases. Ever since I found that out through testing on my VM I am strongly in love with ZFS.
For the right tweaking please look here:

Most important is sync=disabled which according to some other sources out there does not pose a problem regarding the theoretical 5 second dataloss.
Compression also improves performance and should always stay on.

1 Like

Holy wakamole! Thanks a lot @michacassola this is a very good resource indeed.
All I had read until now said ZFS was “OK” for MySQL but not comparable with ext4.

@turtle0x1 I realize now that you shared the same resource, since you pointed to Micha’s previous comment, I hope you don’t mind if I give him the “answer”.
I guess I need to do my homework and benchmark my own DB, just like you said…