Profiling and performance
This page is for application creators who make code faster. Measure, change one thing, measure again (Benchmarking, Benchmark reference).
Contents
Measuring pages
php bin/php/console exp:benchmark --save=var/benchmark/base.json --allow-root-user
# change something
php bin/php/console exp:benchmark --baseline=var/benchmark/base.json --threshold=15 --allow-root-user
php bin/php/console exp:benchmark --cold --requests=50 --allow-root-user # past the response cachesIt requests the front page, menu pages, search and the admin login, 100 times each after warm-up, and prints median, p90, p99 and more.
Inside a request
exp:benchmark kernel --repeat=30times boot, render (cold and warm), INI load, a content fetch, a database round trip and cache writes and reads in-process.exp:benchmark microtimes pure-PHP hot paths without HTTP or a database.- The debug bar shows each request's SQL queries, templates and timings (Exp debug bar).
- Under Velocity, the opcode cache profile shows why a page costs what it does (Velocity and the opcode cache).
Comparing fairly
Same machine, nothing else running, OPcache as in production, Xdebug off, and judge two servers only by runs made back to back. Every run records its environment, and a comparison with a baseline made under another setup says so.
The usual causes
| Symptom | Cause | Fix |
|---|---|---|
| Many queries per page | fetches in loops, load_data_map on lists | fetch once, limit, cache block |
| Slow first view after deploy | caches cleared | warm (php bin/php/warm.php) |
| Slow under Velocity after a change | workers not restarted or OPcache not revalidating | exp:velocity deploy |
| Slow publish | heavy work in workflows or listeners | move it to a queue |
| Slow admin lists | unbounded counts | paged queries |
Related pages
- Scaling applications
- Caching in applications
- Performance and caching for websites
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.