Leanpub Header

Skip to main content

Elephant sized PHP

Scaling your PHP applications

Scaling PHP Applications 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.

Free With Membership

With Membership

Free!

$7.99

You pay

$0.00

Author earns

$0.00
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
117
Readers
About

About

About the Book

Scaling PHP Applications introduces the techniques that are used to run PHP at scale.  This book discusses real world strategies and focuses on the implementation of best practice solutions.

Share this book

Categories

Author

About the Author

Andy Beak

Andy is a cloud software architect working for a leading IPTV tech company in Cambridge, UK. He has 7 years of experience with the PHP language, with more than half of that time being in senior roles.  During his time in the industry Andy has worked on applications for large financial institutions, dynamic startups, payment processors, as well as a slew of smaller web applications.  

Contents

Table of Contents

Introduction

  1. Architecture

Divide and Conquer

  1. N-tier Architecture
  2. Microservices
  3. Sharing sessions
  4. Logging

The fallacies of distributed computing

  1. The network is reliable
  2. Latency is zero
  3. Bandwidth is infinite
  4. Transport cost is zero
  5. The network is secure
  6. Topology doesn’t change
  7. There is one administrator
  8. The network is homogenous

Optimizing your PHP code

  1. Choosing which functions to use
  2. Loops
  3. Generators
  4. Optimize Composer Autoloader

Asynchronous Workers

  1. Queues
  2. Amazon SQS
  3. Autoscaling PHP Workers in AWS Elastic Beanstalk
  4. Other Queue Providers

Context and caching

  1. Layers of caches
  2. Transactions
  3. The problem with context
  4. Practical example
  5. Load balancing between your server and the users device
  6. Cookies and caching
  7. So how can we avoid context?

Control your cache

  1. Versioning resources
  2. The Cache-Control header
  3. Max-age
  4. Setting your origin cache-control header
  5. Don’t forget non-proxied responses

MySQL design optimisation

  1. Choosing Data Types
  2. Schema Design
  3. Indexing
  4. Indexing Strategies

Redis and Memcached

  1. Memcache versus Memcached
  2. What do they do?
  3. Using a cache
  4. Russian Doll caching
  5. Cache warmup scripts

Enemies of scale

  1. Metrics

Profiling Your Code

  1. Commercial application performance monitoring software
  2. Xdebug and Kcachegrind
  3. Strace
  4. PageSpeed
  5. Profiling OpCache

Load-testing tools

  1. Gatling
  2. Siege
  3. LoaderIO

Profiling MySQL

  1. Database Metrics
  2. Benchmarking strategies
  3. Profiling tools
  4. Servers

The Nginx web-server

  1. Configuring Nginx
  2. Nginx as a reverse proxy
  3. Nginx+ and JWT authentication

Tuning PHP

  1. Configuring PHP-FPM
  2. Opcache

Tuning MySQL

  1. Alternatives to MySQL
  2. Different aims of scaling
  3. The process of tuning
  4. MySQL settings
  5. Using the memory storage engine

Cookieless Subdomains

  1. Creating the subdomain
  2. Set up the subdomain in Nginx
  3. Get a free certificate for your subdomain

Content Delivery Networks

  1. CloudFlare
  2. Amazon Cloudfront
  3. Akamai CDN
  4. Using a CDN

Load Balancing

  1. Load Balancing Algorithms
  2. Types of Load Balancing
  3. Synchronising File Systems
  4. Choosing a load balancer

Using Amazon Elasticache

  1. Setting up and configuring
  2. Monitoring
  3. Connecting to ElastiCache
  4. Scaling

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

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

In fact, authors have earned over $14 million writing, 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