scalable service architectures @ vdb16
TRANSCRIPT
Scalable Service Architectures
Lessons learned
Zoltán Németh Sr Engineering Manager, Streaming & PlayerAn IBM company
Founded in 2007, acquired by IBM in 2016
Live streaming and VOD Freemium / Pro / Demand / Align
An IBM company
Streaming flow
Now back to 2009...
Earthquake in Japan
Protests in Ukraine, Egypt, Syria
Asteroid Approach
SpaceX Launch
El Classico
We must scale
Defining scalabilityScalability is the ability to handle increased workload by repeatedly applying a costeffective strategy for extending a system’s capacity.(CMU paper, 2006)
How well a solution to some problem will work when the size of the problem increases. When the size decreases, the solution must fit. (dictionary.com and Theo Schlossnagle, 2006)
Self-contained service
Explicitly declare and isolate dependencies
Isolation from the outside system Static linking Pay attention to GPL
Do not rely on system packages
Disposability Maximize robustness with fast startup and graceful shutdown
Disposable processes Graceful shutdown on
SIGTERM Handling sudden death:
robust queue backend
Backing Services
Treat backing services as attached resources
No distinction between local and third party services
Easily swap out resources
Export services via port binding
Become the backing service for another appDrawing source: 12factor.net
Processes, concurrency
Stateless processes (not even sticky sessions)
Process types by work type
We <3 linux process Container > VM Shared-nothing
adding concurrency is safe
Process distribution spanning machines
Statelessness Store everything in a datastore
Aggregate data Aggregator / map &
reduce CQEngine Chandra
Scalable datastores Handling user sessions
Microservices Self-contained Disposable Stateless Shared-nothing API communication Dependency
management moved to external Be Warned!
Image credits: christofcoetzee.co.za, techblog.netflix.com
Monitoring Metrics collecting Graphite, New Relic
Self-aware applications Cluster state
Zookeeper, Consul Scaling decisions
Capacity amount Graph derivative App requests
Load Balance DNS or API App level balance
Uniform entry point or proxy
Balance decisions Load Zookeeper state Resource policies
Service Separation
Rate limiting Failure is inevitable Circuit Breaker pattern
Stop cascading failure, allow recovery
Fail fast, fail silent Hystrix
Service decoupling Asynchronous
operations
Deployment Automate all the things Chef & VMs Docker Immutable deployment
Docker / Kubernetes / Rancher
Handling tasks before shutdown
Extras Debugging features Log processing:
Logstash, Kibana Clojure / JS consoles Runtime
configuration via env
Scaling API Cloud providers Automatic start /
stop
Reading Scalable Internet Architectures by Theo Schlossnagle The 12-factor App: http://12factor.net/ Carnegie Mellon Paper: http://www.sei.cmu.edu/reports/06tn012.pdf Circuit Breaker: http://martinfowler.com/bliki/CircuitBreaker.html Release It! by Michael T. Nygard Netflix Tech Blog: http://techblog.netflix.com/
Questions?