docker-compose vs. CPU limit
That was a painfull learning today 🙁 Best is to blog about it now, so hopefully somebody reads this before (or during) troubleshooting a similar issue.
What happened?
My home server was running crazy and did not server any requests. Oh well, it decided to reply my ping but not really allowing a SSH session.
So I needed to drag a TV downstairs to connect it via analog cable (fortunately I still found one), connect a keyboard and see that a process mono-sgen was eating all CPU 🙁 But what does it belong to? A ps -ef
revealed that it belonged to duplicati – which is my backup solution.
Great. I found the problem.
Now let’s fix it
I am deploying all my containers with docker-compose and searched for a way to limit the CPU usage. *gnarf* The used version 3.4 does not support the quotas anymore –> Compose file versions and upgrading | Docker Documentation
When I set the docker-compose version to 2.4 and adjusted my duplicati container like this, It uses half a CPU max.
duplicati:
image: duplicati/duplicati:beta
<strong><span class="has-inline-color has-vivid-red-color">cpus: "0.5"</span>
<span class="has-inline-color has-vivid-red-color">mem_limit: 512m</span></strong>
container_name: duplicati
...