microservices without the hassle

37
Microservices without the Hassle Alexis Richardson & Fintan Ryan Weaveworks Contact: [email protected] @weaveworks

Upload: fintan-ryan

Post on 07-Aug-2015

24 views

Category:

Technology


1 download

TRANSCRIPT

Microservices without the Hassle!

Alexis Richardson & Fintan Ryan !Weaveworks!

!Contact:!

[email protected]!@weaveworks!

- Martin Fowler!

“Microservices are an approach to developing a single application as a suite of small,

connected, services”!

“Loosely coupled service orientated architecture !with bounded contexts”!

!- Adrian Cockcroft!

Docker, Port Mapping !and Service Registries!

Make Microservices Easy?!

Port Mapping is Easy?!!

# docker run –d –p 12345:54321 myapp!

Port Mapping is Easy?!!# docker run –d –p 12345:54321 myapp-a !

# docker run –d –p 12346:64321 myapp-b!# docker run –d –p 12347:74321 myapp-c!

!

Port Mapping is Easy?!Lets go to two hosts!

!!

> 1 host!•  We now need (at a minimum)!

•  A lookup mechanism!

•  A way to make our apps aware of other services!

•  Which means!

•  Application modifications!

•  More integration points!

Have we not heard this before?!

Appservers? Platforms?!

•  We have, and generally when someone wants to sell you another “layer”, such as an app server!

•  One size does not fit all!

•  Not every app is a 12 factor web app, fits neatly into a PaaS or requires the functionality of an appserver!

•  Small composable tools and services work!

Virtual Machines for Microservices Deployment!

•  Overhead for monolith apps is acceptable!

•  Useful, but far too heavyweight, for microservices as the number of instances increase!

•  People still think of, and manage, virtual machines as servers… hard to run 10 of them in dev on laptop!

•  Exacerbates VM sprawl!

Containers for Microservices Deployment!

•  Scale from laptop to cloud!

•  Many can be run on a single host without impacting each other!

•  Extremely quick to launch and kill!

•  Easy to integrate into your CI solution!

•  Allow very fine grained specification and control !

•  Individual containers are very portable & lightweight!

Single Host Purpose!

Machines Containers!

• Easy to use !• Single Purpose environment!• Microservices!!

• But: non trivial once you move beyond a single host and micro-services need networking and other tooling!

Multi Host!

What’s needed!•  For multi host micro-services with containers need!

•  As easy to use as docker!

•  and configurable via software to support automation!

•  Scale from laptop to cloud!

•  As portable as docker!

•  Consistent in a dynamic environment (services start, stop, fail)!

•  Scale independent of IaaS or other infrastructure!

Weave!•  What? Portable application clusters made easy!

•  How? Service discovery & address automation via a secure, application orientated virtual container network!

•  Write the application and get the networking to do what you need not vice versa!

•  Minimum configuration, it just works !

•  Containers do not require specialist knowledge of other containers to connect to each other!

Weave!

•  Connect services across hosts!

•  Across data centres!

•  Across clouds!

Weave!

•  Connect services across hosts!

•  Across data centres!

•  Across clouds!

With the same interface and !

no application changes!

Single Host!

Multiple Hosts!

Multiple Clouds!

Service Discovery!

•  Service discovery is key to microservices!

•  What do we really need?!

•  What well known tools solve most of these problems?!

Jeff Lindsay (Progrium) argues!

Lookup and Connect to Services!

Register services and monitor service health!

Highly available service directory!

What do we really need?!

Microservices Questions!

Lookup and Connect to Services! essential!

Register services and monitor service health!

essential, but in two parts – service monitoring and

container monitoring!Highly available service

directory!YAGNI in a lot of

cases!

What do most developers need?!

Containers & Port Mapping!

•  Port mapping everywhere!

•  An anti-pattern we have developed out of necessity in the monolith era!

•  Transposed to Microservices!

•  And avoidable….. !

DNS!

•  Very well defined, well understood protocol!

•  Ubiquitous !

•  We have spent most of the cloud era avoiding DNS because of “organisational scar tissue”!

Containers & WeaveDNS!

•  No need to do port mapping ~ eliminates most use cases for a service directory!

•  Automatically registers services using DNS!

•  “Container health” – the service is either in DNS or not, monitor service health separately !

WeaveDNS!•  DNS for containers!

•  Part of Weave!

•  very lightweight!

•  nothing to configure!

•  nothing to maintain!

•  no change request to submit when you need a new name…. !

WeaveDNS!•  Just launch your containers with a hostname!

•  WeaveDNS will do the rest!

•  Service is addressable by a known hostname!

•  WeaveDNS can do simple round robin load balancing efficiently as you are in a constrained network!

•  Easy to query via dig for information that load balancers or other tools may need!

WeaveDNS!

An Example!

Questions?!!

@weaveworks / @monadic / @fintanr!!