1 of 174

18.1

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

2 of 174

What is Docker?

18.2

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

3 of 174

What is Docker?

Open source project and company

18.3

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

4 of 174

What is Docker?

Open source project and company

Used to create containers for software applications

18.4

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

5 of 174

What is Docker?

Open source project and company

Used to create containers for software applications

Package Once Deploy Anywhere (PODA)

18.5

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

6 of 174

Advantages

18.6

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

7 of 174

Advantages

Isolation

18.7

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

8 of 174

Advantages

Isolation

Portability - “it works on my machine”

18.8

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

9 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

18.9

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

10 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

18.10

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

11 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

Limit resource usage

18.11

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

12 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

Limit resource usage

Lightweight footprint and minimal overhead

18.12

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

13 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

Limit resource usage

Lightweight footprint and minimal overhead

Simplified dependency

18.13

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

14 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

Limit resource usage

Lightweight footprint and minimal overhead

Simplified dependency

Sharing

18.14

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

15 of 174

Advantages

Isolation

Portability - “it works on my machine”

Snapshotting - Upgrade/downgrade application versions

Security sandbox

Limit resource usage

Lightweight footprint and minimal overhead

Simplified dependency

Sharing

Faster Deployments

18.15

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

16 of 174

Underlying Technology

18.16

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

17 of 174

Underlying Technology

Written in Go

18.17

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

18 of 174

Underlying Technology

Written in Go

Uses several Linux features

18.18

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

19 of 174

Underlying Technology

Written in Go

Uses several Linux features

  • Namespaces to provide isolation

18.19

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

20 of 174

Underlying Technology

Written in Go

Uses several Linux features

  • Namespaces to provide isolation

  • Control groups to share/limit hardware resources

18.20

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

21 of 174

Underlying Technology

Written in Go

Uses several Linux features

  • Namespaces to provide isolation

  • Control groups to share/limit hardware resources

  • Union File System makes it light and fast

18.21

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

22 of 174

Underlying Technology

Written in Go

Uses several Linux features

  • Namespaces to provide isolation

  • Control groups to share/limit hardware resources

  • Union File System makes it light and fast

  • libcontainer defines container format

18.22

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

23 of 174

Is it only Linux?

18.23

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

24 of 174

Is it only Linux?

Natively supported in Linux

18.24

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

25 of 174

Is it only Linux?

Natively supported in Linux

Can be installed on Mac or Windows using

boot2docker

18.25

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

26 of 174

Is it only Linux?

Natively supported in Linux

Can be installed on Mac or Windows using

boot2docker

  • Tiny Core Linux VM

18.26

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

27 of 174

18.27

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

28 of 174

18.28

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

29 of 174

Docker Workflow

Docker Hub

Docker Host

Daemon

Docker Client

18.29

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

30 of 174

Docker Workflow

Docker Hub

Docker Host

Daemon

Docker Client

docker run <image> docker …

18.30

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

31 of 174

Docker Workflow

Docker Hub

Docker Host

Daemon

Docker Client

docker run <image> docker …

18.31

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

32 of 174

Docker Workflow

Docker Hub

Image 1

Image 2

Image 3

Image M

Docker Host

Daemon

Docker Client

docker run <image> docker …

18.32

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

33 of 174

Docker Workflow

Docker Hub

Image 1

Image 2

Image 3

Image M

Docker Host

Image 1

Image 2

Image 3

Image N

Daemon

Docker Client

docker run <image> docker …

18.33

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

34 of 174

Docker Workflow

Docker Hub

Image 1

Image 2

Image 3

Image M

Docker Host

Image 1

Image 2

Image 3

Image N

Daemon

Container 1

Container 2

Container O

Docker Client

docker run <image> docker …

18.34

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

35 of 174

read-only

18.35

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

36 of 174

Union File System

read-only

18.36

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

37 of 174

Union File System

read-only

18.37

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

38 of 174

18.38

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

39 of 174

Image defined in text-based Dockerfile

18.39

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

40 of 174

Image defined in text-based Dockerfile

List of commands to build the image

18.40

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

41 of 174

Image defined in text-based Dockerfile

List of commands to build the image

FROM fedora:latest

CMD echo “Hello world”

18.41

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

42 of 174

Image defined in text-based Dockerfile

List of commands to build the image

FROM fedora:latest

CMD echo “Hello world”

FROM jboss/wildlfy

MAINTAINER Arun Gupta <arungupta@redhat.com>

RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/ movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/ movieplex7-1.0-SNAPSHOT.war

18.42

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

43 of 174

Image defined in text-based Dockerfile

List of commands to build the image

docker build or pull

FROM fedora:latest

CMD echo “Hello world”

FROM jboss/wildlfy

MAINTAINER Arun Gupta <arungupta@redhat.com>

RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/ movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/ movieplex7-1.0-SNAPSHOT.war

18.43

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

44 of 174

18.44

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

45 of 174

18.45

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

46 of 174

18.46

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

47 of 174

Images shared using registry

18.47

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

48 of 174

Images shared using registry

Docker Hub is public SaaS

18.48

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

49 of 174

Images shared using registry

Docker Hub is public SaaS

Private registries can be setup inside firewall

18.49

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

50 of 174

Images shared using registry

Docker Hub is public SaaS

Private registries can be setup inside firewall

docker push or pull <IMAGE_ID>

18.50

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

51 of 174

18.51

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

52 of 174

Container built from image

18.52

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

53 of 174

Container built from image

Runtime representation of image

18.53

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

54 of 174

Container built from image

Runtime representation of image

Self contained execution environment

18.54

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

55 of 174

Container built from image

Runtime representation of image

Self contained execution environment

docker run <IMAGE_ID>

18.55

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

56 of 174

Docker commands

docker ps: List running containers

docker stop: Stop a running container

docker rm: Remove a running container

docker rmi: Remove an image

18.56

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

57 of 174

18.57

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

58 of 174

18.58

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

59 of 174

18.59

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

60 of 174

18.60

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

61 of 174

18.61

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

62 of 174

Benefits of Containers

18.62

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

63 of 174

Application Operating Environment

18.63

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

64 of 174

Kubernetes

18.64

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

65 of 174

Kubernetes

Open source orchestration system for Docker containers

18.65

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

66 of 174

Kubernetes

Open source orchestration system for Docker containers

Provide declarative primitives for the “desired state”

18.66

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

67 of 174

Kubernetes

Open source orchestration system for Docker containers

Provide declarative primitives for the “desired state”

  • Self-healing

18.67

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

68 of 174

Kubernetes

Open source orchestration system for Docker containers

Provide declarative primitives for the “desired state”

  • Self-healing

  • Auto-restarting

18.68

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

69 of 174

Kubernetes

Open source orchestration system for Docker containers

Provide declarative primitives for the “desired state”

  • Self-healing

  • Auto-restarting

  • Schedule across hosts

18.69

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

70 of 174

Kubernetes

Open source orchestration system for Docker containers

Provide declarative primitives for the “desired state”

  • Self-healing

  • Auto-restarting

  • Schedule across hosts

  • Replicating

18.70

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

71 of 174

Key Concepts

18.71

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

72 of 174

Key Concepts

Pods: Smallest deployable unit that can be created, scheduled, managed (logical collection of containers)

18.72

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

73 of 174

Key Concepts

Pods: Smallest deployable unit that can be created, scheduled, managed (logical collection of containers)

Master: Central point that provides unified view of cluster, control one or more minions

18.73

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

74 of 174

Key Concepts

Pods: Smallest deployable unit that can be created, scheduled, managed (logical collection of containers)

Master: Central point that provides unified view of cluster, control one or more minions

Minion: Run tasks from master

18.74

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

75 of 174

Kubernetes

Master

Minion

Container

Pod

Container

Container

Pod

Container

Container

Pod

Container

Docker

Minion

Container

Pod

Container

Container

Pod

Container

Container

Pod

Container

Docker

Minion

Container

Pod

Container

Container

Pod

Container

Container

Pod

Container

Docker

18.75

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

76 of 174

kubectl

18.76

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

77 of 174

kubectl

Controls the Kubernetes cluster manager

18.77

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

78 of 174

kubectl

Controls the Kubernetes cluster manager

kubectl get pods or minions

18.78

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

79 of 174

kubectl

Controls the Kubernetes cluster manager

kubectl get pods or minions

kubectl create -f <filename>

18.79

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

80 of 174

kubectl

Controls the Kubernetes cluster manager

kubectl get pods or minions

kubectl create -f <filename>

lubectl update or delete

18.80

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

81 of 174

kubectl

Controls the Kubernetes cluster manager

kubectl get pods or minions

kubectl create -f <filename>

lubectl update or delete

kubectl resize —replicas=3 replicationcontrollers <name>

18.81

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

82 of 174

Kubernetes Config

{

"id": "mysql",

"kind": "Pod", "apiVersion": "v1beta1", "desiredState": {

"manifest": { "version": "v1beta1", "id": "mysql",

"containers": [{

"name": "mysql",

"image": "mysql", "cpu": 100,

"ports": [{

3306,

"containerPort": "hostPort": 3306

}]

}]

}

},

"labels": {

"name": "mysql"

}

}

18.82

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

83 of 174

Kubernetes Config

{

{

"id": "mysql",

"id": "wildfly",

"kind": "Pod",

"kind": "Pod",

"apiVersion": "v1beta1",

"apiVersion": "v1beta1",

"desiredState": {

"desiredState": {

"manifest": {

"manifest": {

"version": "v1beta1",

"version": "v1beta1",

"id": "mysql",

"id": "wildfly",

"containers": [{

"containers": [{

"name": "mysql",

"name": "wildfly",

"image": "mysql",

"image": "jboss/wildfly",

"cpu": 100,

"cpu": 100,

"ports": [{

"ports": [{

"containerPort":

3306,

"containerPort": 8080,

"hostPort": 3306

"hostPort": 8080

}]

}]

}]

}]

}

}

},

},

"labels": {

"labels": {

"name": "mysql"

"name": "wildfly"

}

}

}

}

18.83

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

84 of 174

Microservices

building applications as suites of services. As well as the fact that services are independently deployable and scalable, each service also provides a firm module boundary, even allowing for different services to be written in different programming languages. They can also be managed by different teams

18.84

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

85 of 174

Is it SOA?

SOA for hipsters?

Fine-grained SOA?

Focus on ESBs in SOA?

SOA done right?

18.85

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

86 of 174

Monolith Application

UI

Database

Business Logic

18.86

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

87 of 174

Monolith Application

UI

Database

Business Logic

HTML

HTML

HTML

CSS

CSS

18.87

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

88 of 174

Monolith Application

UI

Business Logic

HTML

HTML

HTML

CSS

CSS

HTML

HTML

Database

JPA

18.88

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

89 of 174

Monolith Application

UI

Database

Business Logic

HTML

HTML

HTML

CSS

CSS

HTML

HTML

CDI

HTML

HTML

REST

HTML

HTML

JSF

HTML

HTML

JPA

Cache

DB

18.89

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

90 of 174

Monolith Application

UI

Database

Business Logic

HTML

HTML

HTML

CSS

CSS

HTML

HTML

CDI

HTML

HTML

REST

HTML

HTML

JSF

HTML

HTML

JPA

Cache

DB

18.90

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

91 of 174

Monolith Application

UI

Database

Business Logic

HTML

HTML

HTML

CSS

CSS

HTML

HTML

CDI

HTML

HTML

REST

HTML

HTML

JSF

HTML

HTML

JPA

Load Balancer

Cache

DB

18.91

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

92 of 174

Before Microservices

WAR

WAR

JAR

JAR

JAR

EAR

WAR

JAR

18.92

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

93 of 174

Before Microservices

WAR

Cache

WAR

JAR

JAR

JAR

EAR

WAR

JAR

18.93

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

94 of 174

Before Microservices

WAR

Cache

WAR

JAR

JAR

JAR

EAR

WAR

JAR

DB

18.94

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

95 of 174

Before Microservices

WAR

Cache

WAR

JAR

JAR

JAR

EAR

WAR

JAR

DB

18.95

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

96 of 174

Before Microservices

WAR

Cache

Load Balancer

WAR

JAR

JAR

JAR

EAR

WAR

JAR

DB

18.96

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

97 of 174

Advantages of Monolith Application

18.97

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

98 of 174

Advantages of Monolith Application

Typically packaged in a single .ear

18.98

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

99 of 174

Advantages of Monolith Application

Typically packaged in a single .ear

Simple to develop/deploy

18.99

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

100 of 174

Advantages of Monolith Application

Typically packaged in a single .ear

Simple to develop/deploy

Easy to test (all required services are up)

18.100

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

101 of 174

Disadvantages of Monolith Application

18.101

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

102 of 174

Disadvantages of Monolith Application

Difficult to develop and maintain

18.102

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

103 of 174

Disadvantages of Monolith Application

Difficult to develop and maintain

Obstacle to frequent deployments

18.103

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

104 of 174

Disadvantages of Monolith Application

Difficult to develop and maintain

Obstacle to frequent deployments

Makes it difficult to try out new technologies/ framework

18.104

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

105 of 174

Monolith Application

UI

Database

Business Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 1

18.105

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

106 of 174

Monolith Application

UI

Database

ness Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 1

UI

Database

Busi

Business Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 2

18.106

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

107 of 174

Monolith Application

UI

Database

ness Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 1

UI

Database

ess Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 2

UI

Database

Busi

Busin

Business Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 3

18.107

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

108 of 174

Monolith Application

UI

Database

Busi

ness Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 1

UI

Database

Busin

ess Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 2

UI

Database

ess Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 3

UI

Database

Busin

Business Logic

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

HTML

Version 4

18.108

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

109 of 174

18.109

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

110 of 174

Characteristics of µservices

18.110

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

111 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context

18.111

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

112 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)

18.112

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

113 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)

18.113

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

114 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)
  • Designed for failure

18.114

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

115 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)
  • Designed for failure
  • Decentralized, use IPC to communicate

18.115

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

116 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)
  • Designed for failure
  • Decentralized, use IPC to communicate
  • Heterogeneous, polyglot

18.116

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

117 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)
  • Designed for failure
  • Decentralized, use IPC to communicate
  • Heterogeneous, polyglot
  • Full responsibility - “you build it, you run it”

18.117

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

118 of 174

Characteristics of µservices

  • Explicitly published interface, bounded context
  • Domain driven design (full-stack developer)
  • Independently deployable and automated (CI / CD)
  • Designed for failure
  • Decentralized, use IPC to communicate
  • Heterogeneous, polyglot
  • Full responsibility - “you build it, you run it”
  • “Smart endpoints, dumb pipes”

18.118

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

119 of 174

Scaling µservices

18.119

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

120 of 174

Strategies for decomposing

18.120

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

121 of 174

Strategies for decomposing

Verb or usecase - e.g. Checkout UI

18.121

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

122 of 174

Strategies for decomposing

Verb or usecase - e.g. Checkout UI

Noun - e.g. Catalog product service

18.122

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

123 of 174

Strategies for decomposing

Verb or usecase - e.g. Checkout UI

Noun - e.g. Catalog product service

Single Responsible Principle - e.g. Unix utilities

18.123

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

124 of 174

Towards µservices

Service A

EAR

WAR

WAR

WAR

JAR

JAR

JAR

JAR

18.124

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

125 of 174

Towards µservices

Service A

EAR

WAR

DB

WAR

WAR

JAR

JAR

JAR

JAR

18.125

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

126 of 174

Towards µservices

Service A

EAR

WAR

DB

WAR

WAR

JAR

JAR

JAR

JAR

DB

Cache

18.126

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

127 of 174

Towards µservices

Service A

EAR

WAR

DB

WAR

WAR

JAR

JAR

JAR

JAR

DB

Cache

18.127

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

128 of 174

Towards µservices

Service A

EAR

WAR

DB

WAR

WAR

JAR

JAR

JAR

JAR

DB

Cache

18.128

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

129 of 174

Towards µservices

Service A

EAR

WAR

DB

Load Balancer

WAR

WAR

JAR

JAR

JAR

JAR

DB

Cache

18.129

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

130 of 174

Aggregator Pattern #1

Service C

WAR

Service B

WAR

Service A

WAR

18.130

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

131 of 174

Aggregator Pattern #1

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

18.131

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

132 of 174

Aggregator Pattern #1

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Aggregator

Load Balancer

18.132

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

133 of 174

Aggregator Pattern #1

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Aggregator

Load Balancer

18.133

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

134 of 174

Aggregator Pattern #1

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Aggregator

Load Balancer

18.134

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

135 of 174

Proxy Pattern #1.5

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Proxy

Load Balancer

18.135

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

136 of 174

Proxy Pattern #1.5

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Proxy

Load Balancer

18.136

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

137 of 174

Proxy Pattern #1.5

Service C

WAR

Service B

WAR

DB

Cache

Service A

WAR

DB

Cache

DB

Cache

Proxy

Load Balancer

18.137

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

138 of 174

Chained Pattern #2

Service A

WAR

DB

Cache

Load Balancer

18.138

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

139 of 174

Chained Pattern #2

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

18.139

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

140 of 174

Chained Pattern #2

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

18.140

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

141 of 174

Branch Pattern #3

Service A

WAR

DB

Cache

Load Balancer

18.141

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

142 of 174

Branch Pattern #3

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

18.142

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

143 of 174

Branch Pattern #3

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

18.143

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

144 of 174

Branch Pattern #3

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

DB

Cache

18.144

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

145 of 174

Shared Resources #4

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

DB

Cache

18.145

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

146 of 174

Shared Resources #4

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

18.146

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

147 of 174

Shared Resources #4

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

18.147

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

148 of 174

Shared Resources #4

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

18.148

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

149 of 174

Shared Resources #4

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

18.149

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

150 of 174

Async Messaging #5

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

DB

Cache

Queue

18.150

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

151 of 174

Async Messaging #5

Service A

WAR

DB

Cache

Load Balancer

Service B

WAR

DB

Cache

Service C

WAR

DB

Cache

Service D

WAR

DB

Cache

Queue

18.151

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

152 of 174

Decentralized data

18.152

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

153 of 174

Decentralized data

Each service has it owns schema, loose coupling

18.153

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

154 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

18.154

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

155 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

Distributed transactions reduces system availability

18.155

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

156 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

Distributed transactions reduces system availability

Event-driven asynchronous updates

18.156

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

157 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

Distributed transactions reduces system availability

Event-driven asynchronous updates

  • Simplifies development

18.157

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

158 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

Distributed transactions reduces system availability

Event-driven asynchronous updates

  • Simplifies development

  • Availability over consistency

18.158

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

159 of 174

Decentralized data

Each service has it owns schema, loose coupling

Polyglot persistence

Distributed transactions reduces system availability

Event-driven asynchronous updates

  • Simplifies development

  • Availability over consistency

  • Implement compensating transactions

18.159

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

160 of 174

Event-driven async updates

Service A

WAR

DB

Cache

Message Broker

Service B

WAR

DB

Cache

18.160

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

161 of 174

Advantages of µservices

18.161

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

162 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

18.162

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

163 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

18.163

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

164 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

  • Local change can easily deployed, makes CD feasible

18.164

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

165 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

  • Local change can easily deployed, makes CD feasible

  • Each service can scale on X- and Y-axis

18.165

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

166 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

  • Local change can easily deployed, makes CD feasible

  • Each service can scale on X- and Y-axis

  • Improves fault isolation

18.166

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

167 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

  • Local change can easily deployed, makes CD feasible

  • Each service can scale on X- and Y-axis

  • Improves fault isolation

  • Eliminates any long-term commitment to a technology stack

18.167

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

168 of 174

Advantages of µservices

  • Easier to develop, understand, maintain

  • Starts faster than a monolith, speeds up deployments

  • Local change can easily deployed, makes CD feasible

  • Each service can scale on X- and Y-axis

  • Improves fault isolation

  • Eliminates any long-term commitment to a technology stack

  • Freedom of choice of technology, tools, frameworks

18.168

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

169 of 174

Drawbacks of µservices

18.169

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

170 of 174

Drawbacks of µservices

Additional complexity of distributed systems

18.170

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

171 of 174

Drawbacks of µservices

Additional complexity of distributed systems

Significant operational complexity, need high-level of automation

18.171

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

172 of 174

Drawbacks of µservices

Additional complexity of distributed systems

Significant operational complexity, need high-level of automation

Rollout plan to coordinate deployments

18.172

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

173 of 174

Drawbacks of µservices

Additional complexity of distributed systems

Significant operational complexity, need high-level of automation

Rollout plan to coordinate deployments

Slower ROI, to begin with

18.173

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition

174 of 174

Docker and Kubernetes are well suited to create a µservices-based application.

18.174

Silberschatz, Galvin and Gagne ©2018

Operating System Concepts – 10th Edition