3 ms·
Docker Compose allows for resource limits which can be useful for testing harnesses. I know this works locally for v3.9: version: '3.9' services: some-
by booleanbetrayal 4y ago
Docker Compose allows for resource limits which can be useful for testing harnesses. I know this works locally for v3.9:
version: '3.9'
services:
some-container:
deploy:
resources:
limits:
cpus: '0.5'
memory: 1.5G
reservations:
cpus: '0.5'
memory: 1.5G
Reference: https://docs.docker.com/compose/compose-file/deploy/#resources https://docs.docker.com/compose/compose-file/deploy/#resourc...
- capableweb 4y agoAFAIK Docker doesn't run natively on macOS so it's running via a VM. And since you're already running it via a VM, might just lose the additional abstraction of Docker and set the limits on the VM directly.
- TheRealPomax 4y agoWhy try to mid-optimize though? Even when running with Rosetta, Docker's still faster than an 2015/2016 macbook pro (since we're talking about mid tier machines) so being able to throttle it even further is pretty useful.
- capableweb 4y ago> Why try to mid-optimize though? What do you mean mid-optimize? I'm just saying if you're running on macOS and want to limit resource usage, running it in docker in order to limit resource usage, feels like solving the problem at the wrong layer as you already are using a VM in that case, so just put the resource limitation directly on the VM instead.
- TheRealPomax 4y agoSure, but trying to put the limitations in place so that the VM runs slower is a ridiculous chore, whereas setting restrictions for a docker image Docker is a a few lines of trivially tweaked ascii. Running docker may be using a VM, but it's not a slow VM compared to mid-tier machines, something running at half the speed of the M1 is still running considerably faster than the target you're trying to hit, so just tell docker to slow down instead of trying to mess with MacOS behaviour. Hence the mid-optimization: don't go "the VM's already slow, tweak that", just keep going and tweak Docker, it's almost trivially easy, and trivially replicated on any other machine should you need to either scale or hand off.
- capableweb 4y ago"put the limitations in place so that the VM runs slower is a ridiculous chore" It's just as easy as tuning docker. Every VM gets resources allocated to it, that you, as a user, can customize however you want. Most major VM implementations have this for you to use today already. Just as replicable as tuning docker container parameters.