it won’t necessarily take twice the resources of a single mysql container
It will as far as runtime resources
You can (and should) just use the one MySQL container for all your applications. Set up a different database/schema for each container
Comment on Adding services to an existing Docker nginx container
mudeth@lemmy.ca 10 months agoThat would be ideal, per my understanding of the architecture.
So will docker then minimize the system footprint for me? If I run two mysql containers, it won’t necessarily take twice the resources of a single mysql container? I’m seeing that the existing mysql process in top
is using 15% of my VPS’s RAM, I don’t want to spin up another one if it’s going to scale linearly.
it won’t necessarily take twice the resources of a single mysql container
It will as far as runtime resources
You can (and should) just use the one MySQL container for all your applications. Set up a different database/schema for each container
I’m getting conflicting replies, so I’ll try running separate containers (which was the point of going the docker way anyway - to avoid version dependency problems).
If it doesn’t scale well I may just switch back to non-container hosting.
To elaborate a bit more, there is the MySQL resource usage and the docker overhead. If you run two containers that are the same, the docker overhead will only ding you once, but the actual MySQL process will consume its own CPU and memory inside each container.
So by running two containers you are going to be using an extra couple hundred MB of RAM (whatever MySQL’s minimum memory footprint is)
AFAIK it won’t and should you still get a bottleneck you can limit the maximum resources a service may use.
moonpiedumplings@programming.dev 10 months ago
It’s complicated, but essentially, no.
Docker images, are built in layers. Each layer is a step in the build process. Layers that are identical, are shared between containers to the point of it taking up the ram of only running the layer once.
Although, it should be noted that docker doesn’t load the whole container into memory, like a normal linux os. Unused stuff will just sit on your disk, just like normal. So rather, binaries or libraries loaded twice via two docker containers will only use up the ram of one instance. This is similar to how shared libraries reduce ram usage.
Docker only has these features, deduplication, if you are using overlayfs or aufs, but I think overlayfs is the default.
moonpiedumplings.github.io/…/setting-up-kasm/#tur…
Please just run two databases on your single mysql container. That is best practice, and probably best for your sanity.
mudeth@lemmy.ca 9 months ago
Thank you for an excellent explanation and blogpost. I’m getting conflicting answers, even on this question, but most authoritative sources do backup what you’re saying re:FS. I’m trying to wrap my head around how that works, specifically with heavy processes. I’m running on a VPS with 2 GiB of RAM and
mysql
is using 15% of that.At this point I have my primary container running. I guess I’ll just have to try spinning up new ones and see how things scale.
This version-independence was what attracted me to docker in the first place, so if it doesn’t work well this way then I may just replace the setup with a conventional setup and deal with dependency hell like I used to - pantsseat.gif.