Skip to content

SPX

SPX provides development teams with a tool to profile and debug performance issues.

SPX is packaged in our Alpine Packages Repository and installed by default in our local development images.

Why use SPX?

As stated on the project's README.md:

How to use SPX

Browser

  • Enable SPX
    • Go to to: http://127.0.0.1:8080/?SPX_KEY=dev&SPX_UI_URI=/
    • Select "Enabled" and "Automatic start"
  • Gather profiling data
    • Interact with the application and execute a scenario
    • Check back at http://127.0.0.1:8080/?SPX_UI_URI=/
    • Click on a profile at the bottom of the page

Command Line

Execute any command prefixed with the following environment variables:

SPX_ENABLED=1
SPX_REPORT=full

eg.

SPX_ENABLED=1 SPX_REPORT=full drush cr

Debugging

I cannot see my profiling data

This is generally a permissions issue.

SPX does not provide any warnings/erorrs when it cannot write to the directory where the profiling data is stored.

This directory is (by default):

/tmp/spx

and should have the permissions:

  • Inside the Skpr container: skpr:skpr
  • Outside of the Skpr container: 1000:1000

I cannot see my profiling command line profiling data in the Web UI

This is generally:

  • Permissions issue (see previous debugging section)
  • The profiling data directory is not mounted between the CLI container and the PHP/Web container.

Below is an example of the Docker Compose services php-fpm and php-cli where the profilng data is shared using a volume.

services:
  php-fpm:
      - ./.docker/tmp/spx:/tmp/spx

  php-cli:
    volumes:
      - ./.docker/tmp/spx:/tmp/spx