Learn to build scalable PHP apps


You're not exactly the next Facebook, but you're big enough, and it costs real money when your site goes down in the middle of the night.

Packed with 218 pages and 80+ config files to scale your existing site.

Scale PHP 5.6 (and 7), nginx, haproxy, MySQL 5.6, Redis, and Memcache to 10K req/second

Everything I've ever learned about scaling PHP—

I slept infront of my laptop for a year while scaling Twitpic, rolling over to restart Apache at 2am before drifting back to sleep, but when you're a startup- you do what you have to do.

What if your didn't have any single points of failure? Imagine if scaling wasn't frustrating and you could get back to what you do best- shipping code?


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.

Apache is crying itself to sleep everynight

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.

Testimonials

I bought the beta version of the book and it was already worth far more than the modest price.

Leon Atkinson
CEO, Winkpass Creations

It's an important book, you'd have to spend alot of time compiling it and testing it and learning what breaks at scale.

Willie Jackson
Director of Web Optimization, W3Edge

It's a damn good read, very useful for my new job. Setting up Nginx to play nice with PHP-FPM now.

Phil Sturgeon
PHP Contributor

Table of Contents


1. Ditching the LAMP Stack

  1. What's wrong with LAMP?
  2. The Scalable LHNMPRR Stack

2. DNS: Why you need to care

  1. DNS Load Distribution
  2. DNS Resolution

3. Load Balancing with HAProxy

  1. HAProxy Basics
  2. Configuring HAProxy
  3. Choosing the best hardware
  4. Automatic failover with keepalived
  5. Tuning linux for network heavy workload
  6. Issues at scale

4. Scaling Nginx and PHP-FPM

  1. Choosing the right version of PHP
  2. Nginx and PHP-FPM
  3. Choosing the best hardware for your application server
  4. Using a PHP Opcode cache
  5. Tuning Linux for PHP
  6. Scaling session handling

5. MySQL Tuning+Scaling Guide

  1. NoSQL Performance from MySQL
  2. Timeouts and libmysql (or how to go down for 12 hours)
  3. Tuning your MySQL Config (my.cnf)
  4. Tuning Linux for an intensive database
  5. Load Balancing MySQL Slaves
  6. Accepting master as a SPOF
  7. Understanding issues with NUMA
  8. Choosing the best hardware
  9. Online schema changes

6. Cache Server: Using Redis

  1. Redis, Memcached or APC?
  2. Redis Commands
  3. The importance of Atomic Operations
  4. Performance limitations
  5. Installing Redis from Dotdeb
  6. Installing the phpredis C extension
  7. Tuning Redis for Performance
  8. Scaling Redis to Multiple Servers
  9. Avoiding the Dogpile
  10. Russian Doll Caching
  11. Redis Bitmaps
  12. Redis Notification Feeds

7. Workers: Async Resque Workers

  1. Why use a background queue?
  2. Getting started w/ Resque and php-resque
  3. Writing a Resque Job
  4. Alternatives to Resque
  5. Things you should put in queue

8. Coding and Debugging at Scale

  1. Scaling your code
  2. Capistrano Deployment
  3. Live debugging PHP with strace

About the Author

Hey! I'm Steve Corona. I spent 5 years scaling Twitpic to handle 60 million users and 20 billion HTTP requests per month.

In the early days of Twitpic, I slept with my laptop so I could wake up and restart Apache when it crashed in the middle of the night. I had no idea what I was doing— the thing about scaling is.. you don't get to learn it until you need it. It's trial by fire.

I'm in the middle of writing "nginx: A Practical Guide to High Performance" for O'Reilly. It'll be out around September, and I'm super excited!

I live in San Francisco, CA. Follow me on Twitter (@stevencorona)

The Complete Package

This package includes everything, including 60 pages of bonus guides. It's the best material on the planet for scaling a growing startup.

Scaling PHP Book

With all the great content here it might be easy to forget the book. This is the core of the entire product and is insanely valuable. You'll get the 158 page book in PDF, ePub, and Mobi format.

Config Templates

A collection of 80+ of configuration templates from the book to use as a starting point (HAProxy, Nginx, PHP, and MySQL)

Architecture Critique

Send me the details of your stack and architecture and I'll critique your scalability and single points of failure.

"Scaling LAMP doesn't have to suck"

Get a professional recording of a talk I gave about Scaling PHP, Scaling LAMP doesn't have to suck. Includes new topics, like using NSQ for queuing.

9 Bonus Guides

  • The Missing Guide to Memcache
  • Scaling MySQL Hot Backups
  • HTTP & FastCGI Caching w/ Nginx
  • Optimizing image handling in PHP
  • DNS, your Single Point of Failure
  • Async APIs w/ Kestrel saved my butt
  • CakePHP/MVC Framework Caching
  • Benchmarking & Load Testing
  • Horizontally scaling PHP File Uploads
$59 Buy Now

The Basic Package

The middle-of-the-road option— includes everything you need to scale a new startup.

Scaling PHP Applications

With all the great content here it might be easy to forget the book. This is the core of the entire product and is insanely valuable. You'll get the 158 page book in PDF, ePub, and Mobi format.

Config Templates

A collection of 80+ of configuration templates from the book to use as a starting point (HAProxy, Nginx, PHP, and MySQL)

"Scaling LAMP doesn't have to suck"

Get a professional recording of a talk I gave about Scaling PHP, Scaling LAMP doesn't have to suck. Includes new topics, like using NSQ for queuing.

3 Bonus Guides

  • The Missing Guide to Memcache
  • Scaling MySQL Hot Backups
  • Benchmarking & Load Testing
$39 Buy Now

Just The Book

The basic option is still great!

I spent most of time writing the book— the extra guides, videos, and architecture critique are great but most of the value is in the core 9 chapters. If you 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.

Get a free chapter from the book


The first chapter is on me— I'll send you a real-life chapter from the book.

Backed by my Unconditional, No Risk, 100% Happiness Guarentee

You can get a 100% refund, no questions asked, forever. It's as simple as this— if you're not happy, I don't deserve your money. I've sold over 5000 copies and only 7 people have asked for a refund.

Package Comparison

Just The Book

  1. 158 Page PDF/ePub/Mobi
  2. Free Updates for Life
Get it now for $39

The Basic Package

  1. 158 Page PDF/ePub/Mobi
  2. Config Templates
  3. Free Updates for Life
  4. Config Templates
  5. Scaling LAMP doesn't have to suck

Bonus Guides

  1. The Missing Guide to Memcache
  2. Scaling MySQL Hot Backups
  3. Benchmarking & Load Testing
Get it now for $59

The Complete Package

  1. 158 Page PDF/ePub/Mobi
  2. Config Templates
  3. Free Updates for Life
  4. Config Templates
  5. Scaling LAMP doesn't have to suck

Architecture Critque

Send me the details of your stack and architecture and I'll critique your scalability and single points of failure.

Bonus Guides

  1. The Missing Guide to Memcache
  2. Scaling MySQL Hot Backups
  3. HTTP & FastCGI Caching w/ Nginx
  4. Optimizing image handling in PHP
  5. DNS, your Single Point of Failure
  6. Async APIs w/ Kestrel saved my butt
  7. CakePHP/MVC Framework Caching
  8. Benchmarking & Load Testing
  9. Horizontally scaling PHP File Uploads
Get it now for $249

Questions?

Can I upgrade later?

Yes, the last page of the book contains links to upgrade to the basic and complete packages.

What format does the book come in?

The book comes in ePub, PDF, and Mobi format. It works great with eReaders like the iPad and Kindle, or read it on your desktop.

What if I hate it?

I've sold over 2,000 copies and only 3 people have asked for a refund. The odds are high that you'll love it, but just in case, you have 60 days to get a full refund.

Is the book ready for PHP 7?

Absolutely. While the book is targeted at all of the modern versions of PHP, it specifically focused for people using PHP 5.6 and 7. It also includes hard-to-find information about the Zend Opcache and APC changes.

Is it suitable for beginners?

Yup, but you should already know PHP and some Linux basics. I try hard to guide you through the server stuff, but you'll need to know how to login to a server with SSH and run apt-get.

Can I still use MySQL?

Duh! I do touch a little bit on NoSQL, but I'm a huge fan of MySQL and show you how to scale it to make it faster and more redundant.

Still not ready to buy?


It's your choice, you can spend 2 years learning this stuff on your own instead. If you're still not convinced, let me send you a free chapter from the book— no obligation.