Discovering & Solving Performance Issues

Discovering & Solving Performance Issues

In this talk I show how to approach performance analysis during development, scaling your website and profiling in production. The second part of the talk discusses some general approaches for improving performance from upgrading to PHP 7 over optimizing performance in Doctrine entities/repositories to application- and HTTP-caching.

6a1345d8e6dd15b2c78eff0c331963b1?s=128

Denis Brumann

November 16, 2017
Tweet

Transcript

  1. DISCOVERING & SOLVING PERFORMANCE ISSUES

  2. Quick overview, rather than detailed look What works for me,

    might not work for you Introduction to some tools Opinionated guide of practices WHAT TO EXPECT?
  3. DENIS BRUMANN SensioLabs
 Berlin, Germany
 Developer @dbrumann
 denis.brumann@sensiolabs.de

  4. SYMFONY WEB PROFILER

  5. None
  6. not shown, but also containing the web-profiler:
 symfony/debug-pack

  7. None
  8. None
  9. {{ render(controller('App\\Controller\\GroupController::listAction')) }} {{ render(controller('App\\Controller\\EventController::listAction')) }}

  10. None
  11. None
  12. None
  13. None
  14. None
  15. How to Use the Profiler in a Functional Test https://symfony.com/doc/current/testing/profiling.html

  16. None
  17. It can be used to simulate a heavy load on

    a server, group of servers, network or object to test its strength or to analyze overall performance under different load types. https://jmeter.apache.org/
  18. None
  19. None
  20. None
  21. None
  22. None
  23. None
  24. None
  25. CAPACITY TEST
 Determine how many users and/or transactions a given

    system
 will support and still meet performance goals. LOAD TEST
 Verify application behavior under normal and peak load conditions. STRESS TEST
 Determine or validate an application’s behavior when pushed
 beyond normal or peak load conditions.
  26. None
  27. None
  28. https://msdn.microsoft.com/en-us/library/bb924375.aspx

  29. None
  30. None
  31. None
  32. None
  33. None
  34. Decorate original ApiClient with PSR-6 Cache https://symfony.com/doc/current/service_container/service_decoration.html

  35. None
  36. None
  37. TYPICAL PROBLEM GROUPS I/O Wait CPU-Usage Memory-Usage Network-Latency SQL-Queries

  38. HOW TO IMPROVE PERFORMANCE?

  39. PHP 7

  40. None
  41. None
  42. None
  43. DOCTRINE

  44. http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/improving-performance.html METADATA & QUERY CACHES it is strongly discouraged to

    use Doctrine without a Metadata and Query cache (preferably with APC or Memcache as the cache driver). ALTERNATIVE RESULT FORMATS Make effective use of the available alternative query result formats like nested array graphs or pure scalar results, especially in scenarios where data is loaded for read-only purposes.
  45. None
  46. None
  47. APPLICATION CACHE

  48. HTTP CACHE & ESI

  49. None
  50. DISCOVERING PERFORMANCE PROBLEMS Overall performance & scalability? Unspecified performance issue

    on a specific page? Worker jobs & CLI tasks? Load & capacity tests using JMeter During development: Web Profiler In depth analysis: Blackfire Blackfire
  51. GENERAL TIPS Measure first, then change Make changes in small

    increments Search for causes, not symptoms Verify assumptions & results with real data Revisit old assumptions
  52. THANK YOU