Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Meetups
@SergioCarracedoRubén González
Programador vocacional.
Teleco.
JS, C, C++, Java, PHP, Python, Scala, Rust, Go...
@...
Control de calidad del software
Meetups
● Test unitarios
● Test funcionales
● Test de integración
● Test de UX
● Test de p...
Control de calidad del software
Meetups
● Test unitarios
● Test funcionales
● Test de integración
● Test de UX
● Test de p...
¿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....
¿Como se consigue performance?
Meetups
● Cliente: Optimizar assets (guetzli), JS, Chrome DevTools...
● Red: HTTP/2, compri...
¿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()...
¿Que es blackfire.io?
Meetups
Como se instala
Meetups
# https://blackfire.io/docs/up-and-running/installation
$ # Configuring the Debian Repository
$ wg...
DEMO: First profile
Meetups
● https://blackfire.io/docs/24-days/04-first-profile
● http://gitlist.demo.blackfire.io/
● htt...
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....
Caso real 2: Composer
Meetups
● https://github.com/composer/composer/pull/6168
● https://blackfire.io/profiles/675af85e-e5...
El código
Meetups
<?php
//Memory 38MB
class Rule
{
public $literals;
public function __construct(array $literals)
{
$this-...
El código
Meetups
<?php
//Memory 38MB
class Rule
{
public $literals;
public function __construct(array $literals)
{
$this-...
Resultado
Meetups
Project master 1st iter 2nd iter
https://github.com/Sylius/Sylius.git 43.7s 983 MB 41.8s 765 MB 46.6s 53...
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collec...
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collec...
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collec...
Otros casos reales
Meetups
● Composer got a huge performance boost last week thanks to the disabling of the garbage collec...
Consejos
Meetups
● Primero usa PHP7 (y OPCache).
● Antes de optimizar, mide mucho y bien. (blackfire.io)
● Conoce tus herr...
Links
Meetups
● https://blackfire.io/docs/24-days/01-introduction
● https://blog.blackfire.io/php-7-performance-improvemen...
www.opsou.com www.pedrofigueras.com
Blackfire.io PHPVigo Talk
Blackfire.io PHPVigo Talk
Blackfire.io PHPVigo Talk
Nächste SlideShare
Wird geladen in …5
×

Blackfire.io PHPVigo Talk

337 Aufrufe

Veröffentlicht am

Presentación sobre el uso de blackfire.io para realizar profiling de las apps PHP y encontrar como mejorar su rendimiento en CPU o memoria.

Veröffentlicht in: Präsentationen & Vorträge
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Blackfire.io PHPVigo Talk

  1. 1. Meetups @SergioCarracedoRubén González Programador vocacional. Teleco. JS, C, C++, Java, PHP, Python, Scala, Rust, Go... @rubenrua
  2. 2. Control de calidad del software Meetups ● Test unitarios ● Test funcionales ● Test de integración ● Test de UX ● Test de performance
  3. 3. 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?
  4. 4. ¿Por qué el performance importa? Meetups ● ...
  5. 5. ¿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
  6. 6. ¿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...
  7. 7. ¿Como se consigue performance en PHP? Meetups Usa PHP7 (Con OPcache)
  8. 8. ¿Como se consigue performance en PHP? Meetups Usa PHP7 (Con OPcache y sin Xdebug)
  9. 9. Sobre performance Meetups Antes de optimizar, mide mucho y bien. (blackfire.io)
  10. 10. ¿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.
  11. 11. ¿Que es blackfire.io? Meetups
  12. 12. 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
  13. 13. 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
  14. 14. DEMO: First profile Meetups ● https://blackfire.io/docs/24-days/04-first-profile ● Site, profile and comparation.
  15. 15. 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
  16. 16. 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
  17. 17. 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; }
  18. 18. 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; }
  19. 19. 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
  20. 20. 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."
  21. 21. 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."
  22. 22. 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."
  23. 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. 24. 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
  25. 25. 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
  26. 26. www.opsou.com www.pedrofigueras.com

×