7

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?

2 Answers2

4

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.

Usman Ismail
  • 17,999
  • 14
  • 83
  • 165
  • I understood the overhead will be less. But my question is regrading the server _performance/traffic handling_. Will the containerized server be **able to handle the same amount of traffic** it can handle as a single server? Single server will have one instance of Nginx & MySQL running in it and serve my PHP website. Containerized server will have multiple instance of Nginx & MySQL containers running in it and load balanced between them. Both the servers will have the same hardware configuration. Now which server can serve the traffic efficiently? – Gowtham Sadasivam Oct 14 '14 at 19:29
  • Yes performance will be the same. There will be a negligible amount of extra CPU used otherwise there is nothing else different from running those processes without containers. – Usman Ismail Oct 14 '14 at 19:38
  • I'm wondering, If the performance of the containerized server and non-containerized server are same, what is the purpose of using Docker/containers in production? Why we need products like CoreOS? – Gowtham Sadasivam Oct 15 '14 at 05:27
  • 2
    From their website "CoreOS is designed for security, consistency, and reliability." Notice no performance gains mentioned. The goal of docker is to provide isolated environments for applications that are repeatable. That way if one service gets compromised the others on the host are safe. In addition Dependency management gets easier, i.e. you can be sure you won't break one service because you updated a dependency for another. – Usman Ismail Oct 15 '14 at 13:27
1

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.

gmuslera
  • 415
  • 2
  • 2
  • I think that's the core of the question: What's the cost of flexibility (having a independent and complete set of containers for every application on one host that can be moved easily) in terms of performance (running multiple instances of the same server software, like MySQL, nginx). Any experiences would be appreciated. – Bachi Mar 26 '15 at 16:32