[Newbie] MariaDB in CT: Question re: Recordsize Settings

Sep 1, 2022
484
182
48
41
Hello,

I'm getting ready to deploy my first containerized DB using the TurnkeyLinux MariaDB container template ( https://www.turnkeylinux.org/mysql ). I know that MariaDB wants a 16k block size for data storage.

This is the first time I've needed to worry about changing the recordsize on a CT. I'm not quite sure exactly what I need to do.

Here's what I think I need to do. Am I missing anything?
  1. Create a new zfs dataset and add it to PVE's storage via the console.
  2. Make sure the new dataset has a recordsize of 16k.
  3. Set up the new MariaDB container to use the 16k recordsize dataset for its storage.
Is that it? I feel like I must be missing something.

Thanks!
 
Yes, thats it.
Thanks! I've only ever worked with VMs before, so the CT part is new, too.

At first I thought I needed to set up two separate bind mounts--a 64k recordsize one for the OS and a 16k recordsize one for the data store.

I ... don't have to do that, right? I just want to double check before I start. :)
 
LXCs will use datasets. And datasets will inherit the recordsize from the dataset or pool below. So if you have a dataset "rpool/data/16K" and you set zfs set recordsize=16K rpool/data/16K and add a new ZFSPool storage pointing to "rpool/data/16K", then all virtual disks, so datasets, that PVE will store on that ZFSPool storage will inherit the 16K recordsize. Then a dataset "rpool/data/16K/subvol-100-disk-0" should automatically inherit the 16K recordsize.
 
Last edited:
  • Like
Reactions: SInisterPisces
LXCs will use datasets. And datasets will inherit the recordsize from the dataset or pool below. So if you have a dataset "rpool/data/16K" and you set zfs set recordsize=16K rpool/data/16K and add a new ZFSPool storage pointing to "rpool/data/16K", then all virtual disks, so datasets, that PVE will store on that ZFSPool storage will inherit the 16K recordsize. Then a dataset "rpool/data/16K/subvol-100-disk-0" should automatically inherit the 16K recordsize.
Thanks! This sounds straightforward enough that it'll either go really quick or I'll discover some esoteric way to screw it up. :P

Just to confirm, I should only expect to set up one virtual disk for a MariaDB, right? I can't imagine that in a container I would be expected to set up an OS install on a 64k blocksize dataset, and then set up a separate 16k dataset for the DB data?

Put another way: 16k recordsize is correct for the DB; I'm assuming the underlying OS inside the CT will be just fine running with 16k?

(Sorry if I'm being obtuse; I really don't want to boof this and have to redo it. :) )
 
Isn't that bad with datasets, as the recordsize isn'T a fixed size. If you set the recordsize to 16K, ZFS will decide for each record if it writes it as 4K, 8K, or 16K record. Have the default 128K recordsize and ZFS will decide between 4/8/16/32/64/128K records. So the recordsize is more like a "up to" value and not a fixed size, like the volblocksize for zvols.
 
  • Like
Reactions: SInisterPisces
Isn't that bad with datasets, as the recordsize isn'T a fixed size. If you set the recordsize to 16K, ZFS will decide for each record if it writes it as 4K, 8K, or 16K record. Have the default 128K recordsize and ZFS will decide between 4/8/16/32/64/128K records. So the recordsize is more like a "up to" value and not a fixed size, like the volblocksize for zvols.
Thanks! I keep forgetting that it's a ceiling value.

I assume there are still performance benefits to capping it at 16k for databases? I'm guessing ZFS isn't smart enough/magical enough to recognize that it's working with DBs and needs to stop at 16k? ;)