SlideShare a Scribd company logo
Scalable &
Available
Patterns for Success
Derek Collison
     @derekcollison
 dcollison@vmware.com
derek.collison@gmail.com
Special Thanks
        Jonas Bonér
        twitter: @jboner
        http://jonasboner.com/


http://www.slideshare.net/jboner/scalability-
        availability-stability-patterns
Background

• Scalable Apps maintain performance under load
  • More requests, More users, More data
• Available Apps maintain the experience during failures
  • Hardware failures, Network splits/partitioning
• Simple Designs tend to scale better
Background

Good
Performance
is good
Background

Predictable
Performance
is king!
Background


Understand
your data!
Background

Understand
the user
experience!
Background

Measure
everything
(can’t fix what you don’t know)
Background


Don’t be a failure of
 your own success
Background

    Master the
• Good Performance is good
• Predictably Good Performance is king!
    Tradeoffs
• Measure everything (can’t fix what you don’t know)
• Understand app and your data!)
  (For your   your data

• Understand your user experience
• Don’t be a failure of your own success
Master the Tradeoffs


Performance
vs Scalability
Master the Tradeoffs


Latency vs
Throughput
Master the Tradeoffs


Availability vs
Consistency
Lots of ways to skin a cat!
Scalability
 Patterns
Performance
     vs
 Scalability
How do I know if I have a
   performance problem?

If your system is slow for a single
           request/user
How do I know if I have a
   scalability problem?
   If your system is fast for a
single request/user but slow for
           many users
Latency
    vs
Throughput
You should strive for
maximal throughput
          with
acceptable latency
Performance vs Scalability
Response Time




                    Concurrent Requests
Know what to scale!

• CPU or IO Bound?
• Scale up or Scale out?
• Waiting on IO? What? Disk/Net/Other System?
• How many components are used per request?
• Know who and what the slowest will be!
Scalability Patterns
     Behavior
Scalability Patterns:
           Behavior


✓Event-Driven Architectures
✓Load-Balancing
✓Parallel Computing
Event-Driven Architecture


✓Events
✓Messaging
✓Asynchronous
✓Non-blocking
Messaging


✓Publish-Subscribe
✓Queuing
✓Request-Reply
✓Store and Forward
Messaging - Publish Subscribe
            1:N

                       Subscriber


 Publisher   Subject   Subscriber


                       Subscriber
Messaging - Queuing
             1:1

                      Subscriber


 Publisher   Queue    Subscriber

Message #1
                      Subscriber
Messaging - Queuing
             1:1

                      Subscriber


 Publisher   Queue    Subscriber

Message #2
                      Subscriber
Messaging - Queuing
             1:1

                      Subscriber


 Publisher   Queue    Subscriber

Message #3
                      Subscriber
Messaging - Request Reply
          1:1

            Reply     Subscriber


Publisher   Subject   Subscriber


                      Subscriber
Messaging Patterns


✓Addressing, discovery
✓Command and control
✓Load-balancing
✓N-way scalability
Messaging
✓Standards
 ✓ AMQP (wire)
 ✓ JMS (api)

✓Products
 ✓ RabbitMQ
 ✓ ZeroMQ
 ✓ ActiveMQ
 ✓ TIBCO
 ✓ MQSeries
Asynchronous and
          Non-Blocking
✓Don’t wait, go doing something else
✓Never block
✓All callbacks all the time can get messy!
✓Good language/framework support
 ✓functional closures
 ✓co-routines
Load Balancing

✓Multiple endpoints to perform work
✓Can be semantically aware
✓Chainable: DNS, hardware, software
✓Endpoints can be Hardware, VM,
 process, thread, co-routine, fiber, etc.
Load Balancing
            Selection
✓Random
✓Round Robin
✓Weighted
✓Dynamically “aware”
 ✓Least connections
 ✓Least loaded
Load Balancing
         Technologies
✓DNS Round Robin
✓Anycast
✓Reverse Proxies
✓Clustering
✓Hardware Load Balancers
Load Balancing
       Reverse Proxies

✓Nginx
✓HAProxy
✓Apache (mod_proxy)
✓Squid
Parallel Computing

✓Divide and Conquer
✓Worker queues
✓Map Reduce
✓UE = Unit of Execution
 ✓VM, process, thread, co-routine, fiber, callback
Parallel Computing
       Worker Queues

✓Good for offloading tasks
✓Need bounded time check in master
✓Async result processing
✓Fork/Join pattern
Parallel Computing
          MapReduce

✓Used internally at Google
✓Variation of Fork and Join
✓Distributed
✓Originally used for logs processing
Parallel Computing
          MapReduce

✓Google’s MapReduce
✓Hadoop
✓Amazon’s Elastic MapReduce
✓RIAK uses it internally for queries
Scalability Patterns
      State
Scalability Patterns: State


Harder than scaling
    behavior
Scalability Patterns: State

✓Master Record
✓Replication
✓Sharding
✓Caching
✓NoSQL
✓Concurrency
Master Record


✓Normally Relational Databases (RDBMS)
✓NoSQL Databases emerging
✓Can’t lose this data
✓Scaling can be a challenge
Master Record: Scaling

✓Traditonally Scale Up
✓Technology will help here
 ✓SSD (50k-100k IOPs)
 ✓More memory/cores per box
 ✓Faster network connectivity
 ✓Clustering Appliances
Clustering Appliances



64 bit




           Infiniband   SSD
Master Record: Scaling


✓Scaling Reads vs Writes?
✓Scaling Reads with Slaves
 ✓Synchronous (Speed of Light)
 ✓Asynchronous
Master Record: Scaling


How do we scale
    OUT?
Master Record: Replication

✓Synchronous vs Asynchronous
✓Master / Slave Replication
✓Master / Master Replication
✓Tree Replication
✓Buddy Replication
Replication: Master / Slave
Replication: Master / Master
Replication: Tree
Replication: Buddy
Sharding


✓Partitioning state
✓Requests need to know where to go
 ✓Distributed Hash
 ✓Load Balancer
 ✓Messaging
Sharding: Paritioning
Sharding: Replication
Sharding: Over-provision

✓Use N partitions
✓Use Y replicas
✓Use message based requests
✓First back wins
✓Therefore user wins (Google Search)
Master Record: RDBMS


Do we really need an
    RDBMS?
Master Record: RDBMS


Don’t underestimate RDBMS
                or
the ability of a single machine
Master Record: RDBMS



What about alternatives?
NoSQL

✓Key-Value
✓Column Databases
✓Document Databases
✓Graph Databases
✓Datastructure Databases
NoSQL

✓Key-Value: (Memcache, Redis, Riak)
✓Column Databases: (Cassandra, Vertica)
✓Document Databases: (MongoDB, CouchDB)
✓Graph Databases: (Neo4J, AllegroGraph)
✓Datastructure Databases: (Redis, Hazelcast)
NoSQL in the wild

✓Google: Bigtable, Colossus
✓Twitter: Redis
✓Amazon: Dynamo, SimpleDB
✓Yahoo: HBase (Hadoop)
✓Facebook: Cassandra, HBase
Caching

✓Cache early and often
✓Usually biggest bang for the buck
✓Referential Transparency
✓Polyglot APIs coming
✓NoSQL stores
✓Cache invalidation is still hard!
Caching



✓HTTP (HTML, JS, CSS, Images, Media)
✓Key/Value Data
✓Semantic Data structures
HTTP Caching

✓Varnish
✓Squid
✓Pound
✓Nginx
✓Rack-cache
HTTP Caching
              CDN

✓Akamai
✓Limelight
✓Level3
✓Digital Fountain (Qualcomm)
✓aiCache
HTTP Caching
    CDN
HTTP Caching

✓Lives in browsers, proxies, CDNs, apps
✓Hard to control, so do it right!
✓Master page controls other resources
 ✓master page not cached (at least too far)
 ✓read-only resources
 ✓change link in master page
Key/Value Caching


✓Memcache
✓Redis
✓Riak
✓Voldemort
Data Structure Caching
Data Structure Caching



✓Standalone
✓Augment RDBMS
✓In Memory or on Disk
Data Structure Caching


✓Data Types
 ✓Strings, Hashes, Lists, Sets, Sorted Sets
✓Atomic Operations
 ✓Push, pop, ranges, set operations (intersect, union)
Caching Patterns



✓Write Through
✓Write Behind
✓Replicated
✓P2P
Cache Invalidation


✓TTL (Time to Live)
✓Bounded FIFO or LIFO
✓Explicit cache invalidation
✓Explicit non-use of read-only resource
 ✓Harder problem the more master items used
Scalability Key Points

     ✓The problem is not where you think ;)
     ✓Autoscaling is a myth
     ✓Can’t fix what you can’t measure
     ✓Scaling master record writes is hard
     ✓Scaling reads is more tractable
     ✓What is the opex cost of your choices?
Availability
 Patterns
What do you do
when things go
    bad?
Availability Patterns
 Available vs Consistent
Availability Patterns
      Available
We have been here
  before, right?
Yes, we have been
  here before!?
Scalability Patterns
     Behavior
Scalability Patterns:
           Behavior


✓Event-Driven Architectures
✓Load-Balancing
✓Parallel Computing
Scalability Patterns
      State
Scalability Patterns: State

✓Master Record
✓Replication
✓Sharding
✓Caching
✓NoSQL
✓Concurrency
But let’s talk more
 about your data
Availability Patterns
 Available vs Consistent
Brewer’s CAP Theorem
Brewer’s CAP Theorem
You can only pick 2

Consistency
Availability
Partition Tolerance
Centralized Systems

✓If the system is centralized
 ✓no P (network partitions)
✓So you get both:
 ✓Availability
 ✓Consistency
Distributed Systems

✓If the system is distributed
 ✓you will have P! (network partitions)
✓So you get pick one:
 ✓Availability
 ✓Consistency
CAP in reality

✓There is only once choice to make:
✓When there is a network partition,
 which do you sacrifice?
 ✓Availability
 ✓Consistency
BASE
What is BASE?
BASE

Basically
Available
Soft State
Eventually Consistent
Eventually Consistent

✓Great tradeoff for the right kind of data
✓Can’t be used everywhere
✓Works in more places than you think
✓Solved speed of light problem
Availability Patterns
       Failover
Availability Patterns:
            Failover


✓Failover is complex
✓Switch time is critical
✓Failback is equally as complex
Availability Patterns:
      Failover




 Copyright Michael Nygaard
Availability Patterns:
      Failback




            Copyright Michael Nygaard
Availability Patterns:
          Replication


✓Synchronous vs Asynchronous
✓Master / Slave Replication
✓Master / Master Replication
Availability Patterns:
         Redirection


✓DNS
✓Load Balancers
✓Secondary Sites
Availability Key Points

    ✓Always have a dial tone
    ✓Syntactically correct is good
    ✓Semantically correct is better
    ✓Be transparent
Background

  Beating the
• Good Performance is good
• Predictably Good Performance is king!
  dead horse
• Measure everything (can’t fix what you don’t know)
• Understand your data
• Understand your user experience
• Don’t be a failure of your own success
Background

 Understand
• Good Performance is good
• Predictably Good Performance is king!
  your data!
• Measure everything (can’t fix what you don’t know)
• Understand your data
• Understand your user experience
• Don’t be a failure of your own success
Background

 Understand
• Good Performance is good
• Predictably Good Performance is king!
  your user!
• Measure everything (can’t fix what you don’t know)
• Understand your data
• Understand your user experience
• Don’t be a failure of your own success
Background
 Understand
• Good Performance is good

     the
• Predictably Good Performance is king!
• Measure everything (can’t fix what you don’t know)
 experience!
• Understand your data
• Understand your user experience
• Don’t be a failure of your own success
Background

    Master the
• Good Performance is good
• Predictably Good Performance is king!
    Tradeoffs
• Measure everything (can’t fix what you don’t know)
• Understand app and your data!)
  (For your   your data

• Understand your user experience
• Don’t be a failure of your own success
Thank You
Thank You
Questions?
Derek Collison
     @derekcollison
 dcollison@vmware.com
derek.collison@gmail.com

More Related Content

PPTX
Kubernetes PPT.pptx
PPTX
Kafka 101
PDF
Getting Started with Apache Spark on Kubernetes
PDF
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
PDF
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
PDF
Designing a complete ci cd pipeline using argo events, workflow and cd products
PDF
Opentracing jaeger
PDF
Kubernetes Networking
Kubernetes PPT.pptx
Kafka 101
Getting Started with Apache Spark on Kubernetes
0-60: Tesla's Streaming Data Platform ( Jesse Yates, Tesla) Kafka Summit SF 2019
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
Designing a complete ci cd pipeline using argo events, workflow and cd products
Opentracing jaeger
Kubernetes Networking

What's hot (20)

PDF
Apache Airflow
PDF
Kappa vs Lambda Architectures and Technology Comparison
PPTX
Monitoring on Kubernetes using prometheus
PDF
High Concurrency Architecture and Laravel Performance Tuning
PDF
Serverless Kafka on AWS as Part of a Cloud-native Data Lake Architecture
PPTX
Spark streaming
PPTX
AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3
PDF
Apache kafka performance(latency)_benchmark_v0.3
PDF
How I learned to time travel, or, data pipelining and scheduling with Airflow
PPTX
KONG-APIGateway.pptx
PPTX
Apache Kafka 0.8 basic training - Verisign
PDF
From airflow to google cloud composer
PPTX
OpenTelemetry For Operators
PDF
Apache Kafka Fundamentals for Architects, Admins and Developers
PDF
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
PPTX
Azure dev ops
PPTX
Apache Beam: A unified model for batch and stream processing data
PDF
Monitoring Kubernetes with Prometheus
PDF
Improve Monitoring and Observability for Kubernetes with OSS tools
PPTX
Autoscaling in Kubernetes
Apache Airflow
Kappa vs Lambda Architectures and Technology Comparison
Monitoring on Kubernetes using prometheus
High Concurrency Architecture and Laravel Performance Tuning
Serverless Kafka on AWS as Part of a Cloud-native Data Lake Architecture
Spark streaming
AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3
Apache kafka performance(latency)_benchmark_v0.3
How I learned to time travel, or, data pipelining and scheduling with Airflow
KONG-APIGateway.pptx
Apache Kafka 0.8 basic training - Verisign
From airflow to google cloud composer
OpenTelemetry For Operators
Apache Kafka Fundamentals for Architects, Admins and Developers
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
Azure dev ops
Apache Beam: A unified model for batch and stream processing data
Monitoring Kubernetes with Prometheus
Improve Monitoring and Observability for Kubernetes with OSS tools
Autoscaling in Kubernetes
Ad

Similar to Scalable and Available, Patterns for Success (20)

PPTX
Scaling Systems: Architectures that grow
PDF
Scalability, Availability & Stability Patterns
PDF
Event Driven-Architecture from a Scalability perspective
KEY
Event Driven Architecture
PPTX
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
PDF
Scalable Architecture on Amazon AWS Cloud - Indicthreads cloud computing conf...
PPTX
System Design & Scalability
PPTX
Azure architecture design patterns - proven solutions to common challenges
PPTX
Patterns of Distributed Application Design
PDF
Scalability broad strokes
PDF
Azure and cloud design patterns
PPTX
Introduction to Microservices Patterns
PPTX
Introduction to Microservices Patterns
PDF
Scalability Design Principles - Internal Session
PDF
Scalability designprinciples-v2-130718023602-phpapp02 (1)
PPTX
designing distributed scalable and reliable systems
PDF
Patterns of Distributed Application Design
PDF
Scale from zero to millions of users.pdf
PDF
Tech Winter Break @gdgkiit | System Design Essentials
PDF
Architecting for the cloud scability-availability
Scaling Systems: Architectures that grow
Scalability, Availability & Stability Patterns
Event Driven-Architecture from a Scalability perspective
Event Driven Architecture
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Scalable Architecture on Amazon AWS Cloud - Indicthreads cloud computing conf...
System Design & Scalability
Azure architecture design patterns - proven solutions to common challenges
Patterns of Distributed Application Design
Scalability broad strokes
Azure and cloud design patterns
Introduction to Microservices Patterns
Introduction to Microservices Patterns
Scalability Design Principles - Internal Session
Scalability designprinciples-v2-130718023602-phpapp02 (1)
designing distributed scalable and reliable systems
Patterns of Distributed Application Design
Scale from zero to millions of users.pdf
Tech Winter Break @gdgkiit | System Design Essentials
Architecting for the cloud scability-availability
Ad

More from Derek Collison (10)

PDF
NATS - A new nervous system for distributed cloud platforms
PDF
GoSF Summerfest - Why Go at Apcera
PDF
What's beyond Virtualization - The Future of Cloud Platforms
PDF
High Performance Systems in Go - GopherCon 2014
PDF
Apcera Case Study: The selection of the Go language
PDF
Distributed Design and Architecture of Cloud Foundry
PDF
Cloud Foundry: Inside the Machine
PDF
RubyWorld 2011
PDF
OSCON 2011
PDF
Ruby conf2010 OpenPaaS
NATS - A new nervous system for distributed cloud platforms
GoSF Summerfest - Why Go at Apcera
What's beyond Virtualization - The Future of Cloud Platforms
High Performance Systems in Go - GopherCon 2014
Apcera Case Study: The selection of the Go language
Distributed Design and Architecture of Cloud Foundry
Cloud Foundry: Inside the Machine
RubyWorld 2011
OSCON 2011
Ruby conf2010 OpenPaaS

Recently uploaded (20)

PPTX
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
PPTX
just letters randomized coz i need to up
DOCX
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
PDF
A New Kind of Director for a New Kind of World Why Enzo Zelocchi Matters More...
PPTX
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
PPTX
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
PDF
Ct.pdffffffffffffffffffffffffffffffffffff
PDF
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
PDF
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
PPT
business model and some other things that
PPTX
providenetworksystemadministration.pptxhnnhgcbdjckk
PDF
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
PPTX
genderandsexuality.pptxjjjjjjjjjjjjjjjjjjjj
PDF
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
PDF
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
DOC
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
PDF
What is Rotoscoping Best Software for Rotoscoping in 2025.pdf
PPTX
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
PPTX
Other Dance Forms - G10 MAPEH Reporting.pptx
PDF
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
just letters randomized coz i need to up
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
A New Kind of Director for a New Kind of World Why Enzo Zelocchi Matters More...
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
Ct.pdffffffffffffffffffffffffffffffffffff
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
business model and some other things that
providenetworksystemadministration.pptxhnnhgcbdjckk
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
genderandsexuality.pptxjjjjjjjjjjjjjjjjjjjj
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
What is Rotoscoping Best Software for Rotoscoping in 2025.pdf
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
Other Dance Forms - G10 MAPEH Reporting.pptx
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...

Scalable and Available, Patterns for Success