Top Banner
Performance of Docker vs VMs Presented By Ali Hussain August 21, 2014
42

Performance of Docker vs VMs

Jan 15, 2015

Download

Technology

Flux7

Docker, a wrapper around LXC containers, provides an excellent mechanism for low overhead virtualization. Docker allows isolated environments to be created in a single machine without imposing a performance overhead.

As organizations look for lightweight alternatives to using virtual machines, they are seeking a better understanding of Docker’s performance capabilities. This talk presents the results from Docker performance evaluations, starting with a bottom-up approach, comparing Docker against virtual machines and native on key performance indicators using microbenchmarks.

The performance based on a series of real-world benchmarks was presented. Also gain insights into how Docker works and how to set up Docker to fit individual needs.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Performance of Docker vs VMs

Performance of Docker vs VMs

Presented ByAli Hussain

August 21, 2014

Page 2: Performance of Docker vs VMs

Today’s Presenter:

Ali Hussain Co-founder & CTO Flux7

Prev: CPU Performance Analyst at Intel and ARM Flux7: Cloud and DevOps Solutions

Cloud and Devops for Web teams

Enterprise DevOps management

AWS Certified Team

Partners: Clients:

Page 3: Performance of Docker vs VMs

Other team members

Samprita Hegde

Performance Engineer at Flux7

Setup, execution, and collection of data

Check out our work on blog.flux7.com

Page 4: Performance of Docker vs VMs

Agenda

Background

Experimental results & deductions

Application in the real world

Page 5: Performance of Docker vs VMs

What is Docker?

Linux OS isolation tools made easy

A Docker container looks like a

virtual machine

Provide additional ‘goodies’ for app

development

Page 6: Performance of Docker vs VMs

Holy Grail of “Virtualization”

Page 7: Performance of Docker vs VMs

ApplicationHost Hardware

and OS

An application needs to communicate with outside world: H/W, OS, other processes

Page 8: Performance of Docker vs VMs

Communication

Network

FS

Packages

libraries

ApplicationHost Hardware

and OS

The application communicates through certain channels but each of these channels can also cause conflicts with other applications on the system

CPU steal

Memory full

Package versions

File path conflicts

Port conflicts

Conflict

Page 9: Performance of Docker vs VMs

CPU steal

Memory full

Package versions

File path conflicts

Port conflicts

CommunicationConflict

Isol

ated

by

abst

ract

ion

laye

r

Abs

trac

tion

Laye

r

Network

FS

Packages

libraries

ApplicationHost Hardware

and OS

Adding an abstraction layer allows the needed communication to happen as desired while isolating the the sources of contention

Page 10: Performance of Docker vs VMs

What we want

Allow communication

Prevent conflictover resources

A continuum of abstraction levels

Page 11: Performance of Docker vs VMs

How we pay for it

Start and stop time

Resource overhead(Memory, CPU)

Increased latency (Disk, Network)

Snapshot time and space

Page 12: Performance of Docker vs VMs

Where is Docker on this spectrum?

Virtual Machines

Native

Page 13: Performance of Docker vs VMs

Docker Abstraction

Use isolation features of the Linux kernel to give a VM-like

environment

Filesystem using chroot jails

Network using port forwarding

Resource and process isolation using cgroups

Page 14: Performance of Docker vs VMs

Test Platform

Memory

47 GB RAM 23 GB Swap

Processor

Intel(R) Core (TM) i7 CPU

OS: Ubuntu 12.04 LTS , kernel - 3.8.0-33-generic

Disk

2 drive raid1 (mirroring)

configuration

Docker version: 0.7.2, build 28b162e

* Some tests run on AWS because of specific needs

Page 15: Performance of Docker vs VMs

Start and stop times

Start Time Stop Time

Docker Containers <50ms <50ms

VMs 30-45 seconds 5-10 seconds

Page 16: Performance of Docker vs VMs

Memory

No overhead of running a guest kernel

Docker requires consumed memory not provisioned memory

Page 17: Performance of Docker vs VMs

CPU Overhead - Methodology

Measured using coremark

Microbenchmark measuring CPU performance

Page 18: Performance of Docker vs VMs

CPU Overhead

CoreMark Score

Docker KVM

0

15000

30000

45000

60000

Native

Page 19: Performance of Docker vs VMs

CPU Overhead

No noticeable difference between native, KVM, and Docker performance

KVM uses ~1.5% more CPU usage compared to Docker when idle

Page 20: Performance of Docker vs VMs

Network Performance - Methodology

Performance measured using iperf

Care about both latency and throughput

Page 21: Performance of Docker vs VMs

Network Throughput

0

15

30

45

60

Bandwidth (Gbits/sec)

Theoretical Scenario:Server and Client on same instance

NativeDocker

with port forwarding

Docker dedicated IP

KVM with network bridge

Page 22: Performance of Docker vs VMs

Network Throughput

Docker with port forwarding

Docker with a dedicated private IP

address

0

2.5

5

7.5

10

Bandwidth (Gbits/sec)

Practical Scenario:Server and Client on different instances

iperf on “native” c3.8xlarge instance

Page 23: Performance of Docker vs VMs

Network latency (lower is better)

Docker with port forwarding in a

VPC

Docker with a dedicated private IP

address

0

20

40

60

80

Latency (usec)

iperf on native c3.8xlarge instance

Page 24: Performance of Docker vs VMs

Network Performance

Both Docker and KVM can saturate 10GbE

Docker running inside a VM can still saturate 10GbE

Docker redirection latency ~10us

Page 25: Performance of Docker vs VMs

Disk Bandwidth

Measured using FIO - Stresses disk with different streams

A lot of variation but no clear winner

Different drivers causing differences with different scenarios

Page 26: Performance of Docker vs VMs

Application Benchmarking - Wikibench

Page 27: Performance of Docker vs VMs

Benchmark summary

Load performance:

Native, KVM, and Docker performed comparably

H/W and S/W advances in virtualization

Over micro and macro benchmarks

Docker shines in

Idle resource usage

Start and stop times

Page 28: Performance of Docker vs VMs

New technologies provide benefit only if

you drop the rules that were designed to

overcome the shortcomings of the old

technology

-- Dr. Eliyahu Goldratt

The nature of disruptive changes

Page 29: Performance of Docker vs VMs

Use Cases

Configuration Management

Multiple instances per box

Basic unit of provisioning resources

Page 30: Performance of Docker vs VMs

Configuration Management

Create configuration to work in your canonical environment and

emulate it

We already do this

○ Virtual machines

○ Python virtualenvs

Page 31: Performance of Docker vs VMs

Configuration Management

Why Docker?

Consistent environment

Many dev niceties

No memory overheadMinimize performance overhead

Page 32: Performance of Docker vs VMs

Configuration Management

Running identical code + configs across environments

Better code pipeline management

What we get?

Page 33: Performance of Docker vs VMs

Use Cases

Configuration Management

Multiple instances per box

Basic unit of provisioning resources

Page 34: Performance of Docker vs VMs

Multiple Instances per box

Multiple instances each running in own Docker container

Containers may communicate over TCP

Page 35: Performance of Docker vs VMs

Multiple Instances per box

Why Docker?

No idle memory and CPU overhead

Process and FS isolation

Port forwarding

Page 36: Performance of Docker vs VMs

Multiple Instances per box

High fidelity local dev environments

What we get

Multi-tenancy Server consolidation

Page 37: Performance of Docker vs VMs

Use Cases

Configuration Management

Multiple instances per box

Basic unit of provisioning resources

Page 38: Performance of Docker vs VMs

Basic Unit of Resource Provisioning

Allocate Docker containers instead of VMs

Can be both

Persistent resources

Very short tasks

Page 39: Performance of Docker vs VMs

Basic Unit of Resource Provisioning

Sharing of resources

Why Docker

Management of multiple images

Quick start and stop times

Page 40: Performance of Docker vs VMs

Basic Unit of Resource Provisioning

Faster provisioning

What we get

Lower overhead on host

Config management

Page 41: Performance of Docker vs VMs

Thank you, Docker!

For developing a very cool piece of technology

For making it OpenSource

Special thanks to Jerome Petazzoni

for supporting us

Page 42: Performance of Docker vs VMs

Thank You!

Twitter: @Flux7Labs

Blog: blog.flux7.com