Scaling PHP7 Applications (The Pro Package)
Minimum price
Suggested price

Scaling PHP7 Applications

5+ years of lessons learnt Scaling PHP to billions of requests per second

About the Book

I'm going to teach you how to scale PHP

Stop playing sysadmin and get back to coding. You didn't sign up to put out fires and figuring out how to scale MySQL isn't exactly going to ship features any faster. You know that learning the intricaces of my.cnf is a waste of time, but you don't have another choice. In the book, you'll get a crash-course on every important tuning option, why it matters, and a quick formula to figure out the perfect settings for your hardware. Bliss.

You've heard alot about Nginx and horizontal scaling, and there're thousands of tutorials out there, but the quality ranges from abysmal to "this must be a joke", and when you finally find a good one, it's usually for Rails. I know what it's like to scramble around, reading bad advice on StackOverflow, copy-and-pasting config files from some message board hope that one of them finally works... pulling at your hair, swearing at the screen.

What if it didn't have to be this way? What if there was a single, high-quality resource of information on scaling PHP, on doing things the right way, that actually focused on PHP and not Rails, Node.js or the flavor of the week? Something that taught you scalable architecture and things you might run into when your only user isn't your mom?

Learn the perfect PHP stack, LHNMPRR

Okay, okay- nothing will ever be as catchy as LAMP ;-)

You'll master a new, more scalable stack called LHNMPRR (Linux, HAProxy, Nginx, MySQL, PHP, Redis, & Resque) that can scale just by throwing more hardware at. You'll be able to finally get your setup to be perfect, all while using a battle tested stack that's been proven to handle billions of requests.

Think of it as your Cheat Code for PHP <?php ↑↑↓↓←→←→BA ?>

You'll also see the exact configurations and technologies that were used and proven at massive scale— 22 billion HTTP requests per month, thousands of MySQL queries per second— basically a metric-truck ton of visitors.

About the Author

Steve Corona
Steve Corona
About the author

I'm Steve Corona and I've spent the last 4 years scaling Twitpic to handle 60m visitors and 20 billion requests per month.

I live in Charleston, SC and blog about life hacking.

On Twitter, I'm @stevencorona.


The Pro Package

The BEST option for individuals or companies just getting started. Includes all of the best material and most of the guides to help you scale your app in the real world.


  • extras
    Prelaunch Checklist
  • extras
    Scaling LAMP doesn't have to suck
  • extras
    Scaling Twitpic
  • extras
    Case Studies
  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price
Just The Book

The basic option is still great! If you only want to learn the fundamentals, if you're on a budget, you won't regret investing in the core 158 page eBook. The book is delivered instantly in PDF, ePub, and Mobi format.

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price
The VC-Funded Package

It's not cheap, but it includes everything, including a 1-on-1 architecture critque by me. Get all of the guides, talks, config templates... basically everything I've ever written about scaling. It's the best material on the planet for scaling a growing startup.


  • extras
    Prelaunch Checklist
  • extras
    Scaling LAMP doesn't have to suck
  • extras
    Scaling Twitpic
  • extras
    Case Studies
  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price

Bundles that include this book

Bought separately
Bundle Price
Bought separately
Bundle Price
Bought separately
Bundle Price

Table of Contents

  • Preface
    • How this book came to be
    • How this book is designed
    • Who should read this book?
    • What you need for this book
    • What you’ll learn
    • Why you need this book
    • Rule Numero Uno
  • Ditching the LAMP Stack
    • What’s wrong with LAMP?
    • The Scalable Stack
  • DNS: Why you need to care
    • DNS Load Distribution
    • DNS Resolution
  • Load Balancing with HAProxy
    • HAProxy
    • Choosing the best hardware
    • Automatic failover with keepalived
    • Tuning linux for a network heavy load
    • Issues at scale
  • App Server: Horizontal Scaling with Nginx and PHP-FPM
    • Choosing the right version of PHP
    • Nginx and PHP-FPM
    • Choosing the best hardware for your application server
    • Using a PHP Opcode cache
    • Tuning Linux for PHP
    • Scaling session handling
  • Database Server: Ultimate MySQL Tuning Guide
    • Getting NoSQL Performance out of MySQL
    • Dealing with libmysql’s inability to set timeouts
    • Tuning your MySQL Configuration
    • Tuning Linux for an intensive database
    • Load balancing MySQL Slaves
    • Accepting the Master as a SPOF
    • Understanding issues with NUMA
    • Choosing the best hardware
    • Online Schema Changes
    • Further Topics
  • Cache Server: Using Redis
    • Choosing between Redis, Memcached, and APC
    • Redis Commands
    • The importance of Atomic Operations
    • Performance Limitations of Redis
    • Installing Redis from Dotdeb
    • Installing the phpredis C extension
    • Tuning Redis for Performance
    • Scaling Redis to Multiple Servers
    • “The Dogpile”
    • Russian Doll Caching
    • Redis Bitmaps
    • Redis Notification Feeds
  • Worker Server: Asynchronous Resque Workers
    • Why use Queues?
    • Getting started with Resque and php-resque
    • Writing a Resque Job
    • Alternatives to Resque
    • Things you should put in a queue
  • Coding and Debugging at Scale
    • Scaling your code
    • Capistrano for code deployment
    • Live Debugging PHP with strace
  • Parting Advice
    • Want to upgrade?
    • Sending Feedback and Testimonials
    • In too deep? Need help ASAP?
    • Updates?
    • About the Author
  • Case Study: Horizontally scaling user uploads
  • Case Study: How DNS took down Twitpic down for 4 hours
  • Case Study: Scaling MySQL Vertically (10 to 3 MySQL Servers w/ SSDs)
  • Case Study: Hot MySQL Backups w/ Percona
    • Moving from mysqldump to Percona XtraBackup
  • Case Study: Async APIs w/ Kestrel saved my butt
  • Case Study: The missing guide to Memcached
    • Choosing Memcached over Redis?
    • Installing Memcached
    • Hooking up PHP to Memcached
    • Protocols
    • Compression and Serialization
    • Server Pools
    • Atomic Counters
    • Avoiding the Rat Race: CAS Tokens
    • Watch out for timeouts
    • Using Memcached for Sessions
    • Debugging Memcached from Telnet
    • My Memcached Setup
    • Further Reading and Tools
  • Case Study: HTTP Caching and the Nginx Fastcgi Cache
    • Caching Static Assets
    • Caching Proxy
  • Case Study: CakePHP Framework Caching
    • CakePHP, you devilish dessert
    • The life and death of a CakePHP request
    • If it smells like a race condition…
    • Busting the assumptions
    • Now what? I’m out of ideas
    • The solution(s)
  • Case Study: Optimizing image handling in PHP
    • The naive “PHP Tutorial” way
    • ImageMagick vs GraphicsMagick
    • Allowing Large File Uploads
    • Stripping EXIF Metadata
    • Autorotation
  • Case Study: Benchmarking and Load Testing Web Services
    • Setting up a Test Environment
    • The famous ab (Apache Benchmark)
    • Siege, a more modern ab
    • Bees with machine guns
    • Sysbench
  • Sponsors

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub