Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scalability In a Nutshell

Scalability In a Nutshell

Learn the buzzwords and lingo concerning scalability and what it means to scale up vs. out. This presentation should help put your head in "the cloud" and wet your appetite to learn more about scaling your apps and processes.

This presentation was originally given at the August 2013 meetup of the Seattle PHP User Group. It was updated and given at Desert Code Camp 2016. I recommend you also check out https://12factor.net/ for information complementary to this presentation.


Jeremy Lindblom

August 09, 2013


  1. Scalability! ( In a Nutshell )! By Jeremy Lindblom (@jeremeamia)!

  2. Jeremy Lindblom – @jeremeamia!

  3. Buzzwords! The Cloud! Scalability! IaaS! Big Data! HPC! NoSQL! Caching!

    Data Science! PaaS! Load Balancer! SOA! SaaS! Cluster! Sharding! Queue! APIs! Distributed! Proxy! Containers! DevOps! Microservices! Web Services! Virtualization! CDN!
  4. Scalability! The ability of a system to adapt to an

    increase in demands.! ! Availability! Elasticity! Reliability! !
  5. How many of you have web applications that run entirely

    on a single server?!
  6. I <3 LAMP

  7. What happens when…! •  Your overall traffic greatly increases?! • 

    You have traffic spikes?! •  You run out of disk space?! •  Your hard drive crashes?! •  The power goes out?! •  Your server or data center is damaged?! I <3 LAMP ?
  8. How to Scale! ?!

  9. How to Scale!

  10. How to Scale!

  11. How to Scale! •  Optimize your current system! •  Vertical

    hardware scaling! •  Horizontal hardware scaling!
  12. Optimization Examples! •  Database index/query optimization! •  Update server software

    (e.g. PHP 5 -> PHP 7)! •  Use alternate software (e.g., nginx vs apache)! •  Fine tune Linux/Windows configuration! •  Minify/compress static assets! •  Cache results of intense operations!
  13. Vertical Scalability! •  Disk space! •  Disk Type (e.g., SSD)!

    •  Memory! •  CPU! •  IOPS! •  etc.! ( Scale Up )!
  14. Vertical Scalability! PROS! •  No changes to application code! • 

    No changes to operations processes! CONS! •  Typically requires downtime! •  Doesn’t solve availability issues! •  Have to pay for hardware required by peak time!
  15. Horizontal Scalability! ( Scale Out )!

  16. Horizontal Scalability! PROS! •  Can improve availability! •  Auto-scaling solutions

    can optimize costs! CONS! •  Requires changes to code and operations! •  Complicated!
  17. Horizontal Scaling! Ah ha, there's! your <3 LAMP! setup again!

  18. Horizontal Scaling! Let's give that! database its! own machine! to

    reduce the! load of the server! !
  19. Horizontal Scaling! Multiple application servers! with load balancing!

  20. Horizontal Scaling! Wait!!!! ! Sessions?! File Uploads?! Logs?! Deployment processes?!

    ! So. Many. Questions.! ! /me starts crying.!
  21. Horizontal Scaling! Wait!!!! ! Sessions?! File Uploads?! Logs?! Deployment processes?!

    ! So. Many. Questions.! ! /me starts crying.!
  22. No Silver Bullets!

  23. Tradeoffs! •  Scalability! •  Cost! •  Difficulty! •  Performance! • 

    Regionalization! •  Deadlines! •  Support! •  Etc.!
  24. CAP Theorem! Consistency,! Availability,! Partition tolerance…! ! …Choose 2!

  25. Sessions! •  Databases / Cache! (MySQL, Redis, Memcache, etc.)! • 

    Sticky Sessions (via Load Balancer)! •  Distributed File System (DFS)! •  Encrypted Cookies! •  JWT Tokens!
  26. File Uploads / Storage! •  Cloud Storage (e.g., Amazon S3)!

    •  Distributed File System (DFS)! •  Other Blob Storage!
  27. Logging! •  Log Rotation! •  Centralized Logging! •  Tools! – fluentd!

    – Logstash! – syslog-ng!
  28. Deployments! •  CI: Jenkins, TravisCI, CircleCI! •  Puppet / Chef

    / Salt / Ansible! •  Docker, Kubernetes! •  PaaS-specific offerings! •  Cloud offerings (e.g. CodeDeploy)!
  29. Horizontal Scaling! Anyways… we left off here.! What next?!

  30. Horizontal! Scaling!

  31. So won't this cost me a lot of money to

    get all of that hardware?!
  32. "The Cloud"! Cloud computing! is the use of computing resources

    delivered as a service on an as! needed basis.!
  33. Why Cloud?! 1.  No upfront investment! 2.  Reduce overall IT

    costs (pay as you go)! 3.  Flexible capacity (scaling up and down)! 4.  Speed and agility! 5.  Focus on business, not hardware! 6.  Global reach (Cloud providers have data centers all over the world)!
  34. Note: There are also many other cloud providers. You should

    check those out too.! !
  35. Horizontal! Scaling!

  36. Horizontal! Scaling with! AWS!

  37. Where to Start?! It's a little intimidating isn't it?!

  38. Where to Start? — PaaS! AWS Elastic! Beanstalk! AWS OpsWorks!

  39. Later! •  Content Distribution Networks (CDN)! •  NoSQL (Neo4j, Cassandra,

    etc.)! •  Queues / Notifications / Eventing! •  Microservices! •  Docker + Containerization! •  Data Warehousing + Analytics! •  And much more!
  40. Scalability! ( In a Nutshell )! By Jeremy Lindblom (@jeremeamia)!