So, I was thinking about this batshite solution I encountered a few years ago. An industrial fab facility had a SAP server, big honking beast of a machine, 256 GB of RAM, and this was 2019, so yeah, money was spent.

But the database (mysql) was ostensibly, too slow. Their SAP consultants solution?

On boot, the system would take 128 GB of RAM, and create a ramdisk mounted on /mysql. It would then copy /var/lib/mysql, or wherever MySQL was stored into /mysql, and start the mysqld with flags to use the ramdisk.

Yes, this was absolutely insane, and tremendously fragile. But I digress. Every night at 0300, the mysqld was shutdown, and /mysql was rsynced to permanent storage. So, if they lost power in the middle of the day they lost potentially hours of work that had to be manually re-entered.

The punchline to this joke is that backing up the ramdisk to disk took about 40-45 minutes. The UPS backing this server had about half that in runtime. So, it never did anything even remotely useful. In fact, it sometimes lead to some terrible corruptions that had to be painstakingly repaired. Yes, they did have a script that was triggered by the UPS going on battery. It never finished on time.

Anyways...... My brain was thinking about this, and decided..... CAN WE MAKE THIS WORK?!?!?!?!!111???/one?!//111

I think we can, but I would like to state that this is insane, and probably _really_ expensive for fairly little gain.

But hear me out. System boots from a single disk ZFS stripe, creates a RAMDISK and adds it to the zpool as a mirror. Obviously, this would only work for smaller disks or shitloads of RAM, and really only benefits read performance.

Would I do this? Probably only to see if I could make it work, I doubt it is actually a useful solution. But, it popped into my head just now, and I had to get it out, just so my brain would stop thinking about it.

Thoughts?

@nuintari Run two jails. One runs the godawful-mysql-on-ramdisk setup. The other runs mysql against the disk. Run the ramdisk mysql as the primary and make the normal mysql a replicating secondary. It's still dumb, but you get only a short delay on writing back out to disk and your UPS shutdown script can just nuke the primary and attempt a clean shutdown on the secondary to be able to (hopefully) cleanly shutdown while there's power.

@overeducatedredneck This isn't far off from a proper solution.

1) better database tuning
2) better disk backend
3) proper fucking replication

heaven forbid, eh?

@nuintari Exactly. I mean, if you can hold all the DB filess in half the RAM, then the OS and database server should be caching most of it in RAM anyway.

At least once in my life, I improved database performance by using more RAM and CPU and worse (cheaper) disks.

@overeducatedredneck Yeah, the entire solution lacked proper understanding.
@nuintari @overeducatedredneck Wait - but can't you put a giant pile of ARC on RAM? Which means the reads will be properly quick (assuming there's regular DB walks) and then probably make a ramdisk write cache (or wildly fast disk). Let ZFS handle the cache flushes and the longterm storage, and let your RAM handle the reads and writes?