Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPDD23: Practical Debugging and Performance Pr...

PHPDD23: Practical Debugging and Performance Profiling

Finding and fixing bugs is part of the daily work in software development.
This talk is about a methodical approach to finding bugs.
In particular, we will focus on performance profiling, as there are particular challenges here, and some of the common debugging tools such as XDebug are of limited use.
We will discuss various tools as well as their use to efficiently track down performance issues.
We will look at the whole stack of the application, including IO and database.

Sebastian Kurfürst

September 22, 2023
Tweet

More Decks by Sebastian Kurfürst

Other Decks in Technology

Transcript

  1. Photo by Stackie Jia on Unsplash Flow in which a

    person [….] is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity.
  2. { "name": "neos/neos-development-distribution", "description": "Neos Development Distribution", "license": "GPL-3.0-or-later", "support":

    { "email": "[email protected]", "slack": "http://slack.neos.io/", "forum": "https://discuss.neos.io/", "wiki": "https://discuss.neos.io/c/the-neos-project/project-documentation", "issues": "https://github.com/neos/neos-development-collection/issues", "docs": "http://neos.readthedocs.io/", "source": "https://github.com/neos/neos-development-distribution" }, "config": { "vendor-dir": "Packages/Libraries", "bin-dir": "bin", "preferred-install": { "neos/*": "source", "flowpack/*": "source" }, "allow-plugins": { "neos/composer-plugin": true } }, "require": { "neos/neos-development-collection": "8.0.x-dev", "neos/flow-development-collection": "8.0.x-dev", "neos/demo": "8.0.x-dev", "neos/neos-ui": "8.0.x-dev", "neos/neos-ui-compiled": "8.0.x-dev", "neos/fusion-form": "@dev", "neos/party": "@dev", "neos/seo": "@dev", "neos/imagine": "@dev", "neos/twitter-bootstrap": "@dev", "neos/form": "@dev", "neos/setup": "@dev", "flowpack/neos-frontendlogin": "@dev", "mikey179/vfsstream": "^1.6", "phpunit/phpunit": "^9.0", "symfony/css-selector": "^2.0", "symfony/css-selector": "^2.0", "vimeo/psalm": "~4.9.3", "neos/doctools": "^3.3" }, "repositories": { "distributionPackages": { "type": "path", "url": "./DistributionPackages/*" } }, "suggest": { "ext-pdo_sqlite": "For running functional tests out-of-the-box th }, "scripts": { "post-create-project-cmd": "./flow welcome", "post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postU "post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::post "post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::p "post-package-install": "Neos\\Flow\\Composer\\InstallerScripts:: "test-unit": "phpunit -c Build/BuildEssentials/PhpUnit/UnitTests. "test-functional": "phpunit -c Build/BuildEssentials/PhpUnit/Func "test-static-flow": "psalm --config=Packages/Framework/psalm.xml "psalm-baseline-update-flow": "psalm --config=Packages/Framework/ Framework/psalm-baseline.xml" }, "require-dev": { "neos/behat": "8.0.x-dev", "neos/buildessentials": "8.0.x-dev" } }
  3. "bin-dir": "bin", "preferred-install": { "neos/*": "source", "flowpack/*": "source" }, "allow-plugins":

    { "neos/composer-plugin": true } }, "require": { "neos/neos-development-collection": "8.0.x-dev", "neos/flow-development-collection": "8.0.x-dev", "neos/demo": "8.0.x-dev", "neos/neos-ui": "8.0.x-dev", "neos/neos-ui-compiled": "8.0.x-dev", "neos/fusion-form": "@dev", "neos/party": "@dev", "neos/seo": "@dev", "neos/imagine": "@dev", "neos/twitter-bootstrap": "@dev", "neos/form": "@dev", "neos/setup": "@dev", "flowpack/neos-frontendlogin": "@dev", "mikey179/vfsstream": "^1.6", "phpunit/phpunit": "^9.0",
  4. OSX Host System Linux Virtual Machine Docker Container(s) mounts no

    problem, without performance hit normal mounts not possible, !!! lots of workarounds for emulating mounting SLOW sshfs gRPC-fuse virtiofs reality
  5. Unstable Foundation Modify some things in the codebase "which might

    improve things" do roughly the same steps, but not exactly
  6. var_dump() die() am I in the right codebase? (die() in

    entrypoint) 
 am I in the right fi le? 
 is the opcache caching too agressively? 
 how often is this method called?
  7. function B.2 throw new \RuntimeException("FOO"); read a stack trace function

    A function B.1 function C function main function main() { a() } function a() { b1(); b2(); } function b1() { c () } Stack
  8. Stable Foundation Hypothesis Design Experiment Execute Experiment Valid Knowledge write

    it down run an experiment to establish foundation must give 100% reliable results
  9. Thanks! Daniel Kahnemann: Thinking Fast and Slow xdebug, PHP-SPX github:

    sandstorm/drydock github: sandstorm/ebpf-tracer