Blackfire
Migration vers le protocol Oauth2
Blackfire
Who am I ?
Clément Bertillon
🏆 Certifié Symfony 2, 4, 6
🎉 Certifié Twig
https://twitter.com/BERTILLONClment
https://github.com/skigun
🏆 Certifié AWS
Blackfire
Enjeux
Maîtriser les coûts
Maximiser les revenus
Profiling
Temps
I/O
CPU
Mémoire
Esprit critique
Erreur de mesure
Xdebug
Blackfire
XHProf
tideways
Architecture
Démo time !
Mise en oeuvre
2ème partie
Performance = Feature
Industrialisation ?
Aller plus loin 🎉 KILLER FEATURES 🎉
Profiling CLI scripts
$ 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
Profiling AJAX request
Reminder: Distributed Profiling
Different languages
PHP
GO
Python
Distributed Profiling...
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'
Assertions
# 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
Going further
Scénarios
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 ~ '/'
Builds et intégrations
Notification
Build comparaison
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"
Ce dont je n'ai pas parlé
- Documentation (dynamique 🎉)
- Installation / Docker
- Séries temporelles (timeline)
- SDK Blackfire
- Player
- Configuration SAAS / Pricing
- custom metrics
- Bypass CDN, varnish or loadbalancer
Merci
Blackfire
By skigun
Blackfire
- 334