Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficiently using multiple docker containers in a single host

I have a physical server running Nginx, MySQL and serving my PHP website. The server has Multi-Core processor with 16 GB of RAM. This server can handle certain amount of web traffic.

Now instead of this single server, if I run multiple docker containers running individual instances of Nginx (App Server) and MySQL (DB Server) in it and load balance between the application and database containers, will it be able to handle the same amount of traffic as a single server handled it or would it be lesser (Performance wise)?

How will the performance be if I use a virtual server like EC2 or Digital Ocean Leaflet with the same hardware configuration instead of a physical server?

like image 756
Gowtham Sadasivam Avatar asked Oct 14 '14 13:10

Gowtham Sadasivam


People also ask

Can we run multiple Docker containers on a single host?

With Docker compose, you can configure and start multiple containers with a single yaml file. This is really helpful if you are working on a technology stack with multiple technologies.

How many Docker containers can I run per host?

Using this simple calculation, we can estimate that we can run about 1,000 containers on a single host with 10GB of available disk space.

Can Docker have multiple containers?

Using the docker-compose CLI command, you can create and start one or more containers for each dependency with a single command (docker-compose up). The docker-compose.


2 Answers

Since all process run on the native host (you can run ps aux on host outside container and see them). There should be very little overhead. The network bridging and IP Tables entries to forward packets to virtual host will add some CPU overhead but I can't imagine that being too onerous.

like image 62
Usman Ismail Avatar answered Sep 25 '22 12:09

Usman Ismail


If the question is several nginx + 1 mysql versus several containers with each nginx + mysql, probably performance wise would be better not using containers, mainly because mysql and how much memory can have if is a single instance vs having multiple separate instances. You can anyway have the nginx in separate containers but using one central mysql for all sites, in a container or not.

like image 21
gmuslera Avatar answered Sep 22 '22 12:09

gmuslera