Learn how to optimize your PHP stack.
And have fun doing it

Learn some new tips and tricks on coding efficient PHP

Is there really a difference between using double "quotes" and single 'quotes'? Elephant Sized PHP has practical examples of how to test variations of your functions so that you can learn how to optimize your code.

The book discusses the leading profiling tools available to help you pick the right tool for the job. Learn how to identify where your application uses memory and where I/O bottlenecks are occurring then solve these problems using the techniques in the book!

Elephant Sized PHP discusses optimizing your PHP environment and runs through the settings that help your code to fly. Find out how to work out how many workers per FPM pool you should have and when you should have more than one pool of FPM workers.

Learn about the scale cube and what this means for how you architect your application. Take advantage of micro-services and asynchronous queues to run your work load in parallel across multiple servers.

Tune up your servers

Learn about load balancing with Varnish and Haproxy and build fault tolerant server clusters. Find out about how to configure Nginx securely and learn how to calculate values for worker processes and other key configuration variables. Walk through setting up a cookieless subdomain to parallize your downloads and reduce network overhead.

Optimize Opcache and learn what the configuration settings are and how to prevent your cache from constantly restarting. Use Memcached and Redis and learn about the Russian Doll caching strategy. Set up a Memcached cluster in the cloud and share session data between the instances in your cluster.

Learn how to set up a network distributed file system with GlusterFS and let your cluster share up to date files. Or mount your S3 bucket into your file system and enjoy 11 9's durability on an arbitrarily large file store.

Lower your hosting bill

Learn how to configure a VM with 1 core and 1 gig of RAM to handle a sustained load of 30 concurrent connections without becoming unavailable or dropping connections. The image below shows the New Relic log of a Laravel application on an AWS t2.micro server being put under Siege with 30 concurrent connections for an hour. It was still able to respond fast enough to pass the Google Pagespeed tool tests while under this load. You don't need an expensive server to run client websites and can save money on your hosting bill.

Use cloud based autoscaling groups to dynamically adjust the number of servers in your cluster and avoid paying for server capacity you're not using. Learn how to lower the load on your database by using cache clusters. Leverage the power of the cloud and save your valuable time instead of endlessly provisioning and configuring new systems. Learn about OSS alternatives to IaaS and roll your own load balancers with Haproxy and Varnish.

Siege graph


What's inside?

Elephant Sized PHP is packed with information and practical examples about running PHP efficiently and at scale. You'll find real examples that have been proven to work in production, be walked through setups, and have key concepts explained to you.

You'll be taught how to calculate values for core configuration options and how to profile your application to see the effects of your tuning.

Where appropriate alternative tools are discussed to help you make sure that you're not hitting every problem with the same tired old hammer. Picking the right tool for the job is just as important as learning to use that tool.


  • Divide and Conquer
  • Tuning your PHP code
  • Asynchronous Workers
  • Optimizing MySQL design
  • Redis and Memcached
  • Enemies of Scale
  • Profiling your code
  • Load testing with Siege
  • Profiling MySQL
  • Configuring Nginx and PHP
  • Tuning MySQL
  • Setting up a cookieless subdomain
  • Content Delivery Networks
  • Load Balancing
  • Using Amazon Elasticache

Elephant Sized PHP - Scaling your PHP application ebook

Elephant Sized PHP (ASIN #B01CWY5UII) introduces the techniques that are used to run PHP at scale. It focuses on providing direct guidance on implementing scaleable solutions to help you plan your application and prepare for growth. This book discusses real world strategies and teaches you how to measure and improve the performance of your PHP applications.

Elephant Sized PHP is available from Leanpub for $12.99 .

Click here to purchase

Every purchase is backed by Leanpub's no questions money back guarantee. If you're not entirely satisfied within 14 days of purchase simply return the book for a full refund. In stock! Order now!

© 2015-2019 Andrew Beak.
Cookie Policy: I collect non-identifying information using Google Analytics for the purpose of managing campaigns. A cookie is placed on your device to support this.