2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New...
Transcript of 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New...
![Page 1: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/1.jpg)
Zero to Microservices in 5 minutes using Docker ContainersMathew Lodge (@mathewlodge)Weaveworks (@weaveworks)https://www.weave.works/
![Page 2: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/2.jpg)
2
![Page 3: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/3.jpg)
Going faster with software delivery is now a business issue
“Software is eating the world”• The old IT/software model is too slow• Customers expect pace of innovation of
Google, Facebook, Uber, Netflix, Amazon in all things
• Velocity comes from microservices approach & rest of market wants to do the same
Microservices/DevOps to go faster• Smaller teams combining dev & ops roles,
working on smaller services vs. single large code base
• Each microservice team picks its own tech and self-services
• Table stakes: open source, cloud, containers, continuous integration
![Page 4: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/4.jpg)
Problem: Microservices also increase complexity
4Source: Adrian Colyer
![Page 5: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/5.jpg)
New class of “microservices infrastructure” is emerging
• Create Microservices, Manage and Control them– Extreme simplicity and speed– Add value alongside any platform choice, or
standalone– Packaged and priced for bottoms-up team adoption
5
Visual-ization
APIRoutingSDN
Data persistConfig Provision
Microservices infrastructure
Containers
Programmable infra
Scheduling / Orchestration
![Page 6: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/6.jpg)
A typical microservice scenario
6
Replica 1 Replica 2 Replica 3
Client Client Client
API proxy / load balancer
![Page 7: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/7.jpg)
How this used to work in Docker
7
Docker host 1 Docker host 2
Client
808080
Worker
4438443
![Page 8: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/8.jpg)
Docker Networking introduced in v1.9
8
Docker host 1 Docker host 2
Client
80
Worker
443
Ethernet bridge on Docker host VXLAN tunnel between hosts Ethernet bridge on Docker host
![Page 9: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/9.jpg)
Microservice on Docker 1.9
9
Client A container
Client B container
Client C container
Worker X container
Worker Ycontainer
Worker Z container
HA Proxy / nginx
container
Consul 1VM
Consul 2VM
Consul 3VM
Cluster Store
Container SDN
Docker host
config
Docker host
config
![Page 10: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/10.jpg)
Using Weave Net to make things simpler
10
Client A container
Client B container
Client C container
Worker X container
Worker Ycontainer
Worker Z container
Weave Net container
[“Micro DNS”]Container SDN
Consul 1VM
Consul 2VM
Consul 3VM
Cluster Store
![Page 11: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/11.jpg)
Demo• Up and running in less than 5 minutes• Built-in service discovery
![Page 12: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/12.jpg)
Linux HostHow it works• Weave router container runs on each
Docker host– Allocates IP addresses to containers– Maintains IP address to DNS name mapping– Responds to DNS lookups on container
names– “Gossips” updates to other routers, builds
eventually consistent cache
• Inter-host connectivity via VXLAN– All containers on local bridge– Local bridges connected via VXLAN
12
Server/VM/AWS/Azure/GCP
Docker
Weave Docker proxy
Weave router/DNS
Replica n
Client x
Other hosts
![Page 13: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/13.jpg)
Plug-in architectures today
13
Docker
Docker Networking
Libnetwork API
3rd Party libnetworkPlugin
Kubernetes
CNI API
3rd Party CNIPlugin
Underlay Network Underlay Network
![Page 14: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/14.jpg)
Simple deployment on AWS ECS
• Zero configuration beyond starting instances in auto-scale group:– Weave Net automatically finds other Weave routers via Autoscale Groups API
14
AWS Autoscaling Group
Weave ECS AMI
Weave ECS AMI
Weave ECS AMI
Weave ECS AMI
![Page 15: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/15.jpg)
Traditional 3-tier architecture
Incoming traffic
Load balancers
Application servers
Database and replica
![Page 16: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/16.jpg)
Microservice architecture
Public APIWeb UI
NoSQL serversDatabase
MessageBroker
Services
![Page 17: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/17.jpg)
Monitoring microservices is different• Netflix USE*:
– Utilization– Saturation– Error rate
• Utilization metrics– (Success) response times– Queue depth
• Saturation metrics– CPU– Memory– IO bandwidth– Network bandwidth
• Error metrics– Non 2xx HTTP response rate– No response rate
* http://www.brendangregg.com/usemethod.html
![Page 18: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/18.jpg)
Traditional monitoring systems focus on saturation only
![Page 19: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/19.jpg)
Need topology information to use USE
![Page 20: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/20.jpg)
Weave Scope• Microservice-centric monitoring
• Live topology
• No instrumentation, no configuration
• 100% interactive
![Page 21: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/21.jpg)
But how do we get Utilization and Error rates?
![Page 22: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/22.jpg)
Weave Flux demo
22
![Page 23: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/23.jpg)
Thank you!http://www.weave.works/
![Page 24: 2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New class of “microservices infrastructure” is emerging • Create Microservices,](https://reader030.fdocuments.in/reader030/viewer/2022041014/5ec54c9edd9a665a9a6cc896/html5/thumbnails/24.jpg)
Weave eventually consistent in-memory DB(AP from the CAP theorem)
24