Benchmarking and profiling Drupal
When attempting to create a large change in Drupal core, or even during the course of developing Drupal sites for clients, often you are asked to provide benchmark results to ensure that your change doesn't negatively impact performance (or to see how much it improves performance). This document will talk about the various strategies involved in benchmarking Drupal code.
Tools of the trade
- Apache Bench (ab)
- Apache JMeter
- Other performance testing tools
- xdebug to profile the PHP code itself
This document will discuss the ab tool in depth. Its a free, open source performance testing solution that comes with Apache and therefore is the tool that is most commonly used in the community.
Before benchmarking, you'll need a local development environment. See Getting Involved guide for an overview, Setting up an environment for general tools the community uses, and Contribute to development for tips on how to contribute code more generally.
Other profiling resources
- Profiling a Twig patch for a Drupal core issue (with XHProf) for current recommended approach to doing a performance profile on patches before they go into Drupal 8 core.
- Profiling every page load with devel for Drupal 7.
- XHProf Code Profiler has general xhprof info.