SlideShare a Scribd company logo
1 of 54
Download to read offline
Containers > VMs
About Me
● Drupal
○ Infrastructure
○ Security
○ Performance/scalability
● systemd
○ Scalability
● Pantheon
○ CTO and Co-founder
○ Millions of containers
Mo Servers, Mo ProblemsMo Servers, Mo Problems
With Thanks to Nick Stielau’s…
The Goals of Computing
1. Making it Work
2. Making it Efficient
○ Running the software
○ Developer time
3. There is no #3
Data centers take 2% of US power.
“Power, Pollution and the Internet,”
New York Times, 2012
We’re not using it efficiently.
“Host server CPU
utilization in Amazon EC2
cloud,” Huan Liu's Blog,
2012
7.3%
Average
I’d like
to sell
you a
time-
share.
A Brief History of Timesharing
● 1950s Batch processing
● 1970s Terminals and VMs on mainframes
● 1980s Client/server
● 1990s Thin GUI clients to servers
● 2000s Web clients connect to servers
● 2008s Web/mobile clients connect to cloud VMs
Why
People
Like
Virtual
Machines
Great About VMs: Consolidation
“Skeuomorphs are stories of utility frozen in time. A new kind of
affordance—a cultural affordance—that provides the context we
need to understand the possibilities for action. They don’t work
because they coddle or educate the user—digital wood grain shelves
and page-flips didn’t teach people how to read ebooks—they work
because they leverage a user’s past experience and apply that
understanding to something new.”
John Payne, “Does Skeuomorphic Design Matter?”
Great About VMs: Familiarity
Great About
VMs: Slicing
Great About VMs: Portable Unit
Migration, failover, high availability,
consistent hypervisors, consistent images
Great About VMs: Automation
Great About VMs:
Maturity and
Efficiency
99% Efficient at
Running the OS
and Application
Containers are
the next step.
Exactly! Why stop at virtualization?
Containers Revolutionized Shipping Costs
An Amended History: Containers
● 1986 AIX 6.1 with Workload Partitions
● 2000 FreeBSD 4.0 with Jails
● 2005 Solaris 10 with Zones
● 2007 Google lands cgroups in the Linux kernel
● 2010 systemd
● 2013 Docker and CoreOS
● 2014 LXC 1.0 and geard
Containers
vs. Virtual
Machines
Let’s
Contrast
“Skeuomorphs are material metaphors
instantiated through our technologies in artifacts.
They provide us with familiar cues to an
unfamiliar domain, sometimes lighting our paths,
sometimes leading us astray.”
Nicholas Gessler, “Skeuomorphs and Cultural Algorithms”
Familiar Doesn’t Make It Good
Tiny Container Slices are Useful
Rackspace retired 256MB VMs because you couldn’t run an
OS and a useful workload in that space. Containers only
need the resources for an application.
Efficiency in a New Category
Trains and planes are efficient, but not compared
to making travel unnecessary.
Containers don’t need to run an operating system.
Containers are Portable
— and Lighter
Migration of
Application
vs. Full OS
Containers
offer faster
automation
Time to container
$: systemd-nspawn -D /srv/debian/ date
Spawning namespace container on /srv/debian.
Init process in the container running as PID
9159.
Tue Jun 3 17:32:14 UTC 2014
real 0m0.007s
user 0m0.001s
real 0m0.007s
Containers at Pantheon
In the Real World
Density at
Pantheon
30GB servers
/ 150 containers
= 205MB each
Container Provisioning
Mostly
< 20 seconds
fully configured
Some are on
bare metal!
The Bones of Containers
Containers
are based on the
CGroups and Namespaces
functionality on the Linux kernel
cgroups is merely
a hierarchy of
processes All processes
Development
processes
PHP-FPM Drush
Production
processes
Drush Rsync
75% 25%
cgroups is merely
a hierarchy of
processes All processes
Processes for
people I don’t like
PHP-FPM Drush
Processes for
people I like
Drush Rsync
2%98%
cgroups submodules aka Controllers
● memory: Memory controller
● cpuset: CPU set controller
● cpuacct: CPU accounting controller
● cpu: CPU scheduler controller
● devices: Devices controller
● blkio: I/O controller for block devices
● net_cls: Network Class controller
● ...
Kernel Interaction: /proc, /sys/fs
# Inspect ip forwarding setting
$: cat /proc/sys/net/ipv4/ip_forward
# Turn ip forwarding off/on
$: echo "0" > /proc/sys/net/ipv4/ip_forward
$: echo "1" > /proc/sys/net/ipv4/ip_forward
# Examine file descriptors used by nginx..
$: ls -l /proc/$NGINX_PID/fd/
lrwx------ 1 root Jun 3 13:48 0 -> /dev/null
lrwx------ 1 root Jun 3 13:48 10 -> socket:[64376]
l-wx------ 1 root Jun 3 13:48 2 -> /var/log/nginx-access.log
# Nuke logs
$: rm -rf /var/log/nginx-access.log
# Read log (even after you rm -rf’d it!)
$: tail /proc/$NGINX_PID/fd/2
62.211.78.166 - - [05/May/2014:10:00:54 +0000] "GET /vtiger.php
Kernel Interaction: /proc, /sys/fs
# Create a Control Group named “AA”
$: mkdir /sys/fs/cgroup/memory/AA
# New directory magically contains...
$: ls /sys/fs/cgroup/memory/AA
cgroup.clone_children
memory.kmem.usage_in_bytes memory.
limit_in_bytes
cgroup.procs memory.
max_usage_in_bytes … ...
Managing cgroups: manually
# Limit AA’s memory to 100 bytes
$: echo 100 > /sys/fs/cgroup/cpu/AA/memory.
limit_in_bytes
Managing cgroups: manually
Creating cgroups: libcgroups
# Create a Control Group named “AA”
$: cgcreate -g cpu:AA
# Set the ‘cpu.shares’ to 100 for “AA”
$: cgset -r cpu.shares=100 AA
# Run a python script in the “AA” control group
$: cgexec -g cpu:AA python test.py
# Limit teensy’s memory to 100 bytes
$: cgcreate -g memory:teensy
$: cgset -r memory.limit_in_bytes=100 teensy
# Associate current shell’s PID with “teensy”
$: echo $$ > /sys/fs/cgroup/memory/teensy/tasks
# Any command will exhaust memory
$: ls
Killed
memory.limit_in_bytes in action
cpu.shares in action
PID USER PR NI VIRT RES SHR S %CPU
9693 root 20 0 107908 624 532 R 60.08
9692 root 20 0 107908 624 532 R 6.307
cpu.shares = 100
cpu.shares = 10
# Run script within each cgroup
$: cgexec -g cpu:AA python test.py &
$: cgexec -g cpu:BB python test.py &
$: top
● Mount
● IPC
● PID
● User
● UTS
● Network
Kernel Namespaces
“Before one can share,
one must first unshare”
- Share Bear
# Run a shell with isolated
# network namespace:
$: unshare --net /bin/bash
Container Frameworks
LXC
● The liblxc library
● Several language bindings (python3, lua,
ruby and Go)
● A set of standard tools to control the
containers
● Container templates
Let Me Contain That For You (lmctfy)
● Created by Google
● Open Source(ish)
● Every process at Google runs within
lmctfy
● Supports nested containers
systemd-nspawn
● From systemd project “PID EINS!”
● Will ship with all Fedora, RHEL, Ubuntu1
[1] It will ship even with you on board
https://speakerdeck.com/joemiller/systemd-for-sysadmins-what-to-expect-from-your-new-service-
overlord
# Launch Vagrant
$: vagrant ssh
# Install a base debian tree
$: debootstrap unstable /srv/debian/
# Launch a debian container
$: systemd-nspawn -D /srv/debian/
systemd-nspawn
Docker
“In its early age, the dotCloud platform used
plain LXC (Linux Containers)....The platform evolved,
bearing less and less similarity with usual Linux
Containers.”1
[1] http://blog.dotcloud.com/under-the-hood-linux-kernels-on-dotcloud-part
[2] https://prague2013.drupal.org/session/automate-drupal-deployments-linux-containers-docker-and-
vagrant
Containerizeralater Spectrum
Docker nspawn lxc lmctfy
And once you get containers….
http://coreos.com/blog/cluster-level-container-orchestration/
Container Managers
https://github.com/containers/container-rfc
Thanks!
Questions?
Here or @davidstrauss
?
Photo Attributions
● Containers
● Virtualization Diagram
● Sliced Pie
● Train
● Robots
● Videoconferencing
● Timesharing
● Containers graph
● Transportation efficiency graph

More Related Content

What's hot

Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
Sudheer Kondla
 
Introduction to Mesos
Introduction to MesosIntroduction to Mesos
Introduction to Mesos
koboltmarky
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 

What's hot (20)

Building the Right Platform Architecture for Hadoop
Building the Right Platform Architecture for HadoopBuilding the Right Platform Architecture for Hadoop
Building the Right Platform Architecture for Hadoop
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbit
 
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
 
Introduction to Mesos
Introduction to MesosIntroduction to Mesos
Introduction to Mesos
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
Shootout at the PAAS Corral
Shootout at the PAAS CorralShootout at the PAAS Corral
Shootout at the PAAS Corral
 
ceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-shortceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-short
 
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
 
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishReverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and Varnish
 
MySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the PacemakerMySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the Pacemaker
 
Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...
 
Testing Wi-Fi with OSS Tools
Testing Wi-Fi with OSS ToolsTesting Wi-Fi with OSS Tools
Testing Wi-Fi with OSS Tools
 
Understanding DSE Search by Matt Stump
Understanding DSE Search by Matt StumpUnderstanding DSE Search by Matt Stump
Understanding DSE Search by Matt Stump
 
Introduction of mesos persistent storage
Introduction of mesos persistent storageIntroduction of mesos persistent storage
Introduction of mesos persistent storage
 
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
 
Vault
VaultVault
Vault
 

Similar to Containers > VMs

Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 
Evolution of Linux Containerization
Evolution of Linux Containerization Evolution of Linux Containerization
Evolution of Linux Containerization
WSO2
 

Similar to Containers > VMs (20)

Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Containerization & Docker - Under the Hood
Containerization & Docker - Under the HoodContainerization & Docker - Under the Hood
Containerization & Docker - Under the Hood
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
 
Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionIntroduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
 
Java in containers
Java in containersJava in containers
Java in containers
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Let's Containerize New York with Docker!
Let's Containerize New York with Docker!Let's Containerize New York with Docker!
Let's Containerize New York with Docker!
 
Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New York
 
Evolution of Linux Containerization
Evolution of Linux Containerization Evolution of Linux Containerization
Evolution of Linux Containerization
 

More from David Timothy Strauss

Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
David Timothy Strauss
 

More from David Timothy Strauss (13)

Advanced Drupal 8 Caching
Advanced Drupal 8 CachingAdvanced Drupal 8 Caching
Advanced Drupal 8 Caching
 
LCache DrupalCon Dublin 2016
LCache DrupalCon Dublin 2016LCache DrupalCon Dublin 2016
LCache DrupalCon Dublin 2016
 
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
 
Effective service and resource management with systemd
Effective service and resource management with systemdEffective service and resource management with systemd
Effective service and resource management with systemd
 
PHP at Density and Scale (Lone Star PHP 2014)
PHP at Density and Scale (Lone Star PHP 2014)PHP at Density and Scale (Lone Star PHP 2014)
PHP at Density and Scale (Lone Star PHP 2014)
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
 
Valhalla at Pantheon
Valhalla at PantheonValhalla at Pantheon
Valhalla at Pantheon
 
Cassandra-Powered Distributed DNS
Cassandra-Powered Distributed DNSCassandra-Powered Distributed DNS
Cassandra-Powered Distributed DNS
 
Scalable Drupal Infrastructure
Scalable Drupal InfrastructureScalable Drupal Infrastructure
Scalable Drupal Infrastructure
 
Planning LAMP infrastructure
Planning LAMP infrastructurePlanning LAMP infrastructure
Planning LAMP infrastructure
 
Is Drupal Secure?
Is Drupal Secure?Is Drupal Secure?
Is Drupal Secure?
 
Cassandra queuing
Cassandra queuingCassandra queuing
Cassandra queuing
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Containers > VMs

  • 2. About Me ● Drupal ○ Infrastructure ○ Security ○ Performance/scalability ● systemd ○ Scalability ● Pantheon ○ CTO and Co-founder ○ Millions of containers
  • 3. Mo Servers, Mo ProblemsMo Servers, Mo Problems With Thanks to Nick Stielau’s…
  • 4. The Goals of Computing 1. Making it Work 2. Making it Efficient ○ Running the software ○ Developer time 3. There is no #3
  • 5. Data centers take 2% of US power. “Power, Pollution and the Internet,” New York Times, 2012
  • 6. We’re not using it efficiently. “Host server CPU utilization in Amazon EC2 cloud,” Huan Liu's Blog, 2012 7.3% Average
  • 7. I’d like to sell you a time- share.
  • 8. A Brief History of Timesharing ● 1950s Batch processing ● 1970s Terminals and VMs on mainframes ● 1980s Client/server ● 1990s Thin GUI clients to servers ● 2000s Web clients connect to servers ● 2008s Web/mobile clients connect to cloud VMs
  • 10. Great About VMs: Consolidation
  • 11. “Skeuomorphs are stories of utility frozen in time. A new kind of affordance—a cultural affordance—that provides the context we need to understand the possibilities for action. They don’t work because they coddle or educate the user—digital wood grain shelves and page-flips didn’t teach people how to read ebooks—they work because they leverage a user’s past experience and apply that understanding to something new.” John Payne, “Does Skeuomorphic Design Matter?” Great About VMs: Familiarity
  • 13. Great About VMs: Portable Unit Migration, failover, high availability, consistent hypervisors, consistent images
  • 14. Great About VMs: Automation
  • 15. Great About VMs: Maturity and Efficiency 99% Efficient at Running the OS and Application
  • 17. Exactly! Why stop at virtualization?
  • 19. An Amended History: Containers ● 1986 AIX 6.1 with Workload Partitions ● 2000 FreeBSD 4.0 with Jails ● 2005 Solaris 10 with Zones ● 2007 Google lands cgroups in the Linux kernel ● 2010 systemd ● 2013 Docker and CoreOS ● 2014 LXC 1.0 and geard
  • 21. “Skeuomorphs are material metaphors instantiated through our technologies in artifacts. They provide us with familiar cues to an unfamiliar domain, sometimes lighting our paths, sometimes leading us astray.” Nicholas Gessler, “Skeuomorphs and Cultural Algorithms” Familiar Doesn’t Make It Good
  • 22. Tiny Container Slices are Useful Rackspace retired 256MB VMs because you couldn’t run an OS and a useful workload in that space. Containers only need the resources for an application.
  • 23. Efficiency in a New Category Trains and planes are efficient, but not compared to making travel unnecessary. Containers don’t need to run an operating system.
  • 24. Containers are Portable — and Lighter Migration of Application vs. Full OS
  • 26. Time to container $: systemd-nspawn -D /srv/debian/ date Spawning namespace container on /srv/debian. Init process in the container running as PID 9159. Tue Jun 3 17:32:14 UTC 2014 real 0m0.007s user 0m0.001s real 0m0.007s
  • 27. Containers at Pantheon In the Real World
  • 28. Density at Pantheon 30GB servers / 150 containers = 205MB each
  • 29. Container Provisioning Mostly < 20 seconds fully configured Some are on bare metal!
  • 30. The Bones of Containers
  • 31. Containers are based on the CGroups and Namespaces functionality on the Linux kernel
  • 32. cgroups is merely a hierarchy of processes All processes Development processes PHP-FPM Drush Production processes Drush Rsync 75% 25%
  • 33. cgroups is merely a hierarchy of processes All processes Processes for people I don’t like PHP-FPM Drush Processes for people I like Drush Rsync 2%98%
  • 34. cgroups submodules aka Controllers ● memory: Memory controller ● cpuset: CPU set controller ● cpuacct: CPU accounting controller ● cpu: CPU scheduler controller ● devices: Devices controller ● blkio: I/O controller for block devices ● net_cls: Network Class controller ● ...
  • 35. Kernel Interaction: /proc, /sys/fs # Inspect ip forwarding setting $: cat /proc/sys/net/ipv4/ip_forward # Turn ip forwarding off/on $: echo "0" > /proc/sys/net/ipv4/ip_forward $: echo "1" > /proc/sys/net/ipv4/ip_forward
  • 36. # Examine file descriptors used by nginx.. $: ls -l /proc/$NGINX_PID/fd/ lrwx------ 1 root Jun 3 13:48 0 -> /dev/null lrwx------ 1 root Jun 3 13:48 10 -> socket:[64376] l-wx------ 1 root Jun 3 13:48 2 -> /var/log/nginx-access.log # Nuke logs $: rm -rf /var/log/nginx-access.log # Read log (even after you rm -rf’d it!) $: tail /proc/$NGINX_PID/fd/2 62.211.78.166 - - [05/May/2014:10:00:54 +0000] "GET /vtiger.php Kernel Interaction: /proc, /sys/fs
  • 37. # Create a Control Group named “AA” $: mkdir /sys/fs/cgroup/memory/AA # New directory magically contains... $: ls /sys/fs/cgroup/memory/AA cgroup.clone_children memory.kmem.usage_in_bytes memory. limit_in_bytes cgroup.procs memory. max_usage_in_bytes … ... Managing cgroups: manually
  • 38. # Limit AA’s memory to 100 bytes $: echo 100 > /sys/fs/cgroup/cpu/AA/memory. limit_in_bytes Managing cgroups: manually
  • 39. Creating cgroups: libcgroups # Create a Control Group named “AA” $: cgcreate -g cpu:AA # Set the ‘cpu.shares’ to 100 for “AA” $: cgset -r cpu.shares=100 AA # Run a python script in the “AA” control group $: cgexec -g cpu:AA python test.py
  • 40. # Limit teensy’s memory to 100 bytes $: cgcreate -g memory:teensy $: cgset -r memory.limit_in_bytes=100 teensy # Associate current shell’s PID with “teensy” $: echo $$ > /sys/fs/cgroup/memory/teensy/tasks # Any command will exhaust memory $: ls Killed memory.limit_in_bytes in action
  • 41. cpu.shares in action PID USER PR NI VIRT RES SHR S %CPU 9693 root 20 0 107908 624 532 R 60.08 9692 root 20 0 107908 624 532 R 6.307 cpu.shares = 100 cpu.shares = 10 # Run script within each cgroup $: cgexec -g cpu:AA python test.py & $: cgexec -g cpu:BB python test.py & $: top
  • 42. ● Mount ● IPC ● PID ● User ● UTS ● Network Kernel Namespaces
  • 43. “Before one can share, one must first unshare” - Share Bear # Run a shell with isolated # network namespace: $: unshare --net /bin/bash
  • 45. LXC ● The liblxc library ● Several language bindings (python3, lua, ruby and Go) ● A set of standard tools to control the containers ● Container templates
  • 46. Let Me Contain That For You (lmctfy) ● Created by Google ● Open Source(ish) ● Every process at Google runs within lmctfy ● Supports nested containers
  • 47. systemd-nspawn ● From systemd project “PID EINS!” ● Will ship with all Fedora, RHEL, Ubuntu1 [1] It will ship even with you on board https://speakerdeck.com/joemiller/systemd-for-sysadmins-what-to-expect-from-your-new-service- overlord
  • 48. # Launch Vagrant $: vagrant ssh # Install a base debian tree $: debootstrap unstable /srv/debian/ # Launch a debian container $: systemd-nspawn -D /srv/debian/ systemd-nspawn
  • 49. Docker “In its early age, the dotCloud platform used plain LXC (Linux Containers)....The platform evolved, bearing less and less similarity with usual Linux Containers.”1 [1] http://blog.dotcloud.com/under-the-hood-linux-kernels-on-dotcloud-part [2] https://prague2013.drupal.org/session/automate-drupal-deployments-linux-containers-docker-and- vagrant
  • 51. And once you get containers…. http://coreos.com/blog/cluster-level-container-orchestration/
  • 54. Photo Attributions ● Containers ● Virtualization Diagram ● Sliced Pie ● Train ● Robots ● Videoconferencing ● Timesharing ● Containers graph ● Transportation efficiency graph