Hey all, first post and still learning but of course time is always the enemy. So, I was given an image and said “we are going to have hundreds of connections”. The entire image is rather small and under python 3.10, and I have a few AWS server types I am testing, from the t3.small to a c3.large to find a sweet spot of CPU compared to container count. So the developer gave me the basic start command, I did some quick reading to try to start understanding what does what, but trying to understand the best practice for performance and redundancy. This is hosted in AWS, and I made a quick loop script to start 10 containers, this is the only part that is relevant
for I in {10..19}
do /usr/bin/docker run --restart always --detach --name docker-wxa$I -p 80$I:80 -v /var/run/docker.sock:/var/run/docker.sock aws-ecr/repo
done
When that runs, I get 10 containers, each on their own port 8010 - 8019. I can curl each, get the response, then with the load balancer, I can add each port and have 10 healthy nodes. The first issue is when we start to stress this just a little, the response times are terrible, so reading up, a lot of discussion is using the network host and not the ports. So when I remove the port, add a --network host (keeping it in the loop), and start, I see the containers all start up, and each appears on port 80 (which is fine). Response time was slightly better, but I am also looking at the --restart always flag, and when under stress, a docker container ls shows them, however a lot keep restarting (not sure if that is CPU / stress also).
Lastly, trying to see where the default start is for docker as I have a startup script, but the service is starting first using the old config, I need to stop that, then manually start from my script.
So in a recap (and make it questions).
- Best practice for multiple containers, network host or multiple ports?
- Better to have multiple small machines with less containers or larger with more containers?
- Default config/startup
I did start reading about docker swarm but trying to see if that is needed, suggested, etc.
Thank you again and looking forward to learning this as I can see a lot of use for it!