Instrumenting your Application for MySQL and Memcached

LAMP, Performance Tuning and Benchmarking, PHP and MySQL
Location: Ballroom D Level: Intermediate
Average rating: ****.
(4.80, 5 ratings)

The best way to understand your application’s performance is to have good instrumentation in your application. This session will teach you how to instrument your application’s usage of MySQL and Memcached. This will enable you to measure where bottlenecks come from, which is always the first step. Next, you’ll see how to analyze the data you’ve gathered, so you can understand what performance optimizations are most important. We will focus on a PHP application using MySQL and Memcached to provide real-life examples, but the approaches presented in this application are generally applicable.

Photo of Peter Zaitsev

Peter Zaitsev

Percona LLC

Peter helped many companies ranging from one man startups to Fortune 500 companies with their Performance and Scaling problems on various stages starting from architecture design and down to queries and schema optimization.

Over cause of the years Peter has spoken on many International conferences focused on MySQL, Open Source, Databases or High Performance Web applications.

Before co-founding Percona Peter worked for MySQL AB as head of High Performance Group being involved in Support, Consulting, Development and working with vendors helping to optimize their software or hardware to perform well with MySQL.

Peter also was involved in number of Web Startups in the roles ranging from CTO to Consultant and has a lot of experience in MySQL and Web Applications Operations, Deployment, Quality Assurance and Development.

Comments on this page are now closed.


Picture of Justin Swanhart
Justin Swanhart
05/11/2010 10:45am PDT
Picture of Justin Swanhart
Justin Swanhart
05/11/2010 10:37am PDT

Hi Vincent,

Thanks for the feedback. I thought that MySQL had fixed the problem with comments causing query cache invalidation, but this does not appear to be the case.

Vincent Olivieri
05/06/2010 3:45am PDT

Great session! We’ve implemented the performance counters and query instrumentation from the sample code. THANKS!

ONE CAUTION: instrumentQuery() adds a comment before the “SELECT” keyword and also adds the unique RequestID. Both of these prevent the query from triggering a hit in the mysql query cache. I had to remove the RequestID and move the comment to the end of the query like this… “SELECT … FROM MyTable /* File myphp.php Line: 323… */”

Picture of Justin Swanhart
Justin Swanhart
04/16/2010 5:15am PDT

You can find the example Instrumentation class, the replacement MySQL interfaces and other materials here:

  • Oracle
  • Monty Program
  • Calpont
  • Facebook
  • Gear6
  • Infobright, Inc
  • JasperSoft
  • Joyent
  • Kickfire
  • NorthScale, Inc.
  • Percona
  • Schooner Information Technology
  • Solid Quality Mentors (SolidQ)
  • Intel
  • Pentaho
  • Linux Pro Magazine

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Yvonne Romaine at

Download the O'Reilly MySQL Conference & Expo Sponsor/ Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@

Press and Media

For media-related inquiries, contact Maureen Jennings at

O'Reilly MySQL Conference Newsletter

To stay abreast of conference news and to receive email notification when registration opens, please sign up for the O'Reilly MySQL Conference newsletter (login required).

Contact Us

View a complete list of O'Reilly MySQL Conference contacts.