Containers and Virtual Machines (I)

But  mainly  containers

Referenced Papers

Outline

  • Motivation
    • Usages of Docker
    • Travis CI & Containers
    • Isolation only?
  • Technical Highlight
    • Linux-VServer
    • Linux kernel & LXC
  • Performance
  • Ideas
    • modprobe in IaaS

Motivation

Usages of Docker

Travis CI & Containers

Isolation only?

  1. Isolation
  2. Encapsulation
  3. Migration
  4. Interposition

Technical Highlight

Linux-VServer

  1. Isolate CPU
     
  2. Isolate Memory
     
  3. Isolate I/O

Token bucket filter

rlimit system calls

Hierarchical token bucket

$ sudo chroot container0/

Linux kernel & LXC

  1. Namespaces
     
  2. Cgroups

(version 2.4.19)

(version 2.6.24)

Linux kernel & LXC

$ sudo unshare --fork --pid --mount-proc bash
$ htop
$ sudo apt install cgroup-tools
$ sudo cgcreate -a <user> -g pids:mygroup
$ sudo cgexec -g pids:mygroup bash

# mkdir -p /sys/fs/cgroup/pids/parent/child
# echo 2 > /sys/fs/cgroup/pids/parent/pids.max
# echo $$ > /sys/fs/cgroup/pids/parent/cgroup.procs
# cat /sys/fs/cgroup/pids/parent/pids.current
# echo "Here's some processes for you." | cat

$ sudo cgdelete -g pids:mygroup

Performance

Idea

  User Space

  Kernel Space

Request

Handler

Server

Socket

Client

Socket

Server

Socket

Request

Response

Request

Response

modprobe in IaaS

modprobe in IaaS

Kernel

Kernel

Kernel*

VM hypervisor (IaaS)

 

 

PUT

 

 

 

 

PUT

 

 

 

 

POST

 

 

 

 

POST

 

 

 

 

GET

 

 

 

 

GET

 

 

RESTful API from A

RESTful API from B

Made with Slides.com