Migrating to Microservices. Adrian Cockcroft @adrianco QCon London 6 th March 2014

Similar documents
Velocity and Volume (or Speed Wins)

Design For Availability. October 2013 Stevan Vlaovic

NetflixOSS A Cloud Native Architecture

From the Monolith to Microservices: Evolving Your Architecture to Scale. Randy linkedin.com/in/randyshoup

Netflix: Building Up and Scaling Out on Open Source

Netflix and Open Source. April 2013 Adrian

NetflixOSS A Cloud Native Architecture

Considerations for Adopting PaaS (Platform as a Service)

On- Prem MongoDB- as- a- Service Powered by the CumuLogic DBaaS Platform

A Sumo Logic White Paper. Harnessing Continuous Intelligence to Enable the Modern DevOps Team

Servers. Servers. NAT Public Subnet: /20. Internet Gateway. VPC Gateway VPC: /16

The Virtualization Practice

IAN MASSINGHAM. Technical Evangelist Amazon Web Services

Fault-Tolerant Computer System Design ECE 695/CS 590. Putting it All Together

Scaling Database Performance in Azure

Technology Enablement

High-Availability in the Cloud Architectural Best Practices

Big Data Pipeline and Analytics Platform

In Memory Accelerator for MongoDB

Netflix s Journey to the Cloud: Lessons Learned from Netflix s Migration to the Public Cloud

Concevoir et déployer vos applications à base de microservices sur Cloud Foundry

Google Cloud Platform The basics

API Management Introduction and Principles

Scalable Architecture on Amazon AWS Cloud

Microservices on AWS

Cloud-Based dwaf A Real World Deployment Case Study. OWASP 5. April The OWASP Foundation

Developing Cloud Applications using IBM Bluemix. Brian DePradine (Development lead Liberty buildpack)

Reference Model for Cloud Applications CONSIDERATIONS FOR SW VENDORS BUILDING A SAAS SOLUTION

Building Hyper-Scale Platform-as-a-Service Microservices with Microsoft Azure. Patriek van Dorp and Alex Thissen

Cloud Application Development (SE808, School of Software, Sun Yat-Sen University) Yabo (Arber) Xu

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Assignment # 1 (Cloud Computing Security)

WHAT DOES DevOps MEAN FOR YOU?

Technical Overview Simple, Scalable, Object Storage Software

Modern App Architecture for the Enterprise Delivering agility, portability and control with Docker Containers as a Service (CaaS)

Designing Apps for Amazon Web Services

Architectural patterns for building real time applications with Apache HBase. Andrew Purtell Committer and PMC, Apache HBase

Jenkins World Tour 2015 Santa Clara, CA, September 2-3

Modern Web development and operations practices. Grig Gheorghiu VP Tech Operations Nasty Gal

How to Choose Between Hadoop, NoSQL and RDBMS

Linux A first-class citizen in Windows Azure. Bruno Terkaly bterkaly@microsoft.com Principal Software Engineer Mobile/Cloud/Startup/Enterprise

White Paper. Cloud Native Advantage: Multi-Tenant, Shared Container PaaS. Version 1.1 (June 19, 2012)

Table of Contents. Abstract. Cloud computing basics. The app economy. The API platform for the app economy

Modern IT Operations Management. Why a New Approach is Required, and How Boundary Delivers

GigaSpaces Real-Time Analytics for Big Data

DISTRIBUTED SYSTEMS [COMP9243] Lecture 9a: Cloud Computing WHAT IS CLOUD COMPUTING? 2

Best Practices for Monitoring Databases on VMware. Dean Richards Senior DBA, Confio Software

Learning Management Redefined. Acadox Infrastructure & Architecture

Gregory PaaS team

Orchestrating Distributed Deployments with Docker and Containers 1 / 30

Alfresco Enterprise on AWS: Reference Architecture

[Hadoop, Storm and Couchbase: Faster Big Data]

Building a Scalable News Feed Web Service in Clojure

WE RUN SEVERAL ON AWS BECAUSE WE CRITICAL APPLICATIONS CAN SCALE AND USE THE INFRASTRUCTURE EFFICIENTLY.

Web Application Deployment in the Cloud Using Amazon Web Services From Infancy to Maturity

Migrating a running service to AWS

Amazon EC2 Product Details Page 1 of 5

A distributed system is defined as

Amazon Elastic Beanstalk

Expand Your Infrastructure with the Elastic Cloud. Mark Ryland Chief Solutions Architect Jenn Steele Product Marketing Manager

Practical Cassandra. Vitalii

OpenStack Introduction. November 4, 2015

SCALABILITY IN THE CLOUD

Cloud Service Model. Selecting a cloud service model. Different cloud service models within the enterprise

Build & Manage Clouds with Red Hat Cloud Infrastructure Products. TONI WILLBERG Solution Architect Red Hat toni@redhat.com

Modern Application Architecture for the Enterprise

Easy Deployment of Mission-Critical Applications to the Cloud

ACCELERATE DEVOPS USING OPENSHIFT PAAS

Cognos Performance Troubleshooting

Scaling Analysis Services in the Cloud

Lecture 3: Scaling by Load Balancing 1. Comments on reviews i. 2. Topic 1: Scalability a. QUESTION: What are problems? i. These papers look at

No-SQL Databases for High Volume Data

Putting a Red Nose on the Cloud

Amazon Web Services Primer. William Strickland COP 6938 Fall 2012 University of Central Florida

12 Factor App. Best Practices for Scala Deployment

Web Application Hosting in the AWS Cloud Best Practices

ONOS [Open Source SDN Network Operating System for Service Provider networks]

Architecting For Failure Why Cloud Architecture is Different! Michael Stiefel

XDB. Shared MySQL hosting at Facebook scale. Evan Elias Percona Live MySQL Conference, April 2015

Evaluation of NoSQL databases for large-scale decentralized microblogging

Big Data Integration: A Buyer's Guide

SCALABILITY. Hodicska Gergely. Web Engineering Manager as Ustream. May 7, 2012

Cloud, Beyond the Hype

Social Networks and the Richness of Data

CUMULUX WHICH CLOUD PLATFORM IS RIGHT FOR YOU? COMPARING CLOUD PLATFORMS. Review Business and Technology Series

Architecting Applications to Scale in the Cloud

Amazon Web Services Yu Xiao

CloudCenter Full Lifecycle Management. An application-defined approach to deploying and managing applications in any datacenter or cloud environment

GET. tech brief FASTER BACKUPS

Transcription:

Migrating to Microservices Adrian Cockcroft @adrianco QCon London 6 th March 2014

What I learned from my time at Netflix Speed wins in the marketplace Remove friction from product development High trust, low process Freedom and responsibility culture Don t do your own undifferentiated heavy lifting Simple patterns automated by tooling Microservices for speed and availability 3 Battery Ventures

4 Battery Ventures

Typical reactions to my Netflix talks You guys are crazy! Can t believe it 2009 What Netflix is doing won t work 2010 It only works for Unicorns like Netflix 2011 We d like to do that but can t 2012 We re on our way using Netflix OSS code 2013 5 Battery Ventures

Demands on IT Increased 1000x Compete or lose in the market! 7 Battery Ventures

Colonel Boyd USAF, on Combat Get inside your adversaries' OODA loop to disorient them Observe Orient Decide Act 8 Battery Ventures

How fast can you act? 10 Battery Ventures

Process Hand-Off Steps for Product Development on IaaS Product Manager Development Team QA Integration Team Operations Deploy Team BI Analytics Team 15 Battery Ventures

Process Hand-Off Steps for Feature Development on PaaS Product Manager Developer BI Analytics Team 16 Battery Ventures

What Happened? Rate of change increased Cost and size and risk of change reduced 17 Battery Ventures

Land grab opportunity INNOVATION Competitive Move Launch AB Test Measure Customers Observe Customer Pain Point Automatic Deploy Act Continuous Delivery on Cloud Orient Analysis BIG DATA Incremental Features CLOUD Model Hypotheses Decide Plan Response Share Plans CULTURE JFDI 18 Battery Ventures

OK, how do I get there? 19 Battery Ventures

"This is the IT swamp draining manual for anyone who is neck deep in alligators. Adrian Cockcroft, Cloud Architect at Netflix 20 Battery Ventures

Continuous Deployment for Speed There is no time for handoffs between teams IT is a cloud API providing DevOps automation Run what you wrote root access and Pagerduty High trust culture for fast local action Freedom and responsibility for developers Lean Enterprise coming May 2014 22 Battery Ventures

Open Source Ecosystems The most advanced, scalable and stable code is OSS No procurement cycle, fix and extend it yourself Github is your company s online resume Extensible platforms create ecosystems Give up control to get ubiquity Apache license Don t miss Simon Wardley s Cloud Expo and QCon talks! Innovate, Leverage and Commoditize 23 Battery Ventures

Cloud Native for High Availability Business logic isolation in stateless micro-services Immutable code with instant rollback Auto-scaled capacity and deployment updates Distributed across availability zones and regions De-normalized single function NoSQL data stores NetflixOSS at netflix.github.com and techblog.netflix.com Details from Netflix team at Qcon London March 4-8 2014 25 Battery Ventures

Cloud Native Benchmarking Write intensive test of cross region replication capacity 16 x hi1.4xlarge SSD nodes per zone = 96 total 192 TB of SSD in six locations up and running Cassandra in 20 minutes Test Load 1 Million reads After 500ms CL.ONE with no Data loss Validation Load 1 Million writes CL.ONE (wait for one replica to ack) Test Load US-East-1 Region - Virginia US-West-2 Region - Oregon Zone A Zone B Zone C Zone A Zone B Zone C Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Inter-Zone Traffic Inter-Region Traffic Sustained 9Gbits/s, 83ms 18TB takes about 5hrs 18TB backups from S3

NetflixOSS Style Microservices Deployment Platform Services for service registry and black box recorder API Proxy Zuul External API defined by proxy which routes to various backends Eureka Edda Karyon1 Karyon2 Karyon5 Karyon6 Staash1 Karyon3 Staash2 EVcache Cassandra Karyon4 MySQL S3 Team A Team B Team C Team D 27 Battery Ventures

Separate Concerns Using Micro-services Inverse Conway s Law teams own service groups One verb per single function micro-service Size doesn t matter One developer independently produces a micro-service Each micro-service is it s own build, avoids trunk conflicts Stateless business logic Stateful cached data access layer 28 Battery Ventures

Micro-service Interaction Swimlane Diagram Two Karyon based services keeping state in an EVcache 29 Battery Ventures

Microservices Development Architecture Versioning Leave multiple old microservice versions running Fast introduction vs. slow retirement asymmetry Client libraries Even if you start with a protocol, a client side driver is the end-state Best strategy is to own your own client libraries from the start Multithreading and Non-blocking Calls Reactive model RxJava using Observable to hide threading Try migration from Tomcat to Netty to get non-blocking I/O speedup Enterprise Service Bus / Messaging Message buses are CP with big problems getting to AP Use for send and forget over high latency links 31 Battery Ventures

Microservice APIs API Patterns RPC, REST, Self-describing overhead, public vs. in-house XPATH, jsonpath adds some flexibility but not as useful in-house Scripted API Endpoints - Dynamic Client RPC Pattern See Daniel Jacobson s talks at slideshare.net/netflix March 3 rd 2014 techblog.netflix.com post by Sangeeta Narayanan Service discovery Build time Ivy, Gradle and Artifactory Run time Zookeeper for CP, Eureka for AP Understanding existing code boundaries Structure 101 buy a bigger printer and wallpaper a room 32 Battery Ventures

Microservice Datastores Book: Refactoring Databases SchemaSpy to examine schema structure Denormalization into one datasource per table or materialized view CAP Consistent or Available when Partitioned Look at Jepsen models for common systems aphyr.com/tags/jepsen AP as default for distributed system unless downtime is explicitly OK Circuit Breakers See Fluxcapacitor.com for code examples NetflixOSS Hystrix, Turbine, Latency Monkey, Ribbon/Karyon Also look at Finagle/Zipkin from Twitter and Metrics, Graphite Speed of development vs. scale driving resilience Microservice lifecycle Mature slow changing, new fast changing Number increase over time, services increase in size then split 33 Battery Ventures

Micro-services Bring-Up Strategy Simplest and Soonest 34 Battery Ventures

Strategies for impatient product managers Carrot This new feature you want will be ready faster as a microservice Stick This new feature you want will only be implemented in the new microservice based system Shiny Object Why don t you concentrate on some other part of the system while we get the transition done? 35 Battery Ventures

Shadow Traffic Backend Redirection First attempt to send traffic to cloud based microservice Real traffic stream to validate cloud back end Uncovered lots of process and tools issues Uncovered Service latency issues Modified Monolithic Datacenter Code Path Returns Genre/movie list for a customer Asynchronously duplicates request to cloud Start with send-and-forget mode, ignore response Dynamic Consistent Traffic Percentage If (customerid % 100 < threshold) shadow_call() 36 Battery Ventures

Shadow Redirect Pattern Modified Monolithic Datacenter Instances Shadow Cloud API front end microservice Monolith Cloud API microservice One request per visit Cloud Data Source micro-services Video list by user Metadata by video 37 Battery Ventures

Metadata Shim Micro-service Metadata server isolates new platform from old codebase Isolate/unblock cloud team from metadata team schedule Monolithic code only supports obsolete movie object VMS subsets the metadata Only load data used by cloud micro-services Fast bulk loads for VMS clients speed startup times VMS pre-processes the metadata Explore next generation metadata cache architecture Distribute metadata to micro-services using S3 or memcached 38 Battery Ventures

Microservices Deployment Deployment tooling Vagrant for small services on machine testing Cloud based Asgard tag/developer routing Dependencies described with CFengine promises or Puppet Coordinated deployments with Fabric or CloudFormation Production updates and Immutability Monolithic breaks everything at once Microservice add a new microservice, no impact, route test traffic to it Version aware routing, eventual retirement Systems vs. Goals and Learning from Failure Conways law, Speed/Agility, A B test based improvements Scott Adams How to fail at almost everything and still win big 39 Battery Ventures

Automatic Canary Red/Black Deployment In use at Netflix for tens of large fleet microservices in active development Developer checks in code then get email notifications of progress Jenkins build launches AMI in test account and starts tests If tests pass launch canary signature analysis in production Start one new instance of the old code per zone Start one new instance of the new code per zone Ramp up traffic and analyze metrics on all six If canary signature looks good replace current production Scale canary build up to full capacity Send all the traffic to the new code Wait until after peak traffic time then remove old code instances Security team tools notice the new build via Edda query Automatic penetration test scan 40 Battery Ventures

Netflix Bad Canary Signature

Netflix Happy Canary Signature

Netflix Global Deploy-to-Prod Automation Afternoon in California Code checked in Night-time in Europe If passes test suite, canary then deploy West Coast Load Balancers East Coast Load Balancers Europe Load Balancers Zone A Zone B Zone C Zone A Zone B Zone C Zone A Zone B Zone C Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Cassandra Replicas Canary then deploy After peak on West Coast Canary then deploy Next day on East Coast After peak in Europe

Monitoring Micro-services Visualizing the request flow Appdynamics Instrument the JVM to capture everything including traffic flows Insert tag for every http request with a header annotation guid Visualize the over-all flow or the business transaction flow Boundary.com and Lyatiss CloudWeaver Instrument the packet flows across the network Capture the zone and region config from cloud APIs and tags Correlate, aggregate and visualize the traffic flows Instrumented PaaS Communication Mechanisms CloudFoundry and Apcera route all traffic through NATS NetflixOSS ribbon client and karyon server http annotation guid Scales beyond capabilities of centralized vendor based tools 44 Battery Ventures

Scaling Continuous Delivery Models Monolithic Etsy, Facebook Etsy 8 devs per train Everyone runs the monolith Queue for the next train Coordination chat session Need to learn deploy process Copy code to existing servers Few concurrent versions 50 monolithic updates/day Roll-forward only Done is released to prod Microservices Netflix, Gilt Everyone has their own build Dev runs their own microservice No waiting, no meetings API call to update prod timeline Automated hands-off deploy Immutable code on new servers Unlimited concurrent versions 100s of independent updates Roll-back in seconds Done is retired from prod 45 Battery Ventures

Separation of Concerns Bounded Contexts 46 Battery Ventures

Summary Speed wins in the marketplace Remove friction from product development High trust, low process Freedom and responsibility culture Don t do your own undifferentiated heavy lifting Simple patterns automated by tooling Microservices for speed and availability 47 Battery Ventures

Any Questions? Upcoming Presentations by @adrianco Battery Ventures http://www.battery.com Adrian s Blog http://perfcap.blogspot.com Netflix Tech Blog http://techblog.netflix.com Netflix Slideshare http://slideshare.com/netflix Migrating to Microservices Qcon London - March 6 th, 2014 Monitorama Keynote Portland OR - May 7 th, 2014 GOTO Chicago Opening Keynote May 20 th, 2014 DevOps Summit at Cloud Expo New York June 10 th, 2014 GOTO Copenhagen/Aarhus Denmark Oct 25 th, 2014 49 Battery Ventures