Upload
thoughtworks
View
619
Download
4
Tags:
Embed Size (px)
Citation preview
@samnewman#thoughtworks
Accounts
Returns
Invoicing
Shipping
Inventory
Customer Service
Small Autonomous services that work together, modelled
around a business domain
@samnewman#thoughtworks
Single Repo
ONE GIANT BUILD
Version Control
/Service A
/Service B
/Service C
@samnewman#thoughtworks
Single Repo
ONE GIANT BUILD
Version Control
/Service A
/Service B
/Service C
CI Tool
Monolithic Build
@samnewman#thoughtworks
Single Repo
ONE GIANT BUILD
Version Control
/Service A
/Service B
/Service C
CI Tool
Monolithic Build
Service B v123
Service A v123
Service C v123
@samnewman#thoughtworks
Single Repo
ONE GIANT BUILD
Version Control
/Service A
/Service B
/Service C
CI Tool
Monolithic Build
Service B v123
Service A v123
Service C v123
One checkin = lots of services built
@samnewman#thoughtworks
Single Repo
ONE GIANT BUILD
Version Control
/Service A
/Service B
/Service C
CI Tool
Monolithic Build
Service B v123
Service A v123
Service C v123
One checkin = lots of services built
Can’t independently release in a safe manner
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service A
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B v456
Service B
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B v456
Service B
Service C
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B v456
Service C v789
Service B
Service C
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B v456
Service C v789
Can build & release independently
Service B
Service C
@samnewman#thoughtworks
Single Repo
ONE BUILD PER SERVICE, SINGLE REPO
Version Control CI Tool
/Service A
/Service B
/Service C
Service AService A
v123
Service B v456
Service C v789
Can build & release independently
Can encourage making cross-repo changes
Service B
Service C
@samnewman#thoughtworks
ONE BUILD & REPO PER SERVICE
Version Control CI Tool
Service A
Service B v123
Service A v123
Service C v123
Service B
Service C
/Service A
/Service B
/Service C
@samnewman#thoughtworks
ONE BUILD & REPO PER SERVICE
Version Control CI Tool
Service A
Service B v123
Service A v123
Service C v123
Can build & release independently
Service B
Service C
/Service A
/Service B
/Service C
@samnewman#thoughtworks
ONE BUILD & REPO PER SERVICE
Version Control CI Tool
Service A
Service B v123
Service A v123
Service C v123
Can build & release independently
Firmer separation, but developer workflow can suffer
Service B
Service C
/Service A
/Service B
/Service C
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT ProdLarge Tests
Artifacts should be built once, and moved through environments
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT ProdLarge Tests
Artifacts should be built once, and moved through environments
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT ProdLarge Tests
Artifacts should be built once, and moved through environments
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT ProdLarge Tests
More Production Like
Artifacts should be built once, and moved through environments
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT ProdLarge Tests
Faster Feedback
More Production Like
Artifacts should be built once, and moved through environments
@samnewman#thoughtworks
SO, ARTIFACTS….
▫︎Bundles-o-stuff
▫︎ Tech-stack specific
▫︎OS-specific
▫︎Custom Images
@samnewman#thoughtworks
SO, ARTIFACTS….
▫︎Bundles-o-stuff
▫︎ Tech-stack specific
▫︎OS-specific
▫︎Custom Images
▫︎Containers
@samnewman#thoughtworks
Host
Service Service
Service Service
Application Containers
OSGI
Actor-based Systems
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
VS
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
Easier To Provision
VS
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
Easier To Provision
Fewer Side-effects
VS
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
Easier To Provision
Fewer Side-effectsLower host-management overhead
VS
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
Easier To Provision
Fewer Side-effectsCheaper!
Lower host-management overhead
VS
@samnewman#thoughtworks 21
Host
Service
Host
Service Service
Service Service
Much Easier To Reason About
Easier To Provision
Fewer Side-effectsCheaper!
Lower host-management overhead
VS
Enforces Interdependence
@samnewman#thoughtworks
Ansible
Puppet
Chef
AWS
Digital Ocean
OpenStack
VMWare
Vagrant
Immutable Servers
@samnewman#thoughtworks
Ansible
Puppet
Chef
AWS
Digital Ocean
OpenStack
VMWare
Vagrant
Immutable Servers
Fast Spin-up
@samnewman#thoughtworks
Ansible
Puppet
Chef
AWS
Digital Ocean
OpenStack
VMWare
Vagrant
Immutable Servers
Fast Spin-up
Provider Agnostic
@samnewman#thoughtworks
Ansible
Puppet
Chef
AWS
Digital Ocean
OpenStack
VMWare
Vagrant
Immutable Servers
Fast Spin-up
Provider Agnostic
Feedback Can Suffer
@samnewman#thoughtworks
Ansible
Puppet
Chef
AWS
Digital Ocean
OpenStack
VMWare
Vagrant
Immutable Servers
Fast Spin-up
Provider Agnostic
Feedback Can Suffer
Cycle Time
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT Prod
DB
Machine CI Node
Large Tests Environment
Large Tests
@samnewman#thoughtworks
S/M TestsBuild Large Tests UAT Prod
Master DB
Machine
Production Environment
Machine Machine Machine
Slave DB
@samnewman#thoughtworks
ENVIRONMENTS
▫︎Artifact remains the same…
▫︎But the environment differs
▫︎How can we handle this?
@samnewman#thoughtworks
DNS
Shop Inventory
inventory: inventory.mycompany.com
DNS Service
@samnewman#thoughtworks
DNS
Shop Inventory
inventory: inventory.mycompany.com
DNS Service
@samnewman#thoughtworks
DNS
Shop Inventory
inventory: inventory.mycompany.com
DNS Service
Configuring DNS?
@samnewman#thoughtworks
DNS
Shop Inventory
inventory: inventory.mycompany.com
DNS Service
Configuring DNS?
DNS propagation time?
@samnewman#thoughtworks
SERVICE DISCOVERY TOOL
Shop Inventory
Service Discovery
inventory: 10.1.1.10 I’m here!
@samnewman#thoughtworks
SERVICE DISCOVERY TOOL
Shop Inventory
Service Discovery
inventory: 10.1.1.10 I’m here!
@samnewman#thoughtworks
SERVICE DISCOVERY TOOL
Shop
Service Discovery
inventory: 10.1.1.10 I’m here!
@samnewman#thoughtworks
SERVICE DISCOVERY TOOL
Shop
Service Discovery
inventory: 10.1.1.10
Inventory
I’m here!
@samnewman#thoughtworks
SERVICE DISCOVERY TOOL
Shop
Service Discovery
Inventory
inventory: 10.1.1.25 I’m here!
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - LOAD BALANCING
Load Balancing
ClientServer or client load balancing
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - LOAD BALANCING
Load Balancing
ClientServer or client load balancing
Distribution algorithms can vary
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - LOAD BALANCING
Load Balancing
ClientServer or client load balancing
Distribution algorithms can vary
Software or hardware based
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - COMPETING CONSUMERS
Customer Servicecreate
customer created
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - COMPETING CONSUMERS
Customer Servicecreate
customer created
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - COMPETING CONSUMERS
Customer Servicecreate
customer created
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - COMPETING CONSUMERS
Customer Servicecreate
customer created
Requires shared state
@samnewman#thoughtworks
HORIZONTAL DUPLICATION - COMPETING CONSUMERS
Customer Servicecreate
customer created
Requires shared state
Lots of variations on this ‘scatter gather’ approach
@samnewman#thoughtworks
DATA PARTITIONING - SHARDING BY KEY
Customer Service Nodes
A-E F-M N-R S-Z
Load Balancing
Client
@samnewman#thoughtworks
DATA PARTITIONING - SHARDING BY KEY
Customer Service Nodes
A-E F-M N-R S-Z
Load Balancing
Client
@samnewman#thoughtworks
DATA PARTITIONING - SHARDING BY KEY
Customer Service Nodes
A-E F-M N-R S-Z
Getting shard keys right is key - rebalancing is painful!
Load Balancing
Client
@samnewman#thoughtworks
DATA PARTITIONING - SHARDING BY KEY
Customer Service Nodes
A-E F-M N-R S-Z
Getting shard keys right is key - rebalancing is painful!
Can combine with other scaling (e.g. load balancing)
Load Balancing
Client
@samnewman#thoughtworks
Strangler App
Legacy App
Legacy App
Requests
Legacy App
30 - 60 Concurrent Requests
@samnewman#thoughtworks
Strangler App
Legacy App
Legacy App
Requests
Legacy App
30 - 60 Concurrent Requests
> 800 Concurrent Requests
@samnewman#thoughtworks
Strangler App
Legacy App
Legacy App
Requests
Legacy App
30 - 60 Concurrent Requests
> 800 Concurrent Requests
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Thread Pool
Failing…slowly!
Thread-pool exhausted
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Thread Pool
Failing…slowly!
Thread-pool exhausted
No requests to other downstream apps
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Thread Pool
Failing…slowly!
Thread-pool exhausted
No requests to other downstream apps
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Thread Pool
Failing…slowly!
Thread-pool exhausted
Requests Building Up
No requests to other downstream apps
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Fix Timeouts
Thread Pool Thread PoolThread Pool
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Fix Timeouts
Thread Pool Thread PoolThread PoolBulkhead
Downstream Connections
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Fix Timeouts
Thread Pool Thread PoolThread PoolBulkhead
Downstream Connections
@samnewman#thoughtworks
Strangler App
Legacy App Legacy App Legacy App
Fix Timeouts
Thread Pool Thread PoolThread PoolBulkhead
Downstream Connections
Circuit Breakers
@samnewman#thoughtworks
http://www.flickr.com/photos/kalexanderson/5421517469/
@samnewman#thoughtworks
http://www.flickr.com/photos/kalexanderson/5421517469/
@samnewman#thoughtworks
Sam Newman
Building MicroservicesDESIGNING FINE-GRAINED SYSTEMS
http://buildingmicroservices.com/
AUTHD