My application suffers from slow write actions into a MariaDB when the data directory of the server is on a different disk partition then the root partition.
I use a Raspberry Pi 3 with Raspbian Buster as OS.
The setup of slow performance:
- The SD card is divided into three partitions: first boot, second root, and third data.
- The root partition is set to read only, but shows slow performance with read-write performance too.
- I copied the MariaDb data directory by means of rsync to a location on the data partition and adjusted the mariaDB config file accordingly.
Setup of normal performance:
- As soon as I change the data directory in the MariaDb config file to a directory on the root partition, the speed of saving data in the database is as fast as expected.
For comparison: When the data directory is not on the root partition, the average time to write my data is dramatically increased by 14 seconds. I do not write much data, and usually it may take a round 1 second or even less.