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

PDF
Grafana Loki: like Prometheus, but for Logs
PDF
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
PDF
Node.js API 서버 성능 개선기
PDF
Little Big Data #1. 바닥부터 시작하는 데이터 인프라
PDF
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
PPTX
Stability Patterns for Microservices
PDF
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
PPTX
Introduction To Terraform
Grafana Loki: like Prometheus, but for Logs
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Node.js API 서버 성능 개선기
Little Big Data #1. 바닥부터 시작하는 데이터 인프라
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
Stability Patterns for Microservices
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
Introduction To Terraform

What's hot (20)

PPTX
Prometheus and Grafana
PPTX
Building a Virtual Data Lake with Apache Arrow
PPTX
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
PDF
Monitoring Kubernetes with Prometheus
PDF
InfluxDB & Grafana
PPTX
Aws multi-region High Availability
PDF
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
PDF
Big Query Basics
PPTX
How One Company Offloaded Data Warehouse ETL To Hadoop and Saved $30 Million
PDF
Observability
PPTX
Flink Forward Berlin 2017: Dongwon Kim - Predictive Maintenance with Apache F...
PPTX
로그 기깔나게 잘 디자인하는 법
PPTX
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
PDF
Introduction to Stream Processing
PPTX
Simplifying And Accelerating Data Access for Python With Dremio and Apache Arrow
PDF
SOA, Microservices and Event Driven Architecture
PDF
The never-ending REST API design debate
PDF
[215] Druid로 쉽고 빠르게 데이터 분석하기
PDF
The basics of fluentd
ODP
Stream processing using Kafka
Prometheus and Grafana
Building a Virtual Data Lake with Apache Arrow
Building Event Driven Architectures with Kafka and Cloud Events (Dan Rosanova...
Monitoring Kubernetes with Prometheus
InfluxDB & Grafana
Aws multi-region High Availability
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
Big Query Basics
How One Company Offloaded Data Warehouse ETL To Hadoop and Saved $30 Million
Observability
Flink Forward Berlin 2017: Dongwon Kim - Predictive Maintenance with Apache F...
로그 기깔나게 잘 디자인하는 법
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Introduction to Stream Processing
Simplifying And Accelerating Data Access for Python With Dremio and Apache Arrow
SOA, Microservices and Event Driven Architecture
The never-ending REST API design debate
[215] Druid로 쉽고 빠르게 데이터 분석하기
The basics of fluentd
Stream processing using Kafka
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 designprinciples-v2-130718023602-phpapp02 (1)
PDF
Scalability Design Principles - Internal Session
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 designprinciples-v2-130718023602-phpapp02 (1)
Scalability Design Principles - Internal Session
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)

PPT
Intro to sheeeeeshshshshshshMicroscopes.ppt
PDF
Between Fiction and Fire, Enzo Zelocchi’s Cinema Emerges as a Testament to Wh...
DOCX
ULoversDoll Reflects on the Progress of Robot Sex Doll
PPTX
Why Free Online Images Are Changing Digital Creativity.pptx
PDF
Crimson animation project storyboard art
PDF
Ordinary_Member_2022-23 of the coating indus
PPTX
Stock Images vs. Custom Photos What Works Best.pptx
PPTX
Agriculture and Fishery Arts.powerpointtx
PPTX
Land_Soil_Water_Natural_Vegetation_Class8.pptx
PPTX
Unlocking Imagination with a Free Online Picture Gallery.pptx
PPTX
Verizon Tipsyvjjghhhhgugyygyhgyhyugghgugfyg
PPTX
Badminton Sports Center Infographics by Slidesgo.pptx
PDF
Elevating Brand Relevance in the U.S Creator Economy.pdf
PPTX
Logic Quiz for adults and kids. play with anyone you like
PDF
How to Use Artificial Intelligence to Personalize Your DJ Sets Like a Pro
PPTX
debatology of orange IN A VERY PINK TREE OF LANED
PPTX
he Economics of BSB and Their Legacies x
PDF
The Script Masters: How TV Writers Turn Ideas into Must-Watch Shows
PPTX
ppasue.pptxppasue.pptxppasue.pptxppasue.pptx
PPTX
1756067323746-Coca Cola-bcfc-deckxszx.pptx
Intro to sheeeeeshshshshshshMicroscopes.ppt
Between Fiction and Fire, Enzo Zelocchi’s Cinema Emerges as a Testament to Wh...
ULoversDoll Reflects on the Progress of Robot Sex Doll
Why Free Online Images Are Changing Digital Creativity.pptx
Crimson animation project storyboard art
Ordinary_Member_2022-23 of the coating indus
Stock Images vs. Custom Photos What Works Best.pptx
Agriculture and Fishery Arts.powerpointtx
Land_Soil_Water_Natural_Vegetation_Class8.pptx
Unlocking Imagination with a Free Online Picture Gallery.pptx
Verizon Tipsyvjjghhhhgugyygyhgyhyugghgugfyg
Badminton Sports Center Infographics by Slidesgo.pptx
Elevating Brand Relevance in the U.S Creator Economy.pdf
Logic Quiz for adults and kids. play with anyone you like
How to Use Artificial Intelligence to Personalize Your DJ Sets Like a Pro
debatology of orange IN A VERY PINK TREE OF LANED
he Economics of BSB and Their Legacies x
The Script Masters: How TV Writers Turn Ideas into Must-Watch Shows
ppasue.pptxppasue.pptxppasue.pptxppasue.pptx
1756067323746-Coca Cola-bcfc-deckxszx.pptx

Scalable and Available, Patterns for Success