2016-02 Zero to microservices Brandon - Meetupfiles.meetup.com/19519977/2016-02 Zero to... · New...

24
Zero to Microservices in 5 minutes using Docker Containers Mathew Lodge (@mathewlodge) Weaveworks (@weaveworks) https://www.weave.works/

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Weave eventually consistent in-memory DB(AP from the CAP theorem)

24