SlideShare una empresa de Scribd logo
1 de 31
Docker RPi2 challenge
@damienduportal @ndeloof @YoannDubreuil @Quintus23M
Challenge Introduction
DockerCon 15, June 22-23
Live Demo: starting 100x Docker Containers on a Raspberry Pi 2 B
showed a screen shot with 250x running Containers
and plenty of resources/memory left, let’s improve it
OK, let’s start the Challenge
Challenge: How many Containers could be really started on a Pi 2?
my wish: I’d like to see 1000x Containers
personal record to this time: 613x Containers
--- but honestly, I was not sure, if this is possible at all!
let’s break the challenge
First tries to the record
Try, Learn and Share !
1 - Measure and automate all the things
Measures :
sysstat for post mortem
node-collector from Prometheus.io for “real time”
Provisionning :
Basic shell script published on my Github
Let’s try Ansible later : easier to maintain, need to learn :)
2 - Lower the container footprint
Tried with custom compiled nginx for ARM with few extensions
➢ ~ 80 containers
Footprint too big per container. Reading carefully Hypriot Blog : "rpi-nano-
httpd" : 16 Kb footprint, 88 Kb image
➢ ~150 containers
3 - Docker tuning
Wanted to disable tcp-proxy process : no use here
Docker logs says “iptables” errors
Footprint with iptable + net. namespace : around 1 Mb !
Disable network / port forwarding + --net=host (Client side)
--bridge=none --iptables=false --ipv6=false --ip-
forward=false --ip-masq=false -tls=false --userland-
proxy=false (Engine side)
4 - Moaaar Docker tuning
No debug : --debug=true
No filesystem writing : --read-only=true
No logging : --log-driver=none
Following Docker upgrades :
--ipc=host
--utc=host
5 - Linux tuning : start sharing
Tune sysctl : limits ! (MaxOpenFiles, MaxProcs, etc.)
Still stuck, footprint / container still big (~ 750 Kb)
Help from @booya and Hypriot guys + eading the /etc/init.d/docker script :
Stack size (8 Mb -> 2 Mb in Hypriot:Jack)
Playing around doing abacus :
<32 Kb breaks docker pull, <16Kb breaks docker run
~ 1700 containers
6 - To the record : Learning and sharing
GOGC to 10
~ 2 200 containers
Docker Hack days + Twitter :
KSM : KO (need to recompile Kernel)
Learning the Linux memory management : Freeing caches + disabling OOM
~ 2498 containers !!!
Share and challenge !
Community, discussions, challenge and Whales
BreizhCamp Hack (night) Party
Brainstorm for ideas
… then test everything in arbitrary order
help each other
drink some beer
learn a lot
Our Methodology
where to start?
first naïve try
only 38 containers :- !
but 70 on a RPi1
figure out RPi2 limits without Docker
web server footprint
network namespace footprint
get some help !
web server
from hypriot/rpi-nano-httpd image
written in ARM assembly code
already highly optimized
1 page for code
1 page for data
1 page for stack
1 page for vsdo
network namespace RPi2 limit
launched web server in a dedicated network namespace
ip netns exec <NS_NUMBER> httpd
RPi2 limit is ~ 1.100 network namespace
=> To break the challenge, we needed to run without network isolation
network configuration
disabled everything we could on Docker daemon
--bridge=none --userland-proxy=false --sig-proxy=false
--ipv6=false --ip-masq=false --iptables=false
started containers with --net=host
disabled IPv6 on Linux kernel boot with ipv6.disable=1
Systemd
Docker daemon run as root
… but still has some limits set by systemd (so the 38 containers...)
LimitSIGPENDING=infinity
LimitNOFILE=infinity
LimitAS=infinity
LimitNPROC=infinity
LimitSTACK=?
stack size
Damien pro-tip : adjust LimitSTACK parameter to your needs
Default stack size is 8Mb
a stack consume 8Mb of process VM space (8 * 4 * 38 = 1,2 Gb)
=> ~ 1800 / 2000 containers
process memory layout
RPi2 processor is 32 bits !
32 bit process address space
only 3Gb of virtual memory per process
collision between stack and heap memory areas
reduce thread stack size
smallest working thread stack size: 24kb
speed up tests
launching thousands of containers on a RPi2 takes hours if not days!
everything in memory with zram devices
swap (ratio 5:1)
/var/lib/docker on ext4 FS (ratio 10:1)
swap as early as possible to keep free memory (vm.swappiness = 100)
USB external disk vs low perf, I/O limited SD card
system tuning
limit memory consumption
reduce GPU memory to 16Mb (can’t do less)
blacklisted non required Linux modules
remove some Linux limits
vm.overcommit = 1
kernel.pid_max = 32768
kernel.threads-max = 14812
Challenge
completed!
We started 2499containers !
RAM on RPi2 was not exhausted but Docker daemon crashed
docker[307]: runtime: program exceeds 10000-thread limit
Why is there a limit?
4 threads per container
10.000 threads for a Go application => 2500 containers max
Unlocked this with runtime.debug.SetMaxThread(12000)
hack not eligible for RpiDocker challenge, was just to confirm
can run ~2740 webserver containers, before actual OOM
what did not work
Btrfs
not working properly : strange web server 404 failures after ~20
successful launchs
stick with overlayfs
LXC driver
way sloooooooower
What’s next
Understand why Docker do need 4 threads per container
(hey, lot’s of Docker core contributors here, time to ask !)
Collaboration (and beer)
were the keys
to break this challenge !
links
Nicolas’ blog
http://blog.loof.fr/2015/10/how-to-run-2500-webservers-on-raspberry.html
code
https://github.com/ndeloof/RPiDockerKillerScore

Más contenido relacionado

La actualidad más candente

Fedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIUFedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIU
Andrey Vagin
 

La actualidad más candente (20)

Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init Process
 
Fedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIUFedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIU
 
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
 
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicumBsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
 
Disaggregating Ceph using NVMeoF
Disaggregating Ceph using NVMeoFDisaggregating Ceph using NVMeoF
Disaggregating Ceph using NVMeoF
 
Performance Tuning EC2 Instances
Performance Tuning EC2 InstancesPerformance Tuning EC2 Instances
Performance Tuning EC2 Instances
 
FOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerFOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the corner
 
Talk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerTalk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about Docker
 
Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...
 
Docker orchestration with Kubernetes
Docker orchestration with KubernetesDocker orchestration with Kubernetes
Docker orchestration with Kubernetes
 
Learning kubernetes
Learning kubernetesLearning kubernetes
Learning kubernetes
 
4th RICC workshopのご案内
4th RICC workshopのご案内4th RICC workshopのご案内
4th RICC workshopのご案内
 
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorganShared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
 
Checkpoint/restore of containers with CRIU
Checkpoint/restore of containers with CRIUCheckpoint/restore of containers with CRIU
Checkpoint/restore of containers with CRIU
 
Docker Warsaw Meetup 12/2017 - DockerCon 2017 Recap
Docker Warsaw Meetup 12/2017 - DockerCon 2017 RecapDocker Warsaw Meetup 12/2017 - DockerCon 2017 Recap
Docker Warsaw Meetup 12/2017 - DockerCon 2017 Recap
 
Amepad lt(tmpfs)
Amepad lt(tmpfs)Amepad lt(tmpfs)
Amepad lt(tmpfs)
 
Caching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer scienceCaching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer science
 
Open ZFS Keynote (public)
Open ZFS Keynote (public)Open ZFS Keynote (public)
Open ZFS Keynote (public)
 
Kernel Recipes 2017 - 20 years of Linux Virtual Memory - Andrea Arcangeli
Kernel Recipes 2017 - 20 years of Linux Virtual Memory - Andrea ArcangeliKernel Recipes 2017 - 20 years of Linux Virtual Memory - Andrea Arcangeli
Kernel Recipes 2017 - 20 years of Linux Virtual Memory - Andrea Arcangeli
 
Is It Faster to Go with Redpanda Transactions than Without Them?!
Is It Faster to Go with Redpanda Transactions than Without Them?!Is It Faster to Go with Redpanda Transactions than Without Them?!
Is It Faster to Go with Redpanda Transactions than Without Them?!
 

Destacado

Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
Docker on the Raspberry Pi by Dieter Reuter (Hypriot)Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
Docker, Inc.
 
DockerCon14 John Engates
DockerCon14 John EngatesDockerCon14 John Engates
DockerCon14 John Engates
Docker, Inc.
 
Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2
Docker, Inc.
 
Docker at DevTable
Docker at DevTableDocker at DevTable
Docker at DevTable
Docker, Inc.
 
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker ContainersDockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
Docker, Inc.
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software Delivery
Docker, Inc.
 
DockerCon14 Keynote
DockerCon14 KeynoteDockerCon14 Keynote
DockerCon14 Keynote
Docker, Inc.
 

Destacado (20)

Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
Docker on the Raspberry Pi by Dieter Reuter (Hypriot)Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
Docker on the Raspberry Pi by Dieter Reuter (Hypriot)
 
Docker Use Cases on Raspberry Pi
Docker Use Cases on Raspberry PiDocker Use Cases on Raspberry Pi
Docker Use Cases on Raspberry Pi
 
Docker, Innovation Accelerator
Docker, Innovation AcceleratorDocker, Innovation Accelerator
Docker, Innovation Accelerator
 
DockerCon14 John Engates
DockerCon14 John EngatesDockerCon14 John Engates
DockerCon14 John Engates
 
DockerCon EU 2015: Sparebank; a journey towards Docker
DockerCon EU 2015: Sparebank; a journey towards DockerDockerCon EU 2015: Sparebank; a journey towards Docker
DockerCon EU 2015: Sparebank; a journey towards Docker
 
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker EnvironmentsDockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
 
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
DockerCon SF 2015: MomOps in DevOps w/ Mukta AphaleDockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
 
DockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout SessionDockerCon 2015: Docker Engine Breakout Session
DockerCon 2015: Docker Engine Breakout Session
 
Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2Immutable Infrastructure with Docker and EC2
Immutable Infrastructure with Docker and EC2
 
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
 
DockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the ServersDockerCon EU 2015: Compute as an Interruption Forget the Servers
DockerCon EU 2015: Compute as an Interruption Forget the Servers
 
DockerCon SF 2015: Education for a digital world
DockerCon SF 2015: Education for a digital worldDockerCon SF 2015: Education for a digital world
DockerCon SF 2015: Education for a digital world
 
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad AfanahOn-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
On-the-Fly Containerization of Enterprise Java & .NET Apps by Amjad Afanah
 
Docker at DevTable
Docker at DevTableDocker at DevTable
Docker at DevTable
 
DockerCon EU 2015: The Glue is the Hard Part: Making a Production-Ready PaaS
DockerCon EU 2015: The Glue is the Hard Part: Making a Production-Ready PaaSDockerCon EU 2015: The Glue is the Hard Part: Making a Production-Ready PaaS
DockerCon EU 2015: The Glue is the Hard Part: Making a Production-Ready PaaS
 
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
 
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker ContainersDockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software Delivery
 
DockerCon SF 2015: How to talk to humans
DockerCon SF 2015: How to talk to humansDockerCon SF 2015: How to talk to humans
DockerCon SF 2015: How to talk to humans
 
DockerCon14 Keynote
DockerCon14 KeynoteDockerCon14 Keynote
DockerCon14 Keynote
 

Similar a Docker Online Meetup #27: Raspberry Pi DockerCon Challenge

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.
 

Similar a Docker Online Meetup #27: Raspberry Pi DockerCon Challenge (20)

DockerCon EU 2015: Breaking the RPiDocker Challenge
DockerCon EU 2015: Breaking the RPiDocker Challenge DockerCon EU 2015: Breaking the RPiDocker Challenge
DockerCon EU 2015: Breaking the RPiDocker Challenge
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
 
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...
 
Containers > VMs
Containers > VMsContainers > VMs
Containers > VMs
 
Build optimization mechanisms in GitLab and Docker
Build optimization mechanisms in GitLab and DockerBuild optimization mechanisms in GitLab and Docker
Build optimization mechanisms in GitLab and Docker
 
Docker intro workshop: Dockerize your PHP app
Docker  intro workshop: Dockerize your PHP appDocker  intro workshop: Dockerize your PHP app
Docker intro workshop: Dockerize your PHP app
 
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
 
Perspectives on Docker
Perspectives on DockerPerspectives on Docker
Perspectives on Docker
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
 
Let's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAMLet's Count Bytes! Launching Ruby in 32K of RAM
Let's Count Bytes! Launching Ruby in 32K of RAM
 
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
 
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
 
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup SunnyvaleIntroduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
 
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
 
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!
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
 
Memory, Big Data, NoSQL and Virtualization
Memory, Big Data, NoSQL and VirtualizationMemory, Big Data, NoSQL and Virtualization
Memory, Big Data, NoSQL and Virtualization
 

Más de Docker, Inc.

Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 

Más de Docker, Inc. (20)

Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
Securing Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINXSecuring Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINX
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Hands-on Helm
Hands-on Helm Hands-on Helm
Hands-on Helm
 
Distributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDistributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at Salesforce
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker Hub
 
Monitoring in a Microservices World
Monitoring in a Microservices WorldMonitoring in a Microservices World
Monitoring in a Microservices World
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
 
Predicting Space Weather with Docker
Predicting Space Weather with DockerPredicting Space Weather with Docker
Predicting Space Weather with Docker
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio Code
 
How to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryHow to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container Registry
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!
 
Kubernetes at Datadog Scale
Kubernetes at Datadog ScaleKubernetes at Datadog Scale
Kubernetes at Datadog Scale
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
 
Developing with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDeveloping with Docker for the Arm Architecture
Developing with Docker for the Arm Architecture
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Docker Online Meetup #27: Raspberry Pi DockerCon Challenge

  • 1. Docker RPi2 challenge @damienduportal @ndeloof @YoannDubreuil @Quintus23M
  • 2. Challenge Introduction DockerCon 15, June 22-23 Live Demo: starting 100x Docker Containers on a Raspberry Pi 2 B showed a screen shot with 250x running Containers and plenty of resources/memory left, let’s improve it
  • 3.
  • 4. OK, let’s start the Challenge Challenge: How many Containers could be really started on a Pi 2? my wish: I’d like to see 1000x Containers personal record to this time: 613x Containers --- but honestly, I was not sure, if this is possible at all!
  • 5. let’s break the challenge
  • 6. First tries to the record Try, Learn and Share !
  • 7. 1 - Measure and automate all the things Measures : sysstat for post mortem node-collector from Prometheus.io for “real time” Provisionning : Basic shell script published on my Github Let’s try Ansible later : easier to maintain, need to learn :)
  • 8.
  • 9. 2 - Lower the container footprint Tried with custom compiled nginx for ARM with few extensions ➢ ~ 80 containers Footprint too big per container. Reading carefully Hypriot Blog : "rpi-nano- httpd" : 16 Kb footprint, 88 Kb image ➢ ~150 containers
  • 10. 3 - Docker tuning Wanted to disable tcp-proxy process : no use here Docker logs says “iptables” errors Footprint with iptable + net. namespace : around 1 Mb ! Disable network / port forwarding + --net=host (Client side) --bridge=none --iptables=false --ipv6=false --ip- forward=false --ip-masq=false -tls=false --userland- proxy=false (Engine side)
  • 11. 4 - Moaaar Docker tuning No debug : --debug=true No filesystem writing : --read-only=true No logging : --log-driver=none Following Docker upgrades : --ipc=host --utc=host
  • 12. 5 - Linux tuning : start sharing Tune sysctl : limits ! (MaxOpenFiles, MaxProcs, etc.) Still stuck, footprint / container still big (~ 750 Kb) Help from @booya and Hypriot guys + eading the /etc/init.d/docker script : Stack size (8 Mb -> 2 Mb in Hypriot:Jack) Playing around doing abacus : <32 Kb breaks docker pull, <16Kb breaks docker run ~ 1700 containers
  • 13. 6 - To the record : Learning and sharing GOGC to 10 ~ 2 200 containers Docker Hack days + Twitter : KSM : KO (need to recompile Kernel) Learning the Linux memory management : Freeing caches + disabling OOM ~ 2498 containers !!!
  • 14. Share and challenge ! Community, discussions, challenge and Whales
  • 16. Brainstorm for ideas … then test everything in arbitrary order help each other drink some beer learn a lot Our Methodology
  • 17. where to start? first naïve try only 38 containers :- ! but 70 on a RPi1 figure out RPi2 limits without Docker web server footprint network namespace footprint get some help !
  • 18. web server from hypriot/rpi-nano-httpd image written in ARM assembly code already highly optimized 1 page for code 1 page for data 1 page for stack 1 page for vsdo
  • 19. network namespace RPi2 limit launched web server in a dedicated network namespace ip netns exec <NS_NUMBER> httpd RPi2 limit is ~ 1.100 network namespace => To break the challenge, we needed to run without network isolation
  • 20. network configuration disabled everything we could on Docker daemon --bridge=none --userland-proxy=false --sig-proxy=false --ipv6=false --ip-masq=false --iptables=false started containers with --net=host disabled IPv6 on Linux kernel boot with ipv6.disable=1
  • 21. Systemd Docker daemon run as root … but still has some limits set by systemd (so the 38 containers...) LimitSIGPENDING=infinity LimitNOFILE=infinity LimitAS=infinity LimitNPROC=infinity LimitSTACK=?
  • 22. stack size Damien pro-tip : adjust LimitSTACK parameter to your needs Default stack size is 8Mb a stack consume 8Mb of process VM space (8 * 4 * 38 = 1,2 Gb) => ~ 1800 / 2000 containers
  • 23. process memory layout RPi2 processor is 32 bits ! 32 bit process address space only 3Gb of virtual memory per process collision between stack and heap memory areas reduce thread stack size smallest working thread stack size: 24kb
  • 24. speed up tests launching thousands of containers on a RPi2 takes hours if not days! everything in memory with zram devices swap (ratio 5:1) /var/lib/docker on ext4 FS (ratio 10:1) swap as early as possible to keep free memory (vm.swappiness = 100) USB external disk vs low perf, I/O limited SD card
  • 25. system tuning limit memory consumption reduce GPU memory to 16Mb (can’t do less) blacklisted non required Linux modules remove some Linux limits vm.overcommit = 1 kernel.pid_max = 32768 kernel.threads-max = 14812
  • 26. Challenge completed! We started 2499containers ! RAM on RPi2 was not exhausted but Docker daemon crashed docker[307]: runtime: program exceeds 10000-thread limit
  • 27. Why is there a limit? 4 threads per container 10.000 threads for a Go application => 2500 containers max Unlocked this with runtime.debug.SetMaxThread(12000) hack not eligible for RpiDocker challenge, was just to confirm can run ~2740 webserver containers, before actual OOM
  • 28. what did not work Btrfs not working properly : strange web server 404 failures after ~20 successful launchs stick with overlayfs LXC driver way sloooooooower
  • 29. What’s next Understand why Docker do need 4 threads per container (hey, lot’s of Docker core contributors here, time to ask !)
  • 30. Collaboration (and beer) were the keys to break this challenge !