SlideShare a Scribd company logo
A new tool for measuring
performance in Drupal 8
Luca Lusso
Luca Lusso
• Senior Drupal Developer @ Wellnet - Italy
• Acquia developer and backend developer certification
• Twitter: @lussoluca
• drupal.org/IRC: lussoluca
• Not so fluent in english… sorry
Symfony has a great
profiler tool
symfony.com/doc/current/cookbook/profiler
Symfony profiler
• Performance monitoring
• Huge amount of high-level data about application’s
internals (database query, rendered forms, errors, http
request and response headers, routing, events, services,
…)
• Useful in functional testing (more on this later)
Drupal 8 is built on Symfony so… we have the
profiler too?!
Nope…
But wait… the Symfony profiler classes are declared in
the HttpKernel component, here:
core/vendor/symfony/http-kernel/Symfony/
Component/HttpKernel/Profiler
And the HttpKernel IS in Drupal 8, so what is missing?
Glue code is in
FrameworkBundle
and
WebProfilerBundle
But Symfony bundles doesn't works in Drupal 8 :-(
Two options:
1. make Symfony bundles works in Drupal 8
(www.drupal.org/node/1880196 -> won't fix)
2. move the bundle code to a Drupal module
We choose the Drupal way™
Drupal Webprofiler
Module
www.drupal.org/project/webprofiler

github.com/lussoluca/webprofiler
Implemented DataCollectors
PHP Config
Request
Timeline
Frontend
Database
User
Views
Block
Http
Extensions
Events
State
Config
Assets
Cache
Routing
Service
Forms
Every widget shows data about a metric measured
by a data collector on the current rendered page
How does it work
Instrumented
(collect data and
store profile)
Request Response
<div id="webprofilerefa2f1"></div>
<script>
Webprofiler = (function () {
[…]
}
</script>
Response
• Add HTTP header -> X-Debug-Token: efa2f1
• Inject some javascript in the page:
How does it work
Profiling turned off
Ajax Request Response
/profiler/efa2f1
Returns only the
toolbar DOM (with
embedded
javascript, css and
icons)
Integration with XHProf/UProfiler
Drupal 8 version of XHProf module is compatibile with
Webprofiler (www.drupal.org/project/xhprof)
admin/config/development/profiler/configureadmin/config/development/xhprof
Demo
What you can measure, you can optimize
Integration with Drupal Console project
• Leverages the Symfony Console Component to provide a
powerful CLI
• Started as scaffolding generator now expose an
increasing number of commands to interact with a Drupal
8 installation
• Modules can contribute implementing new commands
drupalconsole.com
Implemented commands
• webprofiler:list -> list stored profiles
• webprofiler:export -> export stored profiles
• webprofiler:benchmark -> benchmark an URL running a
huge number of requests and compute statistics
• webprofiler:analyze -> analyze all stored profiles for a
specific route and compute statistics (not yet available on
drupal.org)
Benchmark an URL
• Anonymous user

console webprofiler:benchmark http://d8 —runs=10
• Logged-in user

console webprofiler:benchmark http://admin:admin@d8/admin/
people —runs=10
• Rebuild cache before benchmark

console webprofiler:benchmark http://d8 --runs=10 —cache-
rebuild
• Store results in a file

console webprofiler:benchmark http://d8 --runs=10 --file=/Users/
lussoluca/Desktop/benchmark.yml
Analyze a route
• Default front page

console webprofiler:analyze view.frontpage.page_1 GET
average
• User profile page

console webprofiler:analyze entity.user.canonical GET
average
Write a new datacollector
Contrib modules can provides new data collectors
• find a service to instrument
• write a new class to wrap/replace the original service
• alter the container to instrument the service
• write a new data collector class
• write a new template class
Functional testing
• We can mock the plugin.manager.mail service or the
http_client service, for example, but if we want to write a
functional test with a real integration?
• Maybe we want to test how much time is spent or how
much memory is consumed
We can use data profiled by Webprofiler in our assertions
symfony.com/doc/current/cookbook/testing/profiling.html
Contributors
• Daniel Wehner (dawehner) - co-mantainer
• Eric Sod (esod)
• willzyx
• Francesco Caspani (fcaspani)
• Jesus Manuel Olivas (jmolivas)
We need a huge help on
• UX
• Javascript (Backbone) - www.drupal.org/node/2468007
• Statistical analysis
• Documentation
So please contact us!
Thanks!

More Related Content

What's hot (20)

PDF
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk
 
PDF
Web Development with Laravel 5
Soheil Khodayari
 
PDF
Composer intro
Timothy Hilliard
 
PPTX
Composer Lightning Talk
Eric Johnson
 
PPTX
10 Laravel packages everyone should know
Povilas Korop
 
PDF
Apache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitter
Apache Zeppelin
 
PDF
Material Design and Seaside
Pharo
 
PDF
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
PPTX
Introduction to laravel framework
Ahmad Fatoni
 
PPTX
Laravel Tutorial PPT
Piyush Aggarwal
 
PPTX
Laravel overview
Obinna Akunne
 
PPTX
Flask
Mamta Kumari
 
PPTX
Phalcon - Giant Killer
Jackson F. de A. Mafra
 
PPTX
[Part 1] automation of home appliances using raspberry pi – software installa...
Azilen Technologies Pvt. Ltd.
 
PPTX
Laravel5 Introduction and essentials
Pramod Kadam
 
PPTX
Machine Understandable code
janusathis
 
PDF
All of the thing about Postman
Alihossein shahabi
 
PPTX
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Dilouar Hossain
 
PPTX
Flyway - database migrations made easy
jstack
 
PPTX
Web presentation
Solaiman Hossain Tuhin
 
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk
 
Web Development with Laravel 5
Soheil Khodayari
 
Composer intro
Timothy Hilliard
 
Composer Lightning Talk
Eric Johnson
 
10 Laravel packages everyone should know
Povilas Korop
 
Apache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitter
Apache Zeppelin
 
Material Design and Seaside
Pharo
 
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
Introduction to laravel framework
Ahmad Fatoni
 
Laravel Tutorial PPT
Piyush Aggarwal
 
Laravel overview
Obinna Akunne
 
Phalcon - Giant Killer
Jackson F. de A. Mafra
 
[Part 1] automation of home appliances using raspberry pi – software installa...
Azilen Technologies Pvt. Ltd.
 
Laravel5 Introduction and essentials
Pramod Kadam
 
Machine Understandable code
janusathis
 
All of the thing about Postman
Alihossein shahabi
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Dilouar Hossain
 
Flyway - database migrations made easy
jstack
 
Web presentation
Solaiman Hossain Tuhin
 

Viewers also liked (7)

PPT
The Power Of Babble 011309
Dick Carlson
 
PPTX
Assessment for learning v2
Dick Carlson
 
PPT
Measurement,evaluation,assessment(upload)
Dr.Shazia Zamir
 
PPTX
Validity, reliability & practicality
Samcruz5
 
PPTX
Educational measurement, assessment and evaluation
Boyet Aluan
 
PPT
Presentation Validity & Reliability
songoten77
 
PDF
Devel for Drupal 8
Luca Lusso
 
The Power Of Babble 011309
Dick Carlson
 
Assessment for learning v2
Dick Carlson
 
Measurement,evaluation,assessment(upload)
Dr.Shazia Zamir
 
Validity, reliability & practicality
Samcruz5
 
Educational measurement, assessment and evaluation
Boyet Aluan
 
Presentation Validity & Reliability
songoten77
 
Devel for Drupal 8
Luca Lusso
 
Ad

Similar to A new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier (20)

PDF
A new tool for measuring performance in Drupal 8 - DrupalCamp London
Luca Lusso
 
PPTX
Web profiler in drupal 8
valuebound
 
PDF
Performance profiling and testing of symfony application 2
Andrew Yatsenko
 
PPTX
Drupal 8 Lessons From the Field: Part 3 - The Drupal Backend
Acquia
 
PDF
Test all the things! Automated testing with Drupal 8
Sam Becker
 
PDF
Drupal Performance : DrupalCamp North
Philip Norton
 
PPTX
Performance Tuning with XHProf
Salesforce Engineering
 
PPTX
PHP Profiling/performance
Nicolas Degardin
 
PDF
Drupal Performance Audit and Optimization
Zyxware Technologies
 
PDF
Modernize Your Drupal Development
Chris Tankersley
 
PDF
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
PDF
Benchmark Profile and Boost your Symfony application
Giulio De Donato
 
PDF
Beat the devil: towards a Drupal performance benchmark
Pedro González Serrano
 
PDF
Profiling and inspection with Blackfire.io
Emir Beganović
 
PDF
Test your modules
Erich Beyrent
 
PDF
High Performance Drupal Fast And Scalable Designs 1st Edition Sheltren
ditrentully
 
PDF
DrupalCampLA 2014 - Drupal backend performance and scalability
cherryhillco
 
PDF
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
Wong Hoi Sing Edison
 
ODP
2014 11 20 Drupal 7 -> 8 test migratie
hcderaad
 
PPTX
Performance tips for Symfony2 & PHP
Max Romanovsky
 
A new tool for measuring performance in Drupal 8 - DrupalCamp London
Luca Lusso
 
Web profiler in drupal 8
valuebound
 
Performance profiling and testing of symfony application 2
Andrew Yatsenko
 
Drupal 8 Lessons From the Field: Part 3 - The Drupal Backend
Acquia
 
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Drupal Performance : DrupalCamp North
Philip Norton
 
Performance Tuning with XHProf
Salesforce Engineering
 
PHP Profiling/performance
Nicolas Degardin
 
Drupal Performance Audit and Optimization
Zyxware Technologies
 
Modernize Your Drupal Development
Chris Tankersley
 
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
Benchmark Profile and Boost your Symfony application
Giulio De Donato
 
Beat the devil: towards a Drupal performance benchmark
Pedro González Serrano
 
Profiling and inspection with Blackfire.io
Emir Beganović
 
Test your modules
Erich Beyrent
 
High Performance Drupal Fast And Scalable Designs 1st Edition Sheltren
ditrentully
 
DrupalCampLA 2014 - Drupal backend performance and scalability
cherryhillco
 
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
Wong Hoi Sing Edison
 
2014 11 20 Drupal 7 -> 8 test migratie
hcderaad
 
Performance tips for Symfony2 & PHP
Max Romanovsky
 
Ad

Recently uploaded (20)

PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PPTX
internet básico presentacion es una red global
70965857
 
PDF
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PDF
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
internet básico presentacion es una red global
70965857
 
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
Orchestrating things in Angular application
Peter Abraham
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 

A new tool for measuring performance in Drupal 8 - Drupal Dev Days Montpellier

  • 1. A new tool for measuring performance in Drupal 8 Luca Lusso
  • 2. Luca Lusso • Senior Drupal Developer @ Wellnet - Italy • Acquia developer and backend developer certification • Twitter: @lussoluca • drupal.org/IRC: lussoluca • Not so fluent in english… sorry
  • 3. Symfony has a great profiler tool symfony.com/doc/current/cookbook/profiler
  • 4. Symfony profiler • Performance monitoring • Huge amount of high-level data about application’s internals (database query, rendered forms, errors, http request and response headers, routing, events, services, …) • Useful in functional testing (more on this later)
  • 5. Drupal 8 is built on Symfony so… we have the profiler too?!
  • 7. But wait… the Symfony profiler classes are declared in the HttpKernel component, here: core/vendor/symfony/http-kernel/Symfony/ Component/HttpKernel/Profiler And the HttpKernel IS in Drupal 8, so what is missing?
  • 8. Glue code is in FrameworkBundle and WebProfilerBundle But Symfony bundles doesn't works in Drupal 8 :-(
  • 9. Two options: 1. make Symfony bundles works in Drupal 8 (www.drupal.org/node/1880196 -> won't fix) 2. move the bundle code to a Drupal module We choose the Drupal way™
  • 12. How does it work Instrumented (collect data and store profile) Request Response <div id="webprofilerefa2f1"></div> <script> Webprofiler = (function () { […] } </script> Response • Add HTTP header -> X-Debug-Token: efa2f1 • Inject some javascript in the page:
  • 13. How does it work Profiling turned off Ajax Request Response /profiler/efa2f1 Returns only the toolbar DOM (with embedded javascript, css and icons)
  • 14. Integration with XHProf/UProfiler Drupal 8 version of XHProf module is compatibile with Webprofiler (www.drupal.org/project/xhprof) admin/config/development/profiler/configureadmin/config/development/xhprof
  • 15. Demo
  • 16. What you can measure, you can optimize
  • 17. Integration with Drupal Console project • Leverages the Symfony Console Component to provide a powerful CLI • Started as scaffolding generator now expose an increasing number of commands to interact with a Drupal 8 installation • Modules can contribute implementing new commands drupalconsole.com
  • 18. Implemented commands • webprofiler:list -> list stored profiles • webprofiler:export -> export stored profiles • webprofiler:benchmark -> benchmark an URL running a huge number of requests and compute statistics • webprofiler:analyze -> analyze all stored profiles for a specific route and compute statistics (not yet available on drupal.org)
  • 19. Benchmark an URL • Anonymous user
 console webprofiler:benchmark http://d8 —runs=10 • Logged-in user
 console webprofiler:benchmark http://admin:admin@d8/admin/ people —runs=10 • Rebuild cache before benchmark
 console webprofiler:benchmark http://d8 --runs=10 —cache- rebuild • Store results in a file
 console webprofiler:benchmark http://d8 --runs=10 --file=/Users/ lussoluca/Desktop/benchmark.yml
  • 20. Analyze a route • Default front page
 console webprofiler:analyze view.frontpage.page_1 GET average • User profile page
 console webprofiler:analyze entity.user.canonical GET average
  • 21. Write a new datacollector Contrib modules can provides new data collectors • find a service to instrument • write a new class to wrap/replace the original service • alter the container to instrument the service • write a new data collector class • write a new template class
  • 22. Functional testing • We can mock the plugin.manager.mail service or the http_client service, for example, but if we want to write a functional test with a real integration? • Maybe we want to test how much time is spent or how much memory is consumed We can use data profiled by Webprofiler in our assertions symfony.com/doc/current/cookbook/testing/profiling.html
  • 23. Contributors • Daniel Wehner (dawehner) - co-mantainer • Eric Sod (esod) • willzyx • Francesco Caspani (fcaspani) • Jesus Manuel Olivas (jmolivas)
  • 24. We need a huge help on • UX • Javascript (Backbone) - www.drupal.org/node/2468007 • Statistical analysis • Documentation So please contact us!