SlideShare a Scribd company logo
Petros Angelatos
resin.io
Moby Summit - October 2017
History
● December 2013
○ Ported Docker 0.7.2 to ARM
● October 2016
○ Released resinOS 2.0
● April 2017
○ Moby Project announcement
● October 2017
○ Released Balena
Key features
● Small footprint
○ On average 3x to 4x smaller than Docker CE
● Minimal disk writes
○ On-the-fly extraction from the registry to the layer store
● Durable image pull
○ Disk syncing on every step
● Container deltas
○ 10-70 times more bandwidth efficient than docker pull
Small footprint
● Busybox-style architecture
○ Deduplicate shared go libs between components
○ The binary includes multiple entrypoints
○ Select appropriate main() function based on argv0
● Dropped non-IoT relevant features*
○ Swarm
○ Plugins
○ Cloud logging drivers
○ Etc
* based on the scenarios we’re focusing on
Docker architecture
containerd
runc
swarmkit
gostdlib
dockerd
runc
swarmkit
gostdlib
docker-cli
runc
dockerd
gostdlib
containerd
dockerd
gostdlib
runc
notary logrus
logrus
Docker architecture
containerd
runc
swarmkit
gostdlib
dockerd
runc
swarmkit
gostdlib
docker-cli
runc
dockerd
gostdlib
containerd
dockerd
gostdlib
runc
notary logrus
logrus
● Size = 4 x (gostdlib) + 2 x (swarmkit) + 2 x (logrus) ...
Balena architecture
containerd
runc
dockerd
gostdlib
balena
● Go Linker ensures only required routines are compiled
● There is only one copy of each library
● Entrypoint selects based on argv0
docker-cli
entrypoint
Minimal disk writes
● Serially download each layer
● Extract the files directly in the layer store
● Allows balena to pull under low space situations
● Hash verification still occurs
○ Layer is discarded if a problem is found
Durable image pull
● Run file.Sync() after every file on disk
● Sync() the filesystem before committing layers
○ This ensures metadata is also synced to disk
● Syncing enables us to purge page cache during pull
○ man 2 posix_fadvise
Balena: a Moby-based container engine for IoT
Container deltas
● Based on librsync
○ Ported in Golang https://github.com/resin-os/librsync-go
● Output is still a valid docker image
○ Cannot run though
○ Can be pushed and pulled to normal docker registries
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image
layer 1 layer 2 layer 3 layer 4
Serialized image stream
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image
layer 1 layer 2 layer 3 layer 4
Serialized image stream
librsync-go
Source fingerprint
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
layer 3’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
Image config’
Delta image
layer 3’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
empty
Image config’
Delta image
Identical
layer 3’
Image config’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
empty
Image config’
Delta image
layer 3’
Image config’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
empty
Image config’
Delta image
Rsync delta
layer 3’
Image config’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
empty
Image config’
Delta image
layer 3’
Image config’
Container deltas - How
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config
layer 2’
Target image
empty
Image config
Delta image
layer 3’
Rsync delta
Image config’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
empty
Image config’
Delta image
layer 3’
Image config’
Container deltas
layer 1
Image config
layer 2
layer 3
layer 4
Source image Source fingerprint
layer 1
Image config’
layer 2’
Target image
Image config’
Delta image
layer 3’
10x smaller!
Image config’
Challenges and the future
● Currently it’s a bit hard to customise a moby assembly
○ Will improve as moby becomes more modular
● The Docker name is entangled in various places
○ We’ve done some initial work on separating it out
● Other than that, continue to optimise balena :)
Thanks!

More Related Content

PPT
Netbeans IDE & Platform
PDF
DB2の使い方 管理ツール編
PDF
第18回しゃちほこオラクル俱楽部
PDF
Mapeamento objeto relacional
PPTX
Azure serverless computing
PPTX
Almacenamiento en las nube
PDF
Arquitetura Cliente-Servidor - Modelos
PDF
Oracle Cloud Infrastructure:2022年1月度サービス・アップデート
Netbeans IDE & Platform
DB2の使い方 管理ツール編
第18回しゃちほこオラクル俱楽部
Mapeamento objeto relacional
Azure serverless computing
Almacenamiento en las nube
Arquitetura Cliente-Servidor - Modelos
Oracle Cloud Infrastructure:2022年1月度サービス・アップデート

What's hot (10)

PPTX
Sql server のバックアップとリストアの基礎
PPTX
Asynchronous programming in ASP.NET
PPTX
AWS VM import / export ハンズオン
PDF
Serverless computing
PPTX
PPT
Variaveis locais e globais
PDF
Stream1 change sets delivery to stream2 in RTC
PDF
Hyper-V の本格採用に必要なエンタープライズ設計術
PPTX
Db2をAWS上に構築する際のヒント&TIPS 2019年7月版
PPTX
ASP.NET Web Security
Sql server のバックアップとリストアの基礎
Asynchronous programming in ASP.NET
AWS VM import / export ハンズオン
Serverless computing
Variaveis locais e globais
Stream1 change sets delivery to stream2 in RTC
Hyper-V の本格採用に必要なエンタープライズ設計術
Db2をAWS上に構築する際のヒント&TIPS 2019年7月版
ASP.NET Web Security
Ad

Similar to Balena: a Moby-based container engine for IoT (20)

PDF
PPTX
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
PDF
[KubeCon EU 2020] containerd Deep Dive
PDF
Yocto and IoT - a retrospective
PDF
containerd summit - Deep Dive into containerd
PDF
Introduction to Docker storage, volume and image
PDF
KubeCon EU 2019 - P2P Docker Image Distribution in Hybrid Cloud Environment w...
PDF
Extended and embedding: containerd update & project use cases
PDF
RBD: What will the future bring? - Jason Dillaman
PDF
Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker
PDF
containerd and CRI
PDF
Online Meetup: Why should container system / platform builders care about con...
PDF
Container Runtimes and Tooling
PDF
Docker primer and tips
PDF
Docker London Meetup: Docker Engine Evolution
PDF
FILEgrain: Transport-Agnostic, Fine-Grained Content-Addressable Container Ima...
PDF
Alternatives to layer-based image distribution: using CERN filesystem for images
PDF
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
PDF
Docker Engine Evolution: From Monolith to Discrete Components
PDF
DevOps for Opensource Geospatial Applications
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
[KubeCon EU 2020] containerd Deep Dive
Yocto and IoT - a retrospective
containerd summit - Deep Dive into containerd
Introduction to Docker storage, volume and image
KubeCon EU 2019 - P2P Docker Image Distribution in Hybrid Cloud Environment w...
Extended and embedding: containerd update & project use cases
RBD: What will the future bring? - Jason Dillaman
Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker
containerd and CRI
Online Meetup: Why should container system / platform builders care about con...
Container Runtimes and Tooling
Docker primer and tips
Docker London Meetup: Docker Engine Evolution
FILEgrain: Transport-Agnostic, Fine-Grained Content-Addressable Container Ima...
Alternatives to layer-based image distribution: using CERN filesystem for images
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
Docker Engine Evolution: From Monolith to Discrete Components
DevOps for Opensource Geospatial Applications
Ad

More from Balena (9)

PDF
Balena Hackathon 2021 - Welcome and Getting Started
PPTX
IoT Fleet Management and Scaling
PPTX
Fold For Covid
PPTX
The Things Network Madrid
PPTX
San Francisco Raspberry Pi Meetup
PDF
Develop, deploy and manage your IoT Fleet with Balena - IoT Portugal Meetup
PPTX
Everything you wanted to know about resin hup
PDF
Scaling IoT Deployments: DevOps for the Internet of Things
PDF
Resin.io overview (2016 July)
Balena Hackathon 2021 - Welcome and Getting Started
IoT Fleet Management and Scaling
Fold For Covid
The Things Network Madrid
San Francisco Raspberry Pi Meetup
Develop, deploy and manage your IoT Fleet with Balena - IoT Portugal Meetup
Everything you wanted to know about resin hup
Scaling IoT Deployments: DevOps for the Internet of Things
Resin.io overview (2016 July)

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A comparative analysis of optical character recognition models for extracting...
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Assigned Numbers - 2025 - Bluetooth® Document
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
Big Data Technologies - Introduction.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx

Balena: a Moby-based container engine for IoT

Editor's Notes

  • #3: Having seen IoT devices used in production for tens of millions of hours, we’ve become aware of the unique needs of the embedded world. Until recently, we addressed these by either making small modifications to Docker itself or building larger components outside of it, but that approach had reached its limits. For example having external programs to manipulate /var/lib/docker in a special way The Moby announcement enabled us to move forward in a way that is compatible with the docker community Last Friday we released Balena
  • #5: The way we approached this was by making a graph of all dependencies and finding losely connected clusters of packages
  • #7: There are a lot of shared libraries between the components
  • #8: To do this we have to do align the versions of shared libraries to a version that works with everything The way we set argv0 is by symlinking different names to the balena binary
  • #9: Normally the free space needed for a docker pull is the size of the new layers plus the compressed size of those layers, depending on the order they happen to download Balena always uses exactly as much space as the size of the new layers Reduces wear and tear of flash devices
  • #10: Two reasons for page cache Application IO performance Preventing device stress that can cause filesystem failures
  • #14: This construction needs to be random access
  • #15: The fingerprint is a map of hashes to their location in the stream
  • #16: We’ll use the source fingerprint to calculate the delta for all the layers
  • #18: The delta image contains the same image config as the target, but with a special marker that allows balena to recognise it when it pulls
  • #27: Come talk to me if you have questions