[...]... 202 Finding Problem Queries 203 Analyzing Problem Queries 204 Recommendations for PHP Database Applications 205 Maintaining Separate Read and Write Connections 206 Using “utf8” (Multi-byte Unicode) Character Set by Default 206 Using “UTC” Date Format 207 Summary 208 ■Appendix A: Installing Apache, MySQL, PHP, and PECL on... 232 ■Index 233 xi ■ INTRODUCTION Chapter 3 – PHP Code Optimization We begin to jump into the PHP code within this chapter You will learn about PHP best coding practices when it comes to performance You will learn about constructing a faster-running for loop, how to include files using the optimal PHP function, and, most importantly, how to use and install VLD, strace, and... you will analyze Opcode, as well as the Apache C-level processes that your PHP script requires to run Using Xdebug on the other, we will identify bottlenecks within the PHP code itself Chapter 4 – Opcode Caching Knowing the PHP life cycle is important to optimizing, so you will learn about the life cycle within this chapter You will learn the steps PHP takes during a user request and identify areas where... within the PHP application can be optimized and is the basis of all subsequent chapters From the front end to the web server, this book will touch on each layer shown in the figure, but we need a tool to measure not only how well our current, unmodified application is performing, but also how well it’s performing once we apply the performance enhancements to it Apache Benchmark, as well as Siege, provides... Installation 215 Installing MySQL 216 Configuring MySQL 219 Installing PHP 222 Getting PHP5 and MySQL to Talk 223 Creating a phpinfo() Script 223 Installing PECL 224 ■Appendix B: Installing Apache, MySQL, PHP, and PECL on Linux 227 Fedora 14 227 Component Versions and Locations 229 Ubuntu... contains a table with Connect, Processing, Waiting, and Total fields These fields tell us how much time the requests took within each of these process statuses We are mostly interested in the Total field and its min and max columns These two columns provide data on the minimum and maximum length of time a request took to respond Let’s now look at the optional flags ab provides us AB Option Flags ab... tag when –w is used -X proxy[:port] Specifies a Proxy server to use Proxy port is optional -y String representing HTML attributes that will be placed inside the tag when –w is used -z String representing HTML attributes that will be placed inside the tag when –w is used 11 CHAPTER 1 ■ BENCHMARKING TECHNIQUES For our goal of optimizing our PHP scripts, we need... pairs separated by & -P username:password Base64 encoded string String contains basic authentication, username, and password separated by “:” -q Hides progress output when performing more than 100 requests -s Uses an https protocol instead of the default http protocol—not recommended -S Hides the median and standard deviation values -t timelimit When specified, the benchmark test will not last longer than... tricks of the trade we can increase its performance and durability and really make it sing In this chapter we will also look at some of the secrets of scaling out to support higher traffic and user loads Chapter 8 - Database Optimization In most web applications, the database server plays a major role In this chapter we will look at optimizing the mysql database server, providing methods and tools that will... affect the perceived speed of your web application The issue is about the total number of routers, servers, and in some cases oceans the request must travel through in order to reach its destination—in this case, your web site The more routers/servers your users must go through, the longer the request will take to reach the web application and the longer the web application s response will take to reach . alt="" Pro PHP Application Performance Tuning PHP Web Projects for Maximum Performance ■ ■ ■ Armando Padilla and Tim Hawkins Pro PHP Application Performance: . Application Performance: Tuning PHP Web Projects for Maximum Performance Copyright © 2010 by Armando Padilla and Tim Hawkins All rights reserved. No part of this work may be reproduced or transmitted. with Our Example Server 201 Tuning InnoDB 202 Finding Problem Queries 203 Analyzing Problem Queries 204 Recommendations for PHP Database Applications 205 Maintaining Separate Read and Write Connections