[...]...■ CONTENTS Mysqltuner.pl: Tuning Your Database Server’s Memory 19 7 Possible Issues with Our Example Server 2 01 Tuning InnoDB 202 Finding Problem Queries 203 Analyzing Problem Queries 204 Recommendations for PHP Database Applications 205 Maintaining Separate Read and Write Connections ... MySQL, PHP, and PECL on Linux 227 Fedora 14 227 Component Versions and Locations 229 Ubuntu 10 .10 230 Component Versions and Locations 2 31 Tasksel 2 31 PECL 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. .. 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... important items for us and the items that will let us know how well we are doing while optimizing our code throughout the book Referring back to Figure 1 4, the data is broken into four major sections, shown in Figure 1 5 7 CHAPTER 1 ■ BENCHMARKING TECHNIQUES Server Information Document Information Connection Information Connection Metrics Breakdown Figure 1 5 Sections of an ab result Server Information... 206 Using “UTC” Date Format 207 Summary 208 ■Appendix A: Installing Apache, MySQL, PHP, and PECL on Windows 209 Installing Apache 209 Post–Apache Installation 215 Installing MySQL 216 Configuring MySQL 219 Installing PHP 222 Getting PHP5 and MySQL to Talk 223 Creating a phpinfo() Script ... Information The Connection Information section contains the bulk of the information It answers questions such as, “How long did a request take to receive a response?”, “How much data was returned?”, and most importantly, “How many users can the web server support when processing the document?” Table 1 2 provides a complete list and description of data for this section For now, let’s focus on the highlighted... a group of web server benchmarking tools that provide statistics on how well a web server responds during varied simulated user requests They allow us to simulate any arbitrary number of users requesting a specific web document on a web server and, most importantly, allow us to simulate a simultaneous visit by any number of users (concurrent requests) to a hosted document on a web server For example,... server For example, each tool provides information about the following: • Total time a single request took to respond • Total response size from the server • Total number of requests a web server can handle per second What these tools do not do is test functionality These tools only test requests for a single web document running on a specific web server ab and siege were chosen for the following reasons:... the performance of your application 3 CHAPTER 1 ■ BENCHMARKING TECHNIQUES ab also allows you to run many different load simulations, such as the following: • Simultaneous requests to a web document • Requests over a specific amount of time • Requests with Keep-Alive turned on Most importantly, Apache Benchmark works independently of the Apache web server, allowing you to run ab while having the web. .. source and install The complete list of installation commands is shown in Table 1 1 Table 1 1 Installing Apache Web Server Using Repository Repository Command yum yum install apache2 ports sudo port install apache2 apt-get apt-get install apache2 Mac users can use MacPorts and execute the ports-based command shown in Table 1 1 within a terminal Windows Installation Windows users can open a browser and . Pro PHP Application Performance Tuning PHP Web Projects for Maximum Performance ■ ■ ■ Armando Padilla and Tim Hawkins Pro PHP Application Performance: Tuning. Caching 10 9 Application Performance Roadmap 10 9 The Value of Implementing Variable Caching 11 0 A Sample Project: Creating the Table 11 2 Fetching the Records 11 4 Calculating a Database Fetch 11 5 APC. Tuning PHP Web Projects for Maximum Performance Copyright © 2 010 by Armando Padilla and Tim Hawkins All rights reserved. No part of this work may be reproduced or transmitted in any form or