I am running 8 docker containers. When I am running the containers, my ec2 instance becomes very slow, sometimes stops responding. When I stop the containers it is working fine.
When I run docker-compose down it gives me timeout.
Sometimes the server works fine.
I am using docker version 20.10.23, docker-compose version 1.25.5
Your post does not mention the instance type (cpu/ram), nor how many resources the container require at peak, nor how much load is on the system. We also don’t know the deployed containers use cpu/memory request/limit or not.
For all we know the system could be drowning from load because of overpromising.
Thanks for your response. Here is the relevant information:
instance type -
vcpu - 2
RAM - 1 GiB
- loadavg 1min - 6.44
- loadavg 5 mins - 6.88
- loadavg 15 mins - 7.33
docker stats output:
The instance size is way to small for decent operation. With two cpu’s the load should not be more than 2 for your system to catch up with it.
If you put into account the OS runs services that require memory as well, your system could be constantly busy with swapping, especially if the peak resource usage is beyond what the point in time snapshot shows.
I am not surprised the system is slow. Try a bigger instance size. You can shut down the instance, change the size and restart it again, there is no need to delete the instance.
It’s up to you to find the sweet spot between required instance size and pricing.
But I have the same processes running on a similar instance (t3a.micro) and it is running well.
Loadavg of another instance