SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Meetups
@SergioCarracedoRubén González
Programador vocacional.
Teleco.
JS, C, C++, Java, PHP, Python, Scala, Rust, Go...
@rubenrua
Control de calidad del software
Meetups
● Test unitarios
● Test funcionales
● Test de integración
● Test de UX
● Test de performance
Control de calidad del software
Meetups
● Test unitarios
● Test funcionales
● Test de integración
● Test de UX
● Test de performance
¿Quien hace test de performance?
¿Por qué el performance importa?
Meetups
● ...
¿Por qué el performance importa?
Meetups
● Dejar un mundo más verde.
○ Menos recursos necesarios.
○ Menos energía gastada.
● $$$$
○ Otra forma de ver el punto anterior.
● Happy users ⟹ More users (SEO)
○ 40% of users abandon a website that takes more than 3 seconds to load.
● Fama.
○ http://www.techempower.com/benchmarks/
○ http://benchmarksgame.alioth.debian.org/u64q/php.html
¿Como se consigue performance?
Meetups
● Cliente: Optimizar assets (guetzli), JS, Chrome DevTools...
● Red: HTTP/2, comprimir tráfico (TLS 1.3 0-RTT)...
● Servidor: cache, optimizar servidor, optimizar aplicación.
● Base de datos: saltar ORM/ODM, desnormalizar esquema, cache...
¿Como se consigue performance en PHP?
Meetups
Usa PHP7 (Con OPcache)
¿Como se consigue performance en PHP?
Meetups
Usa PHP7 (Con OPcache y sin Xdebug)
Sobre performance
Meetups
Antes de optimizar, mide mucho y bien. (blackfire.io)
¿Que es blackfire.io?
Meetups
● Profiler para PHP
● Mejora la UX de XHProf (y de var_dump([microtime(), memory_get_usage()]);)
● De los creadores de Symfony
● Saas
● Instalar servicio linux (docker) y zend_extension
● Vale para peticiones HTTP y para CLI
● Blackfire puede ser usado en cualquier fase del ciclo de video de tu aplicación: durante el
desarrollo, test, pre-produccion and produccion, para medir, test, debug y optimizar su
performance.
¿Que es blackfire.io?
Meetups
Como se instala
Meetups
# https://blackfire.io/docs/up-and-running/installation
$ # Configuring the Debian Repository
$ wget -O - https://packagecloud.io/gpg.key | apt-key add -
$ echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list
$ apt-get update
$ # Installing the Agent
$ apt-get install -y blackfire-agent
$ sudo blackfire-agent -register
$ sudo /etc/init.d/blackfire-agent restart
$ # Installing the CLI tool
$ blackfire config
$ # Installing the PHP Probe
$ apt-get install -y blackfire-php
$ php -m
[PHP Modules]
blackfire
…
[Zend Modules]
Zend OPcache
blackfire
DEMO: First profile
Meetups
● https://blackfire.io/docs/24-days/04-first-profile
● http://gitlist.demo.blackfire.io/
● https://blackfire.io/profiles/bc2e9173-1e17-4fdd-aa36-d1b4e742a945/graph
DEMO: First profile
Meetups
● https://blackfire.io/docs/24-days/04-first-profile
● Site, profile and comparation.
Caso real: PuMuKIT
Meetups
root@aa272b34fafc:/var/www/pumukit2# blackfire curl http://172.17.42.2/podcast/conferencevideo.xml
Profiling: [########################################] 10/10
Blackfire cURL completed
Profile URL: https://blackfire.io/profiles/eed51004-e27c-452d-82be-49677a263113/graph
Total time: 3.56 s
I/O: 31.8 ms
Memory: 358 MB
root@aa272b34fafc:/var/www/pumukit2# blackfire curl http://172.17.42.2/podcast/conferencevideo.xml
Profiling: [########################################] 10/10
Blackfire cURL completed
Profile URL: https://blackfire.io/profiles/3bc6fccf-d64e-4e51-9e5c-64e732bd6e9f/graph
Total time: 3.06 s
I/O: 29.3 ms
Memory: 37.9 MB
● Force an UnitOfWork::clear
● https://github.com/campusdomar/PuMuKIT2/commit/7c5fa20a8eca5e243ba57daaf24530e42c38b3d8?w=1
Caso real 2: Composer
Meetups
● https://github.com/composer/composer/pull/6168
● https://blackfire.io/profiles/675af85e-e54c-43af-9144-f7021639563a/graph
● https://blackfire.io/profiles/compare/675af85e-e54c-43af-9144-f7021639563a...0c2b42
21-8b63-4b65-9931-84629ec58e99/graph
El código
Meetups
<?php
//Memory 38MB
class Rule
{
public $literals;
public function __construct(array $literals)
{
$this->literals = $literals;
}
}
$rules = array();
$i = 0;
while ($i<80000){ //
$i++;
$array = array(-$i, $i);
$rule = new Rule($array);
$rules[] = $rule;
}
El código
Meetups
<?php
//Memory 38MB
class Rule
{
public $literals;
public function __construct(array $literals)
{
$this->literals = $literals;
}
}
$rules = array();
$i = 0;
while ($i<80000){ //
$i++;
$array = array(-$i, $i);
$rule = new Rule($array);
$rules[] = $rule;
}
<?php
//Memory 11.1MB
class Rule2Literal
{
public $literal1;
public $literal2;
public function __construct($literal1, $literal2)
{
$this->literal1 = $literal1;
$this->literal2 = $literal2;
}
}
$rules = array();
$i = 0;
while ($i<80000){ //
$i++;
$rule = new ConflictRule(-$i, $i);
$rules[] = $rule;
}
Resultado
Meetups
Project master 1st iter 2nd iter
https://github.com/Sylius/Sylius.git 43.7s 983 MB 41.8s 765 MB 46.6s 539 MB
https://github.com/laravel/laravel.git 7.49s 205 MB 6.9s 189 MB 6.96s 178 MB
https://github.com/symfony/symfony-demo 31.9s 699 MB 31.4s 546 MB 32s 383 MB
Private project 51.1s 1000MB -- 50.6s 536MB
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collector
● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and
consumes 90% less memory!
● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5%
performance boost!
● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in
such a test case."
● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible,
with a large number of performance related pull requests showing up with Blackfire graphs."
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collector
● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and
consumes 90% less memory!
● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5%
performance boost!
● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in
such a test case."
● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible,
with a large number of performance related pull requests showing up with Blackfire graphs."
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collector
● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and
consumes 90% less memory!
● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5%
performance boost!
● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in
such a test case."
● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible,
with a large number of performance related pull requests showing up with Blackfire graphs."
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collector
● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and
consumes 90% less memory!
● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5%
performance boost!
● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in
such a test case."
● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible,
with a large number of performance related pull requests showing up with Blackfire graphs."
Consejos
Meetups
● Primero usa PHP7 (y OPCache).
● Antes de optimizar, mide mucho y bien. (blackfire.io)
● Conoce tus herramientas (time) (@igrigorik).
● PHP no vale para todo. (@julienPauli)
● La optimización prematura es la raíz de todos los males. (Donald Knuth)
● You can optimise for execution speed. You can optimise for space.
But the most precious thing you should optimise for is
understandability
Links
Meetups
● https://blackfire.io/docs/24-days/01-introduction
● https://blog.blackfire.io/php-7-performance-improvements-packed-arrays.html
● https://hpbn.co/
● http://www.ideas2it.com/blog/symfony-performance-tips-tricks/
● http://jpauli.github.io/2015/03/05/opcache.html#configuring-opcache
● https://getcomposer.org/doc/articles/autoloader-optimization.md
www.opsou.com www.pedrofigueras.com

Contenu connexe

Tendances

SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
Justin Ryan
 

Tendances (20)

Michelin Starred Cooking with Chef
Michelin Starred Cooking with ChefMichelin Starred Cooking with Chef
Michelin Starred Cooking with Chef
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...
 
Cutting the Kubernetes Monorepo in pieces – never learnt more about git
Cutting the Kubernetes Monorepo in pieces – never learnt more about gitCutting the Kubernetes Monorepo in pieces – never learnt more about git
Cutting the Kubernetes Monorepo in pieces – never learnt more about git
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
ConcourseCi Dockerimage
ConcourseCi DockerimageConcourseCi Dockerimage
ConcourseCi Dockerimage
 
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
 
Next-Generation Ruby Deployment with Heroku
Next-Generation Ruby Deployment with HerokuNext-Generation Ruby Deployment with Heroku
Next-Generation Ruby Deployment with Heroku
 
Nebula: Netflix's OSS Gradle Plugins
Nebula: Netflix's OSS Gradle PluginsNebula: Netflix's OSS Gradle Plugins
Nebula: Netflix's OSS Gradle Plugins
 
Ansible ALLTHETHINGS
Ansible ALLTHETHINGSAnsible ALLTHETHINGS
Ansible ALLTHETHINGS
 
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopHadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoop
 
Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014
 
Tracking huge files with Git LFS (GlueCon 2016)
Tracking huge files with Git LFS (GlueCon 2016)Tracking huge files with Git LFS (GlueCon 2016)
Tracking huge files with Git LFS (GlueCon 2016)
 
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
 
Teaching a Designer to Use GitHub
Teaching a Designer to Use GitHubTeaching a Designer to Use GitHub
Teaching a Designer to Use GitHub
 
SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
 
Git hub actions: Android CI Pipeline
Git hub actions: Android CI PipelineGit hub actions: Android CI Pipeline
Git hub actions: Android CI Pipeline
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
It's a Breeze to develop Airflow (Cloud Native Warsaw)
It's a Breeze to develop Airflow (Cloud Native Warsaw)It's a Breeze to develop Airflow (Cloud Native Warsaw)
It's a Breeze to develop Airflow (Cloud Native Warsaw)
 

Similaire à Blackfire.io PHPVigo Talk

Browserscope oscon 2011
Browserscope oscon 2011Browserscope oscon 2011
Browserscope oscon 2011
lsimon
 
Django: Beyond Basics
Django: Beyond BasicsDjango: Beyond Basics
Django: Beyond Basics
arunvr
 
Aws uk ug #8 not everything that happens in vegas stay in vegas
Aws uk ug #8   not everything that happens in vegas stay in vegasAws uk ug #8   not everything that happens in vegas stay in vegas
Aws uk ug #8 not everything that happens in vegas stay in vegas
Peter Mounce
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPress
Hristo Chakarov
 

Similaire à Blackfire.io PHPVigo Talk (20)

Guider: An Integrated Runtime Performance Analyzer on AGL
Guider: An Integrated Runtime Performance Analyzer on AGLGuider: An Integrated Runtime Performance Analyzer on AGL
Guider: An Integrated Runtime Performance Analyzer on AGL
 
Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)
 
Sprint 44 review
Sprint 44 reviewSprint 44 review
Sprint 44 review
 
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
 
goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020
goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020
goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020
 
Browserscope oscon 2011
Browserscope oscon 2011Browserscope oscon 2011
Browserscope oscon 2011
 
Django: Beyond Basics
Django: Beyond BasicsDjango: Beyond Basics
Django: Beyond Basics
 
Benchmarking at Parse
Benchmarking at ParseBenchmarking at Parse
Benchmarking at Parse
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at Parse
 
Aws uk ug #8 not everything that happens in vegas stay in vegas
Aws uk ug #8   not everything that happens in vegas stay in vegasAws uk ug #8   not everything that happens in vegas stay in vegas
Aws uk ug #8 not everything that happens in vegas stay in vegas
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & Webdriver
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable product
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPress
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetup
 
Slow, Flaky and Legacy Tests: FTFY - Our New Testing Strategy at Net-A-Porter...
Slow, Flaky and Legacy Tests: FTFY - Our New Testing Strategy at Net-A-Porter...Slow, Flaky and Legacy Tests: FTFY - Our New Testing Strategy at Net-A-Porter...
Slow, Flaky and Legacy Tests: FTFY - Our New Testing Strategy at Net-A-Porter...
 
Optimizing Your CI Pipelines
Optimizing Your CI PipelinesOptimizing Your CI Pipelines
Optimizing Your CI Pipelines
 
improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
 
Scrum introduction
Scrum introductionScrum introduction
Scrum introduction
 
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
 

Plus de PHP Vigo

Plus de PHP Vigo (8)

Diariomotor Presentación PHPVigo
Diariomotor Presentación PHPVigoDiariomotor Presentación PHPVigo
Diariomotor Presentación PHPVigo
 
PHPVigo #09: Preprocesadores CSS/SASS por Sergio Carracedo
PHPVigo #09: Preprocesadores CSS/SASS por Sergio CarracedoPHPVigo #09: Preprocesadores CSS/SASS por Sergio Carracedo
PHPVigo #09: Preprocesadores CSS/SASS por Sergio Carracedo
 
Deployer Despliegue rápido de apps
Deployer  Despliegue rápido de appsDeployer  Despliegue rápido de apps
Deployer Despliegue rápido de apps
 
[Php vigo][talk] unit testing sucks ( and it's your fault )
[Php vigo][talk] unit testing sucks ( and it's your fault )[Php vigo][talk] unit testing sucks ( and it's your fault )
[Php vigo][talk] unit testing sucks ( and it's your fault )
 
Primeros pasos Symfony PHPVigo
Primeros pasos Symfony PHPVigoPrimeros pasos Symfony PHPVigo
Primeros pasos Symfony PHPVigo
 
Pablo Arias: Joomla como herramienta para el desarrollo web
Pablo Arias: Joomla como herramienta para el desarrollo webPablo Arias: Joomla como herramienta para el desarrollo web
Pablo Arias: Joomla como herramienta para el desarrollo web
 
Jesús Amieiro: Git para el día a día
Jesús Amieiro: Git para el día a díaJesús Amieiro: Git para el día a día
Jesús Amieiro: Git para el día a día
 
Presentación del grupo PHPVigo - Meetup #1
Presentación del grupo PHPVigo - Meetup #1Presentación del grupo PHPVigo - Meetup #1
Presentación del grupo PHPVigo - Meetup #1
 

Dernier

Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
amilabibi1
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
Sheetaleventcompany
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 

Dernier (20)

ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
Air breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animalsAir breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animals
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, YardstickSaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 

Blackfire.io PHPVigo Talk

  • 1.
  • 2. Meetups @SergioCarracedoRubén González Programador vocacional. Teleco. JS, C, C++, Java, PHP, Python, Scala, Rust, Go... @rubenrua
  • 3. Control de calidad del software Meetups ● Test unitarios ● Test funcionales ● Test de integración ● Test de UX ● Test de performance
  • 4. Control de calidad del software Meetups ● Test unitarios ● Test funcionales ● Test de integración ● Test de UX ● Test de performance ¿Quien hace test de performance?
  • 5. ¿Por qué el performance importa? Meetups ● ...
  • 6. ¿Por qué el performance importa? Meetups ● Dejar un mundo más verde. ○ Menos recursos necesarios. ○ Menos energía gastada. ● $$$$ ○ Otra forma de ver el punto anterior. ● Happy users ⟹ More users (SEO) ○ 40% of users abandon a website that takes more than 3 seconds to load. ● Fama. ○ http://www.techempower.com/benchmarks/ ○ http://benchmarksgame.alioth.debian.org/u64q/php.html
  • 7. ¿Como se consigue performance? Meetups ● Cliente: Optimizar assets (guetzli), JS, Chrome DevTools... ● Red: HTTP/2, comprimir tráfico (TLS 1.3 0-RTT)... ● Servidor: cache, optimizar servidor, optimizar aplicación. ● Base de datos: saltar ORM/ODM, desnormalizar esquema, cache...
  • 8. ¿Como se consigue performance en PHP? Meetups Usa PHP7 (Con OPcache)
  • 9. ¿Como se consigue performance en PHP? Meetups Usa PHP7 (Con OPcache y sin Xdebug)
  • 10. Sobre performance Meetups Antes de optimizar, mide mucho y bien. (blackfire.io)
  • 11. ¿Que es blackfire.io? Meetups ● Profiler para PHP ● Mejora la UX de XHProf (y de var_dump([microtime(), memory_get_usage()]);) ● De los creadores de Symfony ● Saas ● Instalar servicio linux (docker) y zend_extension ● Vale para peticiones HTTP y para CLI ● Blackfire puede ser usado en cualquier fase del ciclo de video de tu aplicación: durante el desarrollo, test, pre-produccion and produccion, para medir, test, debug y optimizar su performance.
  • 13. Como se instala Meetups # https://blackfire.io/docs/up-and-running/installation $ # Configuring the Debian Repository $ wget -O - https://packagecloud.io/gpg.key | apt-key add - $ echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list $ apt-get update $ # Installing the Agent $ apt-get install -y blackfire-agent $ sudo blackfire-agent -register $ sudo /etc/init.d/blackfire-agent restart $ # Installing the CLI tool $ blackfire config $ # Installing the PHP Probe $ apt-get install -y blackfire-php $ php -m [PHP Modules] blackfire … [Zend Modules] Zend OPcache blackfire
  • 14. DEMO: First profile Meetups ● https://blackfire.io/docs/24-days/04-first-profile ● http://gitlist.demo.blackfire.io/ ● https://blackfire.io/profiles/bc2e9173-1e17-4fdd-aa36-d1b4e742a945/graph
  • 15. DEMO: First profile Meetups ● https://blackfire.io/docs/24-days/04-first-profile ● Site, profile and comparation.
  • 16. Caso real: PuMuKIT Meetups root@aa272b34fafc:/var/www/pumukit2# blackfire curl http://172.17.42.2/podcast/conferencevideo.xml Profiling: [########################################] 10/10 Blackfire cURL completed Profile URL: https://blackfire.io/profiles/eed51004-e27c-452d-82be-49677a263113/graph Total time: 3.56 s I/O: 31.8 ms Memory: 358 MB root@aa272b34fafc:/var/www/pumukit2# blackfire curl http://172.17.42.2/podcast/conferencevideo.xml Profiling: [########################################] 10/10 Blackfire cURL completed Profile URL: https://blackfire.io/profiles/3bc6fccf-d64e-4e51-9e5c-64e732bd6e9f/graph Total time: 3.06 s I/O: 29.3 ms Memory: 37.9 MB ● Force an UnitOfWork::clear ● https://github.com/campusdomar/PuMuKIT2/commit/7c5fa20a8eca5e243ba57daaf24530e42c38b3d8?w=1
  • 17. Caso real 2: Composer Meetups ● https://github.com/composer/composer/pull/6168 ● https://blackfire.io/profiles/675af85e-e54c-43af-9144-f7021639563a/graph ● https://blackfire.io/profiles/compare/675af85e-e54c-43af-9144-f7021639563a...0c2b42 21-8b63-4b65-9931-84629ec58e99/graph
  • 18.
  • 19.
  • 20. El código Meetups <?php //Memory 38MB class Rule { public $literals; public function __construct(array $literals) { $this->literals = $literals; } } $rules = array(); $i = 0; while ($i<80000){ // $i++; $array = array(-$i, $i); $rule = new Rule($array); $rules[] = $rule; }
  • 21. El código Meetups <?php //Memory 38MB class Rule { public $literals; public function __construct(array $literals) { $this->literals = $literals; } } $rules = array(); $i = 0; while ($i<80000){ // $i++; $array = array(-$i, $i); $rule = new Rule($array); $rules[] = $rule; } <?php //Memory 11.1MB class Rule2Literal { public $literal1; public $literal2; public function __construct($literal1, $literal2) { $this->literal1 = $literal1; $this->literal2 = $literal2; } } $rules = array(); $i = 0; while ($i<80000){ // $i++; $rule = new ConflictRule(-$i, $i); $rules[] = $rule; }
  • 22. Resultado Meetups Project master 1st iter 2nd iter https://github.com/Sylius/Sylius.git 43.7s 983 MB 41.8s 765 MB 46.6s 539 MB https://github.com/laravel/laravel.git 7.49s 205 MB 6.9s 189 MB 6.96s 178 MB https://github.com/symfony/symfony-demo 31.9s 699 MB 31.4s 546 MB 32s 383 MB Private project 51.1s 1000MB -- 50.6s 536MB
  • 23. Otros casos reales Meetups ● Composer got a huge performance boost last week thanks to the disabling of the garbage collector ● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and consumes 90% less memory! ● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5% performance boost! ● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in such a test case." ● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible, with a large number of performance related pull requests showing up with Blackfire graphs."
  • 24. Otros casos reales Meetups ● Composer got a huge performance boost last week thanks to the disabling of the garbage collector ● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and consumes 90% less memory! ● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5% performance boost! ● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in such a test case." ● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible, with a large number of performance related pull requests showing up with Blackfire graphs."
  • 25. Otros casos reales Meetups ● Composer got a huge performance boost last week thanks to the disabling of the garbage collector ● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and consumes 90% less memory! ● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5% performance boost! ● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in such a test case." ● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible, with a large number of performance related pull requests showing up with Blackfire graphs."
  • 26. Otros casos reales Meetups ● Composer got a huge performance boost last week thanks to the disabling of the garbage collector ● How we sped up Sylius' Behat suite with Blackfire: The Sylius test suite is now 6 times faster and consumes 90% less memory! ● Optimizing league/commonmark with Blackfire.io: Two simple changes led to a whopping 52.5% performance boost! ● Pomm: A two hours run with Blackfire.io: "35% performance improvement is a major enhancement in such a test case." ● ownCloud: Recent Performance Optimizations: "Enthusiasm around the tool is becoming very visible, with a large number of performance related pull requests showing up with Blackfire graphs."
  • 27. Consejos Meetups ● Primero usa PHP7 (y OPCache). ● Antes de optimizar, mide mucho y bien. (blackfire.io) ● Conoce tus herramientas (time) (@igrigorik). ● PHP no vale para todo. (@julienPauli) ● La optimización prematura es la raíz de todos los males. (Donald Knuth) ● You can optimise for execution speed. You can optimise for space. But the most precious thing you should optimise for is understandability
  • 28. Links Meetups ● https://blackfire.io/docs/24-days/01-introduction ● https://blog.blackfire.io/php-7-performance-improvements-packed-arrays.html ● https://hpbn.co/ ● http://www.ideas2it.com/blog/symfony-performance-tips-tricks/ ● http://jpauli.github.io/2015/03/05/opcache.html#configuring-opcache ● https://getcomposer.org/doc/articles/autoloader-optimization.md