Clément Bertillon
🏆 Certifié Symfony 2, 4, 6
🎉 Certifié Twig
https://twitter.com/BERTILLONClment
https://github.com/skigun
🏆 Certifié AWS
XHProf
tideways
$ blackfire run php my-script.php
$ blackfire run php my-script.php --your-script-options and arguments
$ blackfire --samples 10 run php my-script.php
$ blackfire run php bin/console app:import-products
Share profile
import-products.py
blackfire-python python import-products.py
PHP app
HTTP
CLI
Go app (CLI)
HTTP
Pyhton app (HTTP)
blackfire run sh -c 'wget --header="X-Blackfire-Query: $BLACKFIRE_QUERY" \
http://example.com/ > /dev/null'
# blackfire.yaml
tests:
'All pages are fast':
path: '/.*'
assertions:
- 'main.wall_time < 50ms'
- 'main.peak_memory < 10mb'
- 'main.network_out < 10kb'
'Not too many SQL queries on the homepage':
path: '/(en|fr)/blog/'
assertions:
- 'metrics.sql.queries.count < 5'
- count
- wall_time
- cpu_time
- memory
- peak_memory
- network_in
- network_out
- io
Métriques
scenarios: |
#!blackfire-player
scenario
name 'Visitor'
visit url('/pricing')
name 'Pricing page'
visit url('/docs/introduction')
name 'Documentation'
scenario
name 'Authentication'
set user_login "my_login"
set user_password "my_password"
visit url('/login')
name 'Login page'
submit button('Log in')
name 'Submit log in form'
param _username user_login
param _password user_password
follow
name 'Login redirection'
expect current_url() == endpoint ~ '/'
expect body() matches '/Welcome ' ~ user_login ~ '/'
tests:
"Pages should not become slower":
path: "/.*"
assertions:
# time does not increase by more than 10%
- "percent(main.wall_time) < 10%"
# less than 2 additional SQL statements
- "diff(metrics.sql.queries.count) < 2"