Configure Blackfire

You can add Blackfire to your Cloud Docker for Commerce environment to fully automate performance testing.

Blackfire.io for Adobe Commerce on cloud infrastructure is a PHP profiler and automated performance testing tool for use in development, integration, staging, and production environments. It enables you to locate and investigate performance issues in your environment at the code level and creates a performance profile by tracking every PHP call, method, and SQL query performed by your code.

data-variant=warning
data-slots=text
You must have a Blackfire license and account to use Blackfire with Adobe Commerce on cloud infrastructure projects. See Adobe Commerce Cloud support or Blackfire for Magento on the Blackfire.io website.

To add Blackfire.io to your project configuration:

  1. Add the following Blackfire.io configuration to the runtime:extensions section of the .magento.app.yaml file.

    runtime:
      extensions:
        - random-extension-here
        -
          name: blackfire
          configuration:
            server_id: SERVER_ID
            server_token: SERVER_TOKEN
            client_id: CLIENT_ID
            client_token: CLIENT_TOKEN
    
  2. Generate the docker-compose.yml file for developer mode, adding any required build or service configuration options and file synchronization options if needed.

    ./vendor/bin/ece-docker build:compose --mode="developer"
    
  3. Start the Cloud Docker for Commerce environment.

    ./bin/magento-docker up
    
    ./bin/magento-docker ece-redeploy
    

    <-- <InlineAlert variant="info" slots="text"/> -->

    If you are using file synchronization, synchronize files as needed. See Launch Docker in developer mode.

  4. Add context to use locally customized PHP images as described in Extend the Docker configuration.

  5. Install Adobe Commerce in your Docker environment.

    • Deploy Adobe Commerce in the Docker container.

      docker compose run --rm deploy cloud-deploy
      
      docker compose run --rm deploy magento-command deploy:mode:set developer
      
    • Run post-deploy hooks.

      docker compose run --rm deploy cloud-post-deploy
      

    <!-- <InlineAlert variant="help" slots="text"/> -->

    Review messages and notifications during the deployment process and address any errors or notifications as needed.

  6. Enable the Varnish cache for the Adobe Commerce application.

    docker compose run --rm deploy magento-command config:set system/full_page_cache/caching_application 2 --lock-env
    
    docker compose run --rm deploy magento-command setup:config:set  --http-cache-hosts=varnish
    
  7. Clear the cache.

    docker compose run --rm deploy magento-command cache:clean
    
  8. Make sure that necessary containers are up and running.

    docker compose ps
    

To use Blackfire.io for performance testing in Cloud Docker:

  1. Install a profiling client as described in the Blackfire documentation.

  2. Profile the Adobe Commerce website.

<!--Link definitions-->