ScalableMicroservicesatNetflix-1
ScalableMicroservicesatNetflix-1
• InterProcess Communication
• Takeaways
Netflix - Evolution
Netflix - Evolution
• Old DataCenter (2008) • AWS Cloud (~2010)
• Everything in one WebApp (.war) • 100s of Fine Grained Services
Netflix Scale
• ~ 1/3 of the peak Internet traffic a day
• ~50M subscribers
• ~2 Billion Edge API Requests/Day
• >500 MicroServices
• ~30 Engineering Teams (owning many microservices)
Monolithic Apps
MONOLITHIC APP
Monolithic Architecture
Load Balancer
Monolithic App
Account Catalog
Component Component
User Accounts
Product Catalog
Customer Service
You Think??
TIPPING POINT
& &
Organizational Growth Disverse Functionality Bottleneck in
Monolithic stack
What are
MicroServices?
NOT ABOUT …
• Team size
• Lines of code
• Number of API/EndPoints
MicroService
MegaService
CHARACTERISTICS
• Many smaller (fine grained), clearly scoped services
• Single Responsibility Principle
• Domain Driven Development
• Bounded Context
• Independently Managed
• Clear ownership for each service
• Typically need/adopt the “DevOps” model
tr 'A-Z' 'a-z' < doc.txt | tr -cs 'a-z' '\n' | sort | uniq | comm -23 - /usr/share/dict/words
Load Balancer
Monolithic App
Account Catalog
Component Component
Load Balancer
API Gateway
Service Z
MicroServices
- Why?
WHY?
• Faster and simpler deployments and rollbacks
• Independent Speed of Delivery (by different teams)
• Right framework/tool/language for each domain
• Recommendation component using Python?, Catalog Service in Java ..
• Greater Resiliency
• Fault Isolation
• Better Availability
• If architected right
MicroServices
- Challenges
CHALLENGES
• Operational Overhead
• TIP: Embrace DevOps Model
SERVICE DISCOVERY
• 100s of MicroServices
• Need a Service Metadata Registry (Discovery Service)
X
Service Y Z
Service Service
CHATTINESS (AND FAN OUT)
~2 Billion Requests per day on Edge Service
Results in ~20 Billion Fan out requests in ~100 MicroServices
1 Request 1 Request
X XAvro
JSON Xml
CHALLENGES - SUMMARY
• Service Discovery
• Operational Overhead (100s of services; DevOps model absolutely required)
• Distributed Systems are inherently Complex
• N/W Latency, Fault Tolerance, Serialization overhead ..
• Service Interface Versioning, Mismatches?
• Testing (Need the entire ecosystem to test)
• Fan out of Requests -> Increases n/w traffic
Best Practices/Tips
Best Practice -> Isolation/Access
• TIP: In AWS, use Security Groups to isolate/restrict access to your MicroServices
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
Best Practice -> Loadbalancers
Choice
1. Central Loadbalancer? (H/W or S/W)
OR
Recommendation Recommendation
Service 1 Service N
Client Loadbalancer
API Gateway
Customer Service
Service 1
Account Service 1 Account Service N
Customer Service
Service N
Recommendation Recommendation
Service 1 Service N
Client based Smart Loadbalancer
• Dependency Calls
• Guard your dependency calls
• Cache your dependency call results
• Consider Batching your dependency calls
• Increase throughput via Async/ReactiveX patterns
Dependency Resiliency
Service Hosed!!
Service Z
Cache
Cache
Cluster
Cluster
Your App/Service
Service Y
Service Z
Fn {A, B, C}
Cache
Cache
Cluster
Cluster
BottleNecks/HotSpots
A/B Test Service
User Account
Service
Tip: Pass data via Headers
A/B Test Service
User Account
Service
reduces dependency
load
TEST RESILIENCY (of Overall MicroServices)
* Benjamin Franklin
three
http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/WhatIsAutoScaling.html
USE CANARY, RED/BLACK PUSHES
• NetflixOSS Asgard helps manage deployments
Service Dependency Visualization
MicroServices at Netflix
SERVICE DEPENDENCY GRAPH
How many dependencies does my service have?
What are the sample HTTP Requests/Responses that had a 500 Error Code in
the last 30 minutes?
SERVICE DEPENDENCY VISUALIZATION
You
s C
t a Metrics
(Servo)
H
r c T
Registration
i h T
P
x e C
l
Eureka (Service Registry)
Eureka
Integration
i
e Fetch Registry
n
A Blocking Architecture
t
Netflix IPC Stack (2.0)
Client (Ribbon 2.0) Server (Karyon)
HTTP
Ribbon Transport Bootstrapping (Governator)
Ribbon UDP
TCP Admin Console
Load
Balancing WebSockets
RxNetty
SSE
Hystrix R Metrics (Servo)
x
N Eureka Integration
Metrics
(Servo)
e
t
Registration
EVCache t
y
Details: http://www.meetup.com/Netflix-Open-Source-Platform/events/184153592/
NetflixOSS
LEVERAGE NETFLIXOSS
http://netflix.github.co
• Eureka – for Service Registry/Discovery
• Karyon – for Server (Reactive or threaded/servlet container based)
• Ribbon – for IPC Client
• And Fault Tolerant Smart LoadBalancer