SlideShare a Scribd company logo
Checkpoint-restore in userspace.
Are we there yet?

                           Pavel Emelyanov
                      LinuxCon Europe 2012
What is C/R and what is it for?

C/R is an ability to snapshot an application state and restore it from the
  state at any time and place later.


Usage scenarios:
        – Live migration
        – Reboot-less kernel update
        – Applications start-up boost
        – Working environment snapshots
        – HPC load balancing
        – ...




                                          2
Is it possible to do all these nice things now?


                      Yes!
                     Almost.

             And we're close to it!


               This talk answers on:
 ✔
     How shall we be able to do it?
 ✔
     How close to it are we?
 ✔
     How far from “impossible to” are we?
 ✔
     What has happened since then?



                         3
A brief history of C/R in Linux
2005                                       2008                        2010                2011           2012
                                                                                                    Jan      Jul   Sep




                                                                                                  CRIU v0.2
                                                                                                  + LXC support


                                                                               CRIU v0.1


                                               Linus decided to merge
                                               first set of patches upstream
                                     First attempt to do C/R
                                     mostly in user-space
                   First more-or-less complete version
                   (over 100 patches)
               First collaborative attempt
       OpenVZ project starts
               to get C/R upstream
       with live-migration support
       all in kernel feature




                                                          4
CRIU project ultimate goal
             ...
  Timers

           APP      FS                                                 APP

    Creds                         dump
                   MM                      Image

                                         0011011001
                                         0010101110
                                         1101011001
                                         1011100111
                         APP             0001011011                              APP
                                         0101011100
                                         1011010110
                                             ...



                                                      restore
                          share
       APP                                                            APP




   IPC                                                          IPC
                           ...                                                    ...
            Network                                                    Network




                                             5
CRIU project concept

                         FD
                  APP                       open




        dump
                  CRIU        What files are opened?   kernel
                  tool




        restore          FD
                  ~APP                      open




                                        6
Existing kernel APIs
                   dump



                            Proc



                                             restore

                          System calls


                                                       kernel




             About self            About anybody




                            Netlink




                                      7
How CRIU grows up

                        FOO
                 APP                   Get FOO




       dump
                 CRIU
                 tool
                              Info on FOO-s
                                                  ?
                                                  kernel   Info FOO ++




                                                  X
       restore          FD
                 ~APP              Get FOO back            Get FOO ++




                                   8
CRIU project grow-up concept (Linus vision)




... this is a project by various mad Russians to perform c/r mainly from userspace,
        with various oddball helper code added into the kernel where the need is
                                      demonstrated.
 So rather than some large central lump of code, what we have is little bits and
   pieces popping up in various places which either expose something new or
     which permit something which is normally kernel-private to be modified...




                                         9
Kernel impact

            ~110 patches merged
                                        ~15 patches in flight




         9 new features appeared
         (1 C/R-only)                   2 new features to come




                                   10
The most interesting new features in kernel
   Parasite code injection
           – Read task states, that are currently retrieved by a task only about himself



   The kcmp system call
           – Helps checking which kernel objects are shared between processes


   Sockets information dumping via netlink ( sock_diag)
           – Extendable sockets state retrieving engine



   TCP repair mode
           – Read intimate state of a TCP connection
               and reconstructs it from scratch on a freshly created socket




                                             11
Other new features in kernel
   Virtual net devices indices
           – Allows to restore network devices in a namespace



   Proc map_files directory
           – Find out what exact file is mapped
           – Mappings sharing info



   Socket peeking offset
           – Allows peeking sockets queues
                 (reading without removing data from queue)



   More socket get-able sockoptions
           – Bound device
           – Packet filter




                                                  12
CRIU features so far
                                    X86_64 architecture

                                    Process tree linkage

                                    Multi-threaded apps

                               Memory mappings of all kinds

                               Terminals, groups and sessions

                           Open files (+ shared and unlinked)

                                Established TCP connection

                                       UNIX sockets

                                 LXC container environment



                                       Kernel V3.6
    IPC
                    ...
          Network          Non-posix files (inotify, epoll, etc.)




                          13
How we test it

    ZDTM – set of atomic tests for every new piece of functionality

    Real software
           
               Apache
           
               MySQL
           
               Make and gcc
           
               Tar and gzip
           
               Sshd with connections
           
               Screen with top inside
           
               VNC with xscreensaver and client connection
           
               NGINX
           
               MongoDB
           
               tcpdump



                                              14
Main plans for the nearest future

●
    Full OS resources coverage
●
    Merge in-flight patches, so that everything works on vanilla kernel
●
    Properly integrate crtools with LXC and OpenVZ
●
    Live-migration script
●
    Pre-migrate app memory before freeze (speeds things up)




                                       15
CRIU project resources


http://criu.org – project news and documentation
http://git.criu.org – git repo with tool sources
https://github.com/cyrillos/linux-2.6/ – kernel with all in-flight patches applied
criu@openvz.org mailing list
+CRIU page




                                          16
Pavel Emelyanov

                                xemul@parallels.com


17   Parallels – Optimized ComputingTM    Confidential

More Related Content

What's hot

Install lic
Install licInstall lic
Install lic
dontis
 

What's hot (11)

Accelerated Android Development with Linaro
Accelerated Android Development with LinaroAccelerated Android Development with Linaro
Accelerated Android Development with Linaro
 
Install lic
Install licInstall lic
Install lic
 
Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)
 
Build Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVMBuild Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVM
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience
 
Implement Checkpointing for Android
Implement Checkpointing for AndroidImplement Checkpointing for Android
Implement Checkpointing for Android
 
Leveraging Solver Preferences to Tame your Package Manager
Leveraging Solver Preferences to Tame your Package ManagerLeveraging Solver Preferences to Tame your Package Manager
Leveraging Solver Preferences to Tame your Package Manager
 
Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011
 
Parsing and Type checking all 2^10000 configurations of the Linux kernel
Parsing and Type checking all 2^10000 configurations of the Linux kernelParsing and Type checking all 2^10000 configurations of the Linux kernel
Parsing and Type checking all 2^10000 configurations of the Linux kernel
 
Linux on System z Update: Current & Future Linux on System z Technology
Linux on System z Update: Current & Future Linux on System z TechnologyLinux on System z Update: Current & Future Linux on System z Technology
Linux on System z Update: Current & Future Linux on System z Technology
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 

Similar to Checkpoint/Restore: are we there yet?

High Performance Computing and Open Source & Linux Technical Excellence Sympo...
High Performance Computing and Open Source & Linux Technical Excellence Sympo...High Performance Computing and Open Source & Linux Technical Excellence Sympo...
High Performance Computing and Open Source & Linux Technical Excellence Sympo...
Gonéri Le Bouder
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
NETWAYS
 
Overview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing EnvironmentsOverview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing Environments
Mark Hinkle
 
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre..."APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
Edge AI and Vision Alliance
 

Similar to Checkpoint/Restore: are we there yet? (20)

CRIU: are we there yet?
CRIU: are we there yet?CRIU: are we there yet?
CRIU: are we there yet?
 
Swifty Serverless: How to minimise latencies and cold start period for server...
Swifty Serverless: How to minimise latencies and cold start period for server...Swifty Serverless: How to minimise latencies and cold start period for server...
Swifty Serverless: How to minimise latencies and cold start period for server...
 
Checkpoint/restore of containers with CRIU
Checkpoint/restore of containers with CRIUCheckpoint/restore of containers with CRIU
Checkpoint/restore of containers with CRIU
 
High Performance Computing and Open Source & Linux Technical Excellence Sympo...
High Performance Computing and Open Source & Linux Technical Excellence Sympo...High Performance Computing and Open Source & Linux Technical Excellence Sympo...
High Performance Computing and Open Source & Linux Technical Excellence Sympo...
 
FusionInventory at LSM/RMLL 2012
FusionInventory at LSM/RMLL 2012FusionInventory at LSM/RMLL 2012
FusionInventory at LSM/RMLL 2012
 
Summit 16: The Open Source NFV Eco-system and OPNFV's Role Therein
Summit 16: The Open Source NFV Eco-system and OPNFV's Role ThereinSummit 16: The Open Source NFV Eco-system and OPNFV's Role Therein
Summit 16: The Open Source NFV Eco-system and OPNFV's Role Therein
 
eBPF — Divulging The Hidden Super Power.pdf
eBPF — Divulging The Hidden Super Power.pdfeBPF — Divulging The Hidden Super Power.pdf
eBPF — Divulging The Hidden Super Power.pdf
 
HPC Workbench Presentation
HPC Workbench PresentationHPC Workbench Presentation
HPC Workbench Presentation
 
Docker containers : introduction
Docker containers : introductionDocker containers : introduction
Docker containers : introduction
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
 
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded DevicesQi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
 
Overview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing EnvironmentsOverview: Building Open Source Cloud Computing Environments
Overview: Building Open Source Cloud Computing Environments
 
CoreOS @ gluecon 2015
CoreOS @ gluecon 2015CoreOS @ gluecon 2015
CoreOS @ gluecon 2015
 
Linux internals v4
Linux internals v4Linux internals v4
Linux internals v4
 
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre..."APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
 
Continous delivery at docker age
Continous delivery at docker ageContinous delivery at docker age
Continous delivery at docker age
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Discovery the p2 API (updated to Indigo)
Discovery the p2 API (updated to Indigo)Discovery the p2 API (updated to Indigo)
Discovery the p2 API (updated to Indigo)
 
Continuous Kernel Integration
Continuous Kernel IntegrationContinuous Kernel Integration
Continuous Kernel Integration
 
Colony, modularity the easy way
Colony, modularity the easy wayColony, modularity the easy way
Colony, modularity the easy way
 

More from Kirill Kolyshkin

Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
Kirill Kolyshkin
 

More from Kirill Kolyshkin (10)

Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
 
CRIU: Time and Space Travel for Linux Containers
CRIU: Time and Space Travel for Linux ContainersCRIU: Time and Space Travel for Linux Containers
CRIU: Time and Space Travel for Linux Containers
 
What's missing from upstream kernel containers?
What's missing from upstream kernel containers?What's missing from upstream kernel containers?
What's missing from upstream kernel containers?
 
Not so brief history of Linux Containers
Not so brief history of Linux ContainersNot so brief history of Linux Containers
Not so brief history of Linux Containers
 
N problems of Linux Containers
N problems of Linux ContainersN problems of Linux Containers
N problems of Linux Containers
 
A brief history of Linux Containers
A brief history of Linux Containers A brief history of Linux Containers
A brief history of Linux Containers
 
OpenVZ, Virtuozzo and Docker
OpenVZ, Virtuozzo and DockerOpenVZ, Virtuozzo and Docker
OpenVZ, Virtuozzo and Docker
 
Criu texas-linux-fest-2014
Criu texas-linux-fest-2014Criu texas-linux-fest-2014
Criu texas-linux-fest-2014
 
Seven problems of Linux Containers
Seven problems of Linux ContainersSeven problems of Linux Containers
Seven problems of Linux Containers
 
OpenVZ Linux Containers
OpenVZ Linux ContainersOpenVZ Linux Containers
OpenVZ Linux Containers
 

Recently uploaded

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 

Checkpoint/Restore: are we there yet?

  • 1. Checkpoint-restore in userspace. Are we there yet? Pavel Emelyanov LinuxCon Europe 2012
  • 2. What is C/R and what is it for? C/R is an ability to snapshot an application state and restore it from the state at any time and place later. Usage scenarios: – Live migration – Reboot-less kernel update – Applications start-up boost – Working environment snapshots – HPC load balancing – ... 2
  • 3. Is it possible to do all these nice things now? Yes! Almost. And we're close to it! This talk answers on: ✔ How shall we be able to do it? ✔ How close to it are we? ✔ How far from “impossible to” are we? ✔ What has happened since then? 3
  • 4. A brief history of C/R in Linux 2005 2008 2010 2011 2012 Jan Jul Sep CRIU v0.2 + LXC support CRIU v0.1 Linus decided to merge first set of patches upstream First attempt to do C/R mostly in user-space First more-or-less complete version (over 100 patches) First collaborative attempt OpenVZ project starts to get C/R upstream with live-migration support all in kernel feature 4
  • 5. CRIU project ultimate goal ... Timers APP FS APP Creds dump MM Image 0011011001 0010101110 1101011001 1011100111 APP 0001011011 APP 0101011100 1011010110 ... restore share APP APP IPC IPC ... ... Network Network 5
  • 6. CRIU project concept FD APP open dump CRIU What files are opened? kernel tool restore FD ~APP open 6
  • 7. Existing kernel APIs dump Proc restore System calls kernel About self About anybody Netlink 7
  • 8. How CRIU grows up FOO APP Get FOO dump CRIU tool Info on FOO-s ? kernel Info FOO ++ X restore FD ~APP Get FOO back Get FOO ++ 8
  • 9. CRIU project grow-up concept (Linus vision) ... this is a project by various mad Russians to perform c/r mainly from userspace, with various oddball helper code added into the kernel where the need is demonstrated. So rather than some large central lump of code, what we have is little bits and pieces popping up in various places which either expose something new or which permit something which is normally kernel-private to be modified... 9
  • 10. Kernel impact ~110 patches merged ~15 patches in flight 9 new features appeared (1 C/R-only) 2 new features to come 10
  • 11. The most interesting new features in kernel Parasite code injection – Read task states, that are currently retrieved by a task only about himself The kcmp system call – Helps checking which kernel objects are shared between processes Sockets information dumping via netlink ( sock_diag) – Extendable sockets state retrieving engine TCP repair mode – Read intimate state of a TCP connection and reconstructs it from scratch on a freshly created socket 11
  • 12. Other new features in kernel Virtual net devices indices – Allows to restore network devices in a namespace Proc map_files directory – Find out what exact file is mapped – Mappings sharing info Socket peeking offset – Allows peeking sockets queues (reading without removing data from queue) More socket get-able sockoptions – Bound device – Packet filter 12
  • 13. CRIU features so far X86_64 architecture Process tree linkage Multi-threaded apps Memory mappings of all kinds Terminals, groups and sessions Open files (+ shared and unlinked) Established TCP connection UNIX sockets LXC container environment Kernel V3.6 IPC ... Network Non-posix files (inotify, epoll, etc.) 13
  • 14. How we test it  ZDTM – set of atomic tests for every new piece of functionality  Real software  Apache  MySQL  Make and gcc  Tar and gzip  Sshd with connections  Screen with top inside  VNC with xscreensaver and client connection  NGINX  MongoDB  tcpdump 14
  • 15. Main plans for the nearest future ● Full OS resources coverage ● Merge in-flight patches, so that everything works on vanilla kernel ● Properly integrate crtools with LXC and OpenVZ ● Live-migration script ● Pre-migrate app memory before freeze (speeds things up) 15
  • 16. CRIU project resources http://criu.org – project news and documentation http://git.criu.org – git repo with tool sources https://github.com/cyrillos/linux-2.6/ – kernel with all in-flight patches applied criu@openvz.org mailing list +CRIU page 16
  • 17. Pavel Emelyanov xemul@parallels.com 17 Parallels – Optimized ComputingTM Confidential

Editor's Notes

  1. Everything is one the slides.
  2. A brief C/R history – openvz version, Oren's version, attempt to merge Oren's version upstream, CRIU proof-of-concept, Linus' “OK, let's take it” and first two releases
  3. Consider you have an application. This application has a variety of resources associated with it: memory, open files, credentials, etc. There can be more than one application in a game, some of them sharing resources. And that's not all – they may live in some environment (we call container, yes) with its own not bound to tasks resources like networking configuration or system V IPC objects. What we do in CRIU is – we serialize the state of this whole thing into an image file (well, it's a set of files, but still). Later we can take this image and recreate the applications with their resources and environment at the very same state as it was before we dumped it.
  4. - Linked clones. Disk space. I/O performance. GPL and ESXi