SlideShare une entreprise Scribd 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!

Contenu connexe

Tendances

Tendances (20)

Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring InsightSplunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Composer intro
Composer introComposer intro
Composer intro
 
Composer Lightning Talk
Composer Lightning TalkComposer Lightning Talk
Composer Lightning Talk
 
10 Laravel packages everyone should know
10 Laravel packages everyone should know10 Laravel packages everyone should know
10 Laravel packages everyone should know
 
Apache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitter
Apache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitterApache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitter
Apache Zeppelin on Kubernetes with Spark and Kafka - meetup @twitter
 
Material Design and Seaside
Material Design and SeasideMaterial Design and Seaside
Material Design and Seaside
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Flask
FlaskFlask
Flask
 
Phalcon - Giant Killer
Phalcon - Giant KillerPhalcon - Giant Killer
Phalcon - Giant Killer
 
[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
Machine Understandable code
Machine Understandable codeMachine Understandable code
Machine Understandable code
 
All of the thing about Postman
All of the thing about PostmanAll of the thing about Postman
All of the thing about Postman
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
Flyway - database migrations made easy
Flyway - database migrations made easyFlyway - database migrations made easy
Flyway - database migrations made easy
 
Web presentation
Web presentationWeb presentation
Web presentation
 

En vedette (7)

The Power Of Babble 011309
The Power Of Babble 011309The Power Of Babble 011309
The Power Of Babble 011309
 
Assessment for learning v2
Assessment for learning v2Assessment for learning v2
Assessment for learning v2
 
Measurement,evaluation,assessment(upload)
Measurement,evaluation,assessment(upload)Measurement,evaluation,assessment(upload)
Measurement,evaluation,assessment(upload)
 
Validity, reliability & practicality
Validity, reliability & practicalityValidity, reliability & practicality
Validity, reliability & practicality
 
Educational measurement, assessment and evaluation
Educational measurement, assessment and evaluationEducational measurement, assessment and evaluation
Educational measurement, assessment and evaluation
 
Presentation Validity & Reliability
Presentation Validity & ReliabilityPresentation Validity & Reliability
Presentation Validity & Reliability
 
Devel for Drupal 8
Devel for Drupal 8Devel for Drupal 8
Devel for Drupal 8
 

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

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

A new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp LondonA new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp London
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
 
Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!
 
DrupalCon 2011 Highlight
DrupalCon 2011 HighlightDrupalCon 2011 Highlight
DrupalCon 2011 Highlight
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
drupal_training
drupal_trainingdrupal_training
drupal_training
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.
 
(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern Desktop(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern Desktop
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
MuleSoft_Meetup_Brisbane_2022-06-01_SonarQube_CataloguingAPIs.pptx
MuleSoft_Meetup_Brisbane_2022-06-01_SonarQube_CataloguingAPIs.pptxMuleSoft_Meetup_Brisbane_2022-06-01_SonarQube_CataloguingAPIs.pptx
MuleSoft_Meetup_Brisbane_2022-06-01_SonarQube_CataloguingAPIs.pptx
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamFrom Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
 
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
 
Engage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostEngage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance Boost
 
Engage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostEngage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance Boost
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
 

Dernier

audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
lolsDocherty
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
abhinandnam9997
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
ChloeMeadows1
 

Dernier (16)

Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptx
 
Reggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirts
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
Topology of the Network class 8 .ppt pdf
Topology of the Network class 8 .ppt pdfTopology of the Network class 8 .ppt pdf
Topology of the Network class 8 .ppt pdf
 
Development Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of appsDevelopment Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of apps
 
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWebiThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
Thank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirtsThank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirts
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 

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!