Docker vs. Virtual Machines: Understanding the Performance Differences

Here's what to know about the performance relationship between containers and virtual machines.

Christopher Tozzi, Contributing Editor

November 30, 2016

3 Min Read
Docker vs Virtual Machines Understanding the Performance Differences

Are containers better than virtual machines? That's a question MSPs now need to answer as Docker explodes in popularity. Here's what to know about the performance relationship between containers and virtual machines.

Containers are environments that host individual applications using a framework like Docker. Containerized application processes run in isolated environments directly on the host server. There is no hardware emulation required. Nor is there a need to install a complete guest operating system.

In contrast, virtual machines are full operating systems that run on virtual hardware. They are powered by hypervisors like VMware and KVM, which translate computing operations between a guest virtual machine and a host server. The translation process consumes system resources.

Performance Comparison: Containers vs. Virtual Machines

Virtual machines have to emulate hardware, while containerized applications run directly on the server that hosts them. That means containers should be faster than virtual machines, because they have less overhead.

In practice, however, as this IBM report notes, Docker containers come with their own performance "gotchas." In certain ways, containerized applications suffer a performance hit.

It's worth noting, too, that modern virtual hypervisors like KVM boast performance that is only marginally slower than non-virtualized servers. When the performance difference between a virtual machine and a bare-metal server is only about 2 percent, there is not much extra performance to be gained by switching from a virtual machine to a container — even if the container could deliver bare-metal performance, which it can't.

Performance Benefits of Containers

In certain ways, however, containers do out-perform virtual machines. In particular, containers offer:

  • Faster startup time. A containerized application usually starts in a couple of seconds. Virtual machines could take a couple of minutes.

  • Better resource distribution. Containers use up only as many system resources as they need at a given time. Virtual machines usually require some resources to be permanently allocated before the virtual machine starts. For this reason, virtual machines tie up resources on the host, even if they are not actually using them. Containers allow host resources to be distributed in an optimal way.

  • Direct hardware access. Applications running inside virtual machines generally cannot access hardware like graphics cards on the host in order to speed processing. Containerized applications can. (And companies like Nvidia are already taking advantage of this functionality.)

  • Less redundancy. With virtual machines, you have to install an entire guest operating system, which duplicates a lot of the components already running on your host server. Containers don't require this.

Conclusion

If clients ask you whether containers are "faster" or "better" than virtual machines, the answer is "it depends." Containers are lighter-weight, and they offer definite performance advantages in certain areas, like startup time. Depending on the type of workload you are contending with, however, containers may not be significantly faster than virtual machines.

As with all technologies, deciding which option is the best solution for your clients requires weighing their particular needs. There is no one-size-fits-all approach to choosing between containers and virtual machines.

 

Send tips and news to [email protected].

Read more about:

AgentsMSPsVARs/SIs

About the Author

Christopher Tozzi

Contributing Editor

Christopher Tozzi started covering the channel for The VAR Guy on a freelance basis in 2008, with an emphasis on open source, Linux, virtualization, SDN, containers, data storage and related topics. He also teaches history at a major university in Washington, D.C. He occasionally combines these interests by writing about the history of software. His book on this topic, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” is forthcoming with MIT Press.

Free Newsletters for the Channel
Register for Your Free Newsletter Now

You May Also Like