High Performance PHP

This course provides an overview of webserver, database, and core PHP optimizations that are essential for creating a fast PHP application. In under two hours, you will learn the keys to building and scaling an app that can support millions of users.
Course info
Rating
(65)
Level
Intermediate
Updated
Mar 29, 2016
Duration
1h 34m
Table of contents
Description
Course info
Rating
(65)
Level
Intermediate
Updated
Mar 29, 2016
Duration
1h 34m
Description

You too can create fast-running PHP apps that support millions of users. This course, High Performance PHP, will teach you tips and tricks for speeding up your PHP application. You'll start by learning about micro-optimizations at the code-level, moving on to how many child processes you should be running on your webserver and database options. Finally, you will learn about profiling your code and load testing your application, so you can be confident that it will perform well no matter how large your application becomes. By the end of this course, you'll be able to easily create and optimize PHP apps for speed.

About the author
About the author

Jonathan is a Director of Engineering at Wayfair, where he helps create the best place to buy anything for your home. Previously he ran engineering at Attend, and before that he was a senior software engineer at Etsy, where he focused on solving web performance and scalability challenges.

More from the author
Composer: Getting Started
Beginner
1h 7m
29 Sep 2016
Section Introduction Transcripts
Section Introduction Transcripts

Database Optimization
Welcome back to High Performance PHP. This module is going to be all about database optimization. We're going to cover a lot of topics in this module. First we're going to briefly go over relational versus non-relational databases, or NoSQL databases as you may have heard them called. Then we are going to talk about the different MySQL forks and which one you may want to use for your app and the tradeoffs inherent in each one. From there we'll dive into MySQL server configuration and look at the critical values you need to set in your my. cnf. Moving forward we'll look at the MySQL slow query log, which will help you identify queries that are taking a long time in your site so you can target them and fix them. Once you've identified these slow queries, you need to optimize them which is why we're going to cover query optimization including indexing. Finally we're going to talk about data denormalization and constraints, and their impacts on performance. MySQL optimization is a huge topic and we don't have a lot of time to cover it. This module will go over everything at a high level and point you at resources where you can learn more. This is such a large topic, in fact, there is an excellent 800+ page book written on it. If you want to dive deep, I highly recommend checking this out, but this module will give you a good overview. Let's get into it.

Performance and Load Testing
Now that we have built and configured an app, it is time to put it in production, throw some load at it, and see how it performs. In this module, we're going to cover load testing with Siege. Siege is a command line tool that's very easy to use and will quickly show you where the bottlenecks in your application are from a scalability perspective. Then we are going to review the options in the APM, or Application Performance Management space. This will give you a good sense of what may work for your app and your budget. Finally, we will talk about how to monitor the performance of your application in production with TraceView, a commercial product that also has a free option.

Investigating Performance Tradeoffs of PHP Frameworks
Now that we've seen all the pieces that go into making a PHP application fast, let's dive into the tradeoffs inherent in choosing a PHP framework. In this module, we're going to discuss performance benchmarks and how they can misrepresent how frameworks are actually going to perform in the wild. We will look at how to measure the performance overhead of frameworks, using XHProf and other tools. We'll talk a bit about the important framework characteristics that you should look for when choosing a framework, and then finally, we will recap the key topics from the course. Framework performance is a hot topic in the PHP community and there are strong opinions on both sides. My intent is to approach this topic from a balanced and objective point of view. Throughout this module, we will be talking about three frameworks, Laravel, the most popular framework in the PHP community, and the one we'll be using throughout this course, Symfony, another popular full-featured PHP framework, and then finally, Slim, a widely used micro framework. Slim differs from Laravel and Symfony in that it tries to do a lot less. It states that, "At its core, Slim is a dispatcher "that receives a request, invokes a callback, "and returns a response. " I think it's important to show that there are options outside of a full-featured, batteries-included framework like Symfony and Laravel, and that's why we're going to talk about Slim as well. Let's dive into benchmarking and the pitfalls that it can lead you into.