Hey there. I was recently having problems that every 3-5 Minutes it’s impossible to connect to my VPS for about 10-30 Seconds. After checking htop, I realised that during that time the CPU Usage is at 100%. I also saw that one of the Main Factors is clamd which appears to be part of Mailcow. CPU Usage sometimes jumps up to 101% (no idea how that is possible but it happens). Is there some way to fix this CPU Usage Issue or completely disable this clamd thing?
English
clamd taking way to much CPU Usage
Have something to say?
Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!
pkernstock Maybe you’re receiving a file attachment each 3-5 minutes which clamd, as antivirus, does its job and checks it for harmful stuff.
That’s not possible. We use Mailcow only for Support E-mails etc. and we’re receiving like max 5 E-Mail every day.
Which logs should I check?
The clamd Container seems to be restarting very often. Looks like every 1-2 Minutes. Is this normal?
Logs from your clamd container would be nice
CRUGG No, this is not normal. Services should not crash unexpectedly.
I think clamd-mailcow runs OOM while initializing. Perhaps not enough RAM. Should be disabled, if you only use it for support mails and don’t want to assign more RAM. Also disable Solr.
Just for anybody who finds this thread because their clamd-container is claiming the CPU for itself; I ran into this problem and didn’t just want to disable it, so I’ve added the following to docker-compose.override.yml:
version: '2.2'
services:
clamd-mailcow:
cpus: 0.5
mem_limit: 524288000
this limits the CPU-to half a single CPU, and the RAM to 500 MB.
Fixed the issues for me
My solution is definitely more aggressive but works. Just execute the following bash script after each docker-compose up -d. You could also run this on a schedule using crontab.
The script below essentially just finds any containers with “clamd” and “solr” as string in the name, and does 3 things:
1) Updates container restart policy to OFF (optional and useful command if you need it)
2) Stop the containers (required before deleting)
3) Delete containers
Here’s the script.
#!/usr/bin/env bash
docker update --restart no $(docker container ls -q -f "name=clamd")
docker update --restart no $(docker container ls -q -f "name=solr")
docker container stop $(docker container ls -q -f "name=clamd")
docker ps -a | grep "clamd" | awk '{print $1}' | xargs docker rm
docker container stop $(docker container ls -q -f "name=solr")
docker ps -a | grep "solr" | awk '{print $1}' | xargs docker rm
To return everything back to normal, simply just run:
docker-compose up -d