SlideShare uma empresa Scribd logo
1 de 41
Migrating to Microservices
Adrian Cockcroft @adrianco
QCon London – 6th March 2014
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/migration-cloud-native
Presented at QCon London
www.qconlondon.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
3 | Battery Ventures	
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
4 | Battery Ventures
5 | 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
7 | Battery Ventures	
Demands on IT Increased 1000x
Compete or lose in the market!
8 | Battery Ventures	
Colonel Boyd USAF, on Combat
“Get inside your
adversaries' OODA
loop to disorient them”
Observe
Orient
Decide
Act
10 | Battery Ventures	
How fast can you act?
15 | Battery Ventures	
Process Hand-Off Steps for Product Development on IaaS
Product Manager
Development Team
QA Integration Team
Operations Deploy Team
BI Analytics Team
16 | Battery Ventures	
Process Hand-Off Steps for Feature Development on PaaS
Product Manager
Developer
BI Analytics Team
17 | Battery Ventures	
What Happened?
Rate of
change
increased
Cost and size
and risk of
change
reduced
18 | Battery Ventures	
Observe
Orient
Decide
Act
Land grab
opportunity
Competitive
Move
Customer
Pain Point
Analysis
JFDI
Plan
Response
Share Plans
Incremental
Features
Automatic
Deploy
Launch AB
Test
Model
Hypotheses
BIG DATA
INNOVATION
CULTURE
CLOUD
Measure
Customers
Continuous
Delivery on
Cloud
19 | Battery Ventures	
OK, how do I get there?
20 | Battery Ventures	
"This is the IT swamp draining manual for anyone who is neck deep in alligators.”
Adrian Cockcroft, Cloud Architect at Netflix
22 | 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
23 | 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
25 | 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
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
Cassandra Replicas
Zone A
Cassandra Replicas
Zone B
Cassandra Replicas
Zone C
US-West-2 Region - Oregon
Cassandra Replicas
Zone A
Cassandra Replicas
Zone B
Cassandra Replicas
Zone C
US-East-1 Region - Virginia
Test
Load
Test
Load
Validation
Load
Inter-Zone Traffic
1 Million writes
CL.ONE (wait for one
replica to ack)
1 Million reads
After 500ms
CL.ONE with no
Data loss
Inter-Region Traffic
Sustained 9Gbits/s, 83ms
18TB takes about 5hrs
18TB
backups
from S3
27 | Battery Ventures	
Team BTeam A Team C Team D
NetflixOSS Style Microservices Deployment
API Proxy
Zuul
Karyon1
Staash1
Cassandra
Karyon2
Karyon3
Karyon4
Karyon5
Staash2
MySQL
Karyon6
EVcache
S3
Eureka
Edda
Platform Services
for service registry
and black box
recorder
External API
defined by proxy
which routes to
various backends
28 | 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
29 | Battery Ventures	
Micro-service Interaction Swimlane Diagram
Two Karyon based services keeping state in an EVcache
31 | 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
32 | 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 3rd 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
33 | 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
34 | Battery Ventures	
Micro-services Bring-Up Strategy
Simplest and Soonest
35 | 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?”
36 | 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()
37 | Battery Ventures	
Shadow Redirect Pattern
Cloud Data Source
micro-services
Shadow Cloud API
front end micro-
service
Modified Monolithic
Datacenter
Instances
Monolith
Cloud API
micro-
service
Video list by
user
Metadata by
video
One
request
per visit
38 | 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
39 | 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”
40 | Battery Ventures	
Automatic Canary Red/Black Deployment
●  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
In use at Netflix for tens of large fleet microservices in active development
Netflix Bad Canary Signature
Netflix Happy Canary Signature
Netflix Global Deploy-to-Prod Automation
Cassandra Replicas
Zone A
Cassandra Replicas
Zone B
Cassandra Replicas
Zone C
West Coast Load Balancers
Cassandra Replicas
Zone A
Cassandra Replicas
Zone B
Cassandra Replicas
Zone C
East Coast Load Balancers
Cassandra Replicas
Zone A
Cassandra Replicas
Zone B
Cassandra Replicas
Zone C
Europe Load Balancers
Afternoon in California
Code checked in
Night-time in Europe
Next day on East CoastAfter peak on West Coast After peak in Europe
If passes test suite, canary then deploy
Canary then deployCanary then deploy
44 | Battery Ventures	
Monitoring Micro-services
●  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
Visualizing the request flow
45 | Battery Ventures	
Scaling Continuous Delivery Models
●  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
●  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
Monolithic – Etsy, Facebook Microservices – Netflix, Gilt
46 | Battery Ventures	
Separation of Concerns
Bounded Contexts
47 | 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
49 | 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 6th, 2014
●  Monitorama Keynote Portland OR - May 7th, 2014
●  GOTO Chicago Opening Keynote May 20th, 2014
●  DevOps Summit at Cloud Expo New York – June 10th, 2014
●  GOTO Copenhagen/Aarhus – Denmark – Oct 25th, 2014
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/migration
-cloud-native

Mais conteúdo relacionado

Destaque

ASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architectureASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architecture
Avisi B.V.
 

Destaque (19)

Lessons Learned on Uber's Journey into Microservices
Lessons Learned on Uber's Journey into MicroservicesLessons Learned on Uber's Journey into Microservices
Lessons Learned on Uber's Journey into Microservices
 
Platform strategy
Platform strategyPlatform strategy
Platform strategy
 
ASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architectureASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architecture
 
Monitoring docker containers and dockerized applications
Monitoring docker containers and dockerized applicationsMonitoring docker containers and dockerized applications
Monitoring docker containers and dockerized applications
 
From a monolith to microservices with Azure Service Fabric
From a monolith to microservices with Azure Service FabricFrom a monolith to microservices with Azure Service Fabric
From a monolith to microservices with Azure Service Fabric
 
Monitoring Docker containers - Docker NYC Feb 2015
Monitoring Docker containers - Docker NYC Feb 2015Monitoring Docker containers - Docker NYC Feb 2015
Monitoring Docker containers - Docker NYC Feb 2015
 
Measuring Micro-services. Richard Rodger
Measuring Micro-services. Richard RodgerMeasuring Micro-services. Richard Rodger
Measuring Micro-services. Richard Rodger
 
ContainerDays NYC 2016: "Observability and Manageability in a Container Envir...
ContainerDays NYC 2016: "Observability and Manageability in a Container Envir...ContainerDays NYC 2016: "Observability and Manageability in a Container Envir...
ContainerDays NYC 2016: "Observability and Manageability in a Container Envir...
 
Voxxed Days Thessaloniki 2016 - Microservices in production
Voxxed Days Thessaloniki 2016 - Microservices in productionVoxxed Days Thessaloniki 2016 - Microservices in production
Voxxed Days Thessaloniki 2016 - Microservices in production
 
BFF Pattern in Action: SoundCloud’s Microservices
BFF Pattern in Action: SoundCloud’s MicroservicesBFF Pattern in Action: SoundCloud’s Microservices
BFF Pattern in Action: SoundCloud’s Microservices
 
2008 "An overview of Methods for analysis of Identifiability and Observabilit...
2008 "An overview of Methods for analysis of Identifiability and Observabilit...2008 "An overview of Methods for analysis of Identifiability and Observabilit...
2008 "An overview of Methods for analysis of Identifiability and Observabilit...
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Azure service fabric: a gentle introduction
Azure service fabric: a gentle introductionAzure service fabric: a gentle introduction
Azure service fabric: a gentle introduction
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to MicroservicesLessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
 
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracingTracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
 
Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...
Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...
Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...
 
Monitoring and observability
Monitoring and observabilityMonitoring and observability
Monitoring and observability
 
From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015
 

Mais de C4Media

Mais de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Migrating to Microservices

  • 1. Migrating to Microservices Adrian Cockcroft @adrianco QCon London – 6th March 2014
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /migration-cloud-native
  • 3. Presented at QCon London www.qconlondon.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. 3 | Battery Ventures 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
  • 5. 4 | Battery Ventures
  • 6. 5 | 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
  • 7. 7 | Battery Ventures Demands on IT Increased 1000x Compete or lose in the market!
  • 8. 8 | Battery Ventures Colonel Boyd USAF, on Combat “Get inside your adversaries' OODA loop to disorient them” Observe Orient Decide Act
  • 9. 10 | Battery Ventures How fast can you act?
  • 10. 15 | Battery Ventures Process Hand-Off Steps for Product Development on IaaS Product Manager Development Team QA Integration Team Operations Deploy Team BI Analytics Team
  • 11. 16 | Battery Ventures Process Hand-Off Steps for Feature Development on PaaS Product Manager Developer BI Analytics Team
  • 12. 17 | Battery Ventures What Happened? Rate of change increased Cost and size and risk of change reduced
  • 13. 18 | Battery Ventures Observe Orient Decide Act Land grab opportunity Competitive Move Customer Pain Point Analysis JFDI Plan Response Share Plans Incremental Features Automatic Deploy Launch AB Test Model Hypotheses BIG DATA INNOVATION CULTURE CLOUD Measure Customers Continuous Delivery on Cloud
  • 14. 19 | Battery Ventures OK, how do I get there?
  • 15. 20 | Battery Ventures "This is the IT swamp draining manual for anyone who is neck deep in alligators.” Adrian Cockcroft, Cloud Architect at Netflix
  • 16. 22 | 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
  • 17. 23 | 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
  • 18. 25 | 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
  • 19. 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 Cassandra Replicas Zone A Cassandra Replicas Zone B Cassandra Replicas Zone C US-West-2 Region - Oregon Cassandra Replicas Zone A Cassandra Replicas Zone B Cassandra Replicas Zone C US-East-1 Region - Virginia Test Load Test Load Validation Load Inter-Zone Traffic 1 Million writes CL.ONE (wait for one replica to ack) 1 Million reads After 500ms CL.ONE with no Data loss Inter-Region Traffic Sustained 9Gbits/s, 83ms 18TB takes about 5hrs 18TB backups from S3
  • 20. 27 | Battery Ventures Team BTeam A Team C Team D NetflixOSS Style Microservices Deployment API Proxy Zuul Karyon1 Staash1 Cassandra Karyon2 Karyon3 Karyon4 Karyon5 Staash2 MySQL Karyon6 EVcache S3 Eureka Edda Platform Services for service registry and black box recorder External API defined by proxy which routes to various backends
  • 21. 28 | 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
  • 22. 29 | Battery Ventures Micro-service Interaction Swimlane Diagram Two Karyon based services keeping state in an EVcache
  • 23. 31 | 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
  • 24. 32 | 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 3rd 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
  • 25. 33 | 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
  • 26. 34 | Battery Ventures Micro-services Bring-Up Strategy Simplest and Soonest
  • 27. 35 | 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?”
  • 28. 36 | 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()
  • 29. 37 | Battery Ventures Shadow Redirect Pattern Cloud Data Source micro-services Shadow Cloud API front end micro- service Modified Monolithic Datacenter Instances Monolith Cloud API micro- service Video list by user Metadata by video One request per visit
  • 30. 38 | 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
  • 31. 39 | 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”
  • 32. 40 | Battery Ventures Automatic Canary Red/Black Deployment ●  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 In use at Netflix for tens of large fleet microservices in active development
  • 33. Netflix Bad Canary Signature
  • 34. Netflix Happy Canary Signature
  • 35. Netflix Global Deploy-to-Prod Automation Cassandra Replicas Zone A Cassandra Replicas Zone B Cassandra Replicas Zone C West Coast Load Balancers Cassandra Replicas Zone A Cassandra Replicas Zone B Cassandra Replicas Zone C East Coast Load Balancers Cassandra Replicas Zone A Cassandra Replicas Zone B Cassandra Replicas Zone C Europe Load Balancers Afternoon in California Code checked in Night-time in Europe Next day on East CoastAfter peak on West Coast After peak in Europe If passes test suite, canary then deploy Canary then deployCanary then deploy
  • 36. 44 | Battery Ventures Monitoring Micro-services ●  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 Visualizing the request flow
  • 37. 45 | Battery Ventures Scaling Continuous Delivery Models ●  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 ●  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 Monolithic – Etsy, Facebook Microservices – Netflix, Gilt
  • 38. 46 | Battery Ventures Separation of Concerns Bounded Contexts
  • 39. 47 | 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
  • 40. 49 | 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 6th, 2014 ●  Monitorama Keynote Portland OR - May 7th, 2014 ●  GOTO Chicago Opening Keynote May 20th, 2014 ●  DevOps Summit at Cloud Expo New York – June 10th, 2014 ●  GOTO Copenhagen/Aarhus – Denmark – Oct 25th, 2014
  • 41. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/migration -cloud-native