Before we get started
http://bit.ly/2x94R7H
Microservices & Best Practices
Jeff Hoffer, Developer Experience
github.com/eudaimos
What are Microservices?
“Service-oriented Architecture
composed of loosely coupled
elements that have bounded
What are Microservices?
• Evolution of Service-Oriented Architecture
• Unix/Linux Philosophy for Application
Systems
• Microservice = do one thing well
• Derive business value from combining
microservices together
What is a Docker?
• library and ecosystem for creating and sharing Containers
• built from features in Linux
• combine all the software resources needed to run a single
application into a single binary and ship it to servers
• a simple shell-like configuration file
• uses a “layered” file system
• boundaries between containers
Before Docker
• Infrastructure automation scripting: Chef,
Puppet, Ansible, etc.
• Deployment scripting: rsync, catalina
deployments, etc.
• Servers as Pets => Servers as Cattle
Why Docker/Containers for Microservices?
• Self-contained binary images
• Run 1000s of containers on various
topologies of hardware and VMs
• What does the Developer need to know vs
the Sys Admin?
What’s the catch?
• Running production systems of
microservices gets very complex
• Even more so when trying to take
advantage of what they provide
• Enter Kubernetes, Prometheus, …
Why Microservices?
• Break up the work
• Conway’s Law - software reflects communication patterns
• Choose the right tool for the job
• Easier to Manage
• Easier to Scale
• Lean Manufacturing/Kanban = Single-piece flow
• Less Change More Often - the alternative is large releases - what
happens when there’s a bug, everything must be tested again
• Continuous Delivery which requires Continuous Integration
Best Practices
• Containerize, containerize, containerize
• Every Service should provide an API or Protocol for Direct Interaction
• Read State
• Modify State
• Service Isolation
• Data Store
• Business Logic
• Service Implementation Language
• Public API
Best Practices
• API Services should publish to a message bus
• Announce State Changes
• React to other Microservices (reactivemanifesto.org)
• Use JSON for messages early - optimize for binary protocols
once you have hardened messages
• Audit logs & reporting data in a separate service - out of band
• Stateless APIs allow horizontal scaling
• Stateful Data Stores - write code for concurrent access
• Organize around Transactions & Entities
Best Practices
• Backwards Compatible APIs
• Graceful Degradation - circuit-breaker pattern,
exponential back-off
• Feature Flags
• Federate Microservice APIs behind a
Gateway/Adapter for end client applications -
web/mobile
How to move to Microservices
• Gradual Implementation - upgrading a ship
at sea
• Choosing your first Microservice
• least dependence
• Implement => adapter from monolith =>
directly communicate
Organizational Changes
• Large Teams
• move to cross-functional service-
oriented teams
• Small Teams
• single owners w/ cross-pollination
• Communication Patterns
The Hard Parts
• Image management => Docker Registry
• Container Hosting => Docker Runtime
• Orchestration => Kubernetes
• Code Management => git flow/github flow
• Continuous Delivery => Weave Flux
• Monitoring => Prometheus/Weave Cortex
• Logging => ELK/beats, fluentd, etc.
• Cluster Management => Weave Scope
• Tracing => ?? (Opentracing.io)
• Distributed Transactions => ??
Cloud Native Foundation Architecture
• cncf.io
• Kubernetes
• Docker => containerd
• CNI
• lots of goodies
Other topics
Kubernetes 101
Prometheus 101
Continuous delivery: hooking up my CI/CD pipeline to
Kubernetes
Network policy for security
We have talks on all these topics in the Weave user
group!
Thanks! Questions?
We are hiring!
DX in San Francisco
Engineers in London & SF
weave.works/weave-company/hiring

Microservices and Best Practices

  • 1.
    Before we getstarted http://bit.ly/2x94R7H
  • 2.
    Microservices & BestPractices Jeff Hoffer, Developer Experience github.com/eudaimos
  • 3.
    What are Microservices? “Service-orientedArchitecture composed of loosely coupled elements that have bounded
  • 4.
    What are Microservices? •Evolution of Service-Oriented Architecture • Unix/Linux Philosophy for Application Systems • Microservice = do one thing well • Derive business value from combining microservices together
  • 5.
    What is aDocker? • library and ecosystem for creating and sharing Containers • built from features in Linux • combine all the software resources needed to run a single application into a single binary and ship it to servers • a simple shell-like configuration file • uses a “layered” file system • boundaries between containers
  • 6.
    Before Docker • Infrastructureautomation scripting: Chef, Puppet, Ansible, etc. • Deployment scripting: rsync, catalina deployments, etc. • Servers as Pets => Servers as Cattle
  • 7.
    Why Docker/Containers forMicroservices? • Self-contained binary images • Run 1000s of containers on various topologies of hardware and VMs • What does the Developer need to know vs the Sys Admin?
  • 8.
    What’s the catch? •Running production systems of microservices gets very complex • Even more so when trying to take advantage of what they provide • Enter Kubernetes, Prometheus, …
  • 9.
    Why Microservices? • Breakup the work • Conway’s Law - software reflects communication patterns • Choose the right tool for the job • Easier to Manage • Easier to Scale • Lean Manufacturing/Kanban = Single-piece flow • Less Change More Often - the alternative is large releases - what happens when there’s a bug, everything must be tested again • Continuous Delivery which requires Continuous Integration
  • 10.
    Best Practices • Containerize,containerize, containerize • Every Service should provide an API or Protocol for Direct Interaction • Read State • Modify State • Service Isolation • Data Store • Business Logic • Service Implementation Language • Public API
  • 11.
    Best Practices • APIServices should publish to a message bus • Announce State Changes • React to other Microservices (reactivemanifesto.org) • Use JSON for messages early - optimize for binary protocols once you have hardened messages • Audit logs & reporting data in a separate service - out of band • Stateless APIs allow horizontal scaling • Stateful Data Stores - write code for concurrent access • Organize around Transactions & Entities
  • 12.
    Best Practices • BackwardsCompatible APIs • Graceful Degradation - circuit-breaker pattern, exponential back-off • Feature Flags • Federate Microservice APIs behind a Gateway/Adapter for end client applications - web/mobile
  • 13.
    How to moveto Microservices • Gradual Implementation - upgrading a ship at sea • Choosing your first Microservice • least dependence • Implement => adapter from monolith => directly communicate
  • 14.
    Organizational Changes • LargeTeams • move to cross-functional service- oriented teams • Small Teams • single owners w/ cross-pollination • Communication Patterns
  • 15.
    The Hard Parts •Image management => Docker Registry • Container Hosting => Docker Runtime • Orchestration => Kubernetes • Code Management => git flow/github flow • Continuous Delivery => Weave Flux • Monitoring => Prometheus/Weave Cortex • Logging => ELK/beats, fluentd, etc. • Cluster Management => Weave Scope • Tracing => ?? (Opentracing.io) • Distributed Transactions => ??
  • 16.
    Cloud Native FoundationArchitecture • cncf.io • Kubernetes • Docker => containerd • CNI • lots of goodies
  • 17.
    Other topics Kubernetes 101 Prometheus101 Continuous delivery: hooking up my CI/CD pipeline to Kubernetes Network policy for security We have talks on all these topics in the Weave user group!
  • 18.
    Thanks! Questions? We arehiring! DX in San Francisco Engineers in London & SF weave.works/weave-company/hiring

Editor's Notes

  • #18 https://www.katacoda.com/courses/weave/kubernetes-training