https://orbstack.dev logo
Database storage best practices
# general
e
Are Docker volumes stored on the shared filesystem with OrbStack? I'm trying to understand where I should put things like mysql database data directory. Should I place it on the shared VirtioFS filesystem or a Docker volume (which, I assume, runs on the guest filesystem)? Everything seems to be working either way but I'm not sure if OrbStack was designed for storing databases on the shared FS
r
DDEV keeps databases as Docker volumes. Long ago in its history, we used bind-mounts for the database, but it presented both performance and compatibility problems. A bind-mount may be to an unpredictable filesystem; not so much of a problem if you're always on macOS. But a Docker volume is always linux, always great performance, and has no bind-mount latency to deal with.
e
Thanks for sharing your experience. I have been test driving OrbStack using bind mounts for large mysql databases, as well as redis and rabbitmq data. So far I haven't encountered any performance issues, OrbStack has been a dream. But I'll give volumes a try, perhaps there's even more performance I can squeeze out of my M1 Mac...
r
The only downside of volumes for databases (and it's not trivial) is that you don't innately know where the files are, and they may not get backed up in various situations. But the value in interoperability and performance for us has been enormous.
e
If only there was a way to migrate data from a bind mount to a docker volume. I assume I can't ssh into the Orbstack-managed VM which runs Docker containers?
The only other way I can think of is to copy the data files to the volumes which are exposed on the desktop but then I would be doing this over nfs afaik
Speaking of bind mounts though, I've been mounting PHP projects with Orbstack (which supposedly uses an optimized version of VirtioFS?) and the performance has been insanely good. Overall it's a much better experience than using Mutagen (which has its own fair share of issues) and I can't perceive any performance difference when compared with native Linux
Not sure what black magic OrbStack is doing but it works wonders
UPDATE: I've just migrated my mysql databases to a volume and the performance is absolute insanity, to be frank. It was already fast before but it's even faster now...
r
If you're using PHP and such and rolling your own solutions, you'll probably like DDEV quite a lot.
e
Our team uses our own specialized solution which we don't want to move away from since it's tailored for our specific use cases. But I experimented with ddev a little and it seems nice
@rfay an interesting finding: once I moved my database to a Docker volume, my disk writes per second nearly trippled during average use. Once I moved them back to the VirtioFS bind mount, all went back to normal.
Same database, same load
This makes VirtioFS bind mounts the preferred option because it causes much less writes by kernel_task over time