Back to blog

Performance

PHP Profiling in Production: Blackfire, Tideways & SPX Compared

Evaluates three PHP profilers for production use - setup, overhead, callgraph visualizations, and alerting on regressions.

  • PHP
  • Profiling
  • Blackfire
  • Tideways
  • SPX
  • Performance

Reader map

Key points in PHP Profiling in Production: Blackfire, Tideways & SPX Compared

Syntax first, runtime behavior second, migration cleanup last.

Read
23 min
Waypoints
4
Track
Performance
  1. 01
    Start here

    developers need deterministic profiles on exact requests

  2. 02
    Waypoint

    you want callgraph, timeline, SQL, HTTP, memory, and assertions in one workflow

  3. 03
    Waypoint

    CI performance budgets matter

  4. 04
    Migration check

    profiling should be triggered deliberately

SEO Metadata

SEO Title Options

  1. PHP Profiling in Production: Blackfire, Tideways & SPX
  2. PHP Profiling in Production: Blackfire: Practical 2026
  3. Performance Playbook: PHP Profiling in Production

Meta Description Options

  1. Learn PHP Profiling in Production: Blackfire, Tideways & SPX Compared with a practical Performance framework, expert mistakes, implementation steps, examples.
  2. Evaluates three PHP profilers for production use - setup, overhead, callgraph visualizations, and alerting on regressions.

URL Slug

php-profiling-production-blackfire-tideways-spx-compared

Focus Keyword

PHP Profiling in Production: Blackfire, Tideways & SPX Compared

Additional LSI Keywords

  • Performance
  • PHP
  • Profiling
  • Blackfire
  • Tideways
  • SPX
  • PHP Profiling in Production: Blackfire, Tideways & SPX Compared
  • production checklist
  • implementation guide
  • best practices
  • architecture decisions
  • testing strategy

Table of Contents

Article overview

PHP Profiling in Production: Blackfire, Tideways & SPX Compared is the kind of topic that looks simple until it reaches production. Teams usually discover the real cost late: unclear boundaries, weak defaults, hidden maintenance work, and decisions that seemed harmless when the codebase was small.

The problem gets worse when the article, tutorial, or implementation guide only explains the happy path. This guide closes that gap with a practical framework, a comparison table, common mistakes, and a deep technical section you can use while planning real work.

Keep reading for the non-obvious part: the safest implementation is rarely the most impressive-looking one. It is the one your team can debug, test, document, and evolve without turning every future change into archaeology.

Key Takeaways

  • PHP Profiling in Production: Blackfire, Tideways & SPX Compared should be evaluated as a production decision, not only as a syntax or tooling choice.
  • The best implementation keeps responsibilities visible, with clear ownership, tests, documentation, and rollback paths.
  • Search visibility improves when practical depth, structured answers, and expert examples live on the same page.

[IMAGE: A mobile-first technical article layout showing the main concept, decision table, implementation checklist, and FAQ blocks. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared expert guide for Performance]

What PHP Profiling in Production: Blackfire, Tideways & SPX Compared means

PHP Profiling in Production: Blackfire, Tideways & SPX Compared means applying performance knowledge to a concrete engineering decision, then turning that decision into reliable code, documentation, and operational behavior. In practice, it combines the topic's core concepts with trade-off analysis, implementation boundaries, testing strategy, and maintenance discipline.

This is the definition worth optimizing for featured snippets because it avoids hype. It tells the reader what the topic does and what a professional implementation must include.

Why it matters now

The technical web is more crowded than it was a few years ago. Thin tutorials can still get indexed, but they rarely earn trust from senior developers, buyers, AI answer systems, or teams that need production guidance.

For performance topics, the strongest content now has three layers:

  • a clear answer for fast scanning
  • a practical framework for implementation
  • expert context that explains what breaks later

That same structure helps search engines understand the page. It also helps readers decide whether the advice fits their project.

Implementation framework

Use this framework before adopting the approach described in this article.

  1. Define the user problem and the production risk.
  2. Identify the smallest reliable implementation boundary.
  3. Keep configuration, secrets, and environment-specific behavior outside the article's core logic.
  4. Add tests for the behavior that would hurt if it regressed.
  5. Document the trade-off, not only the final code.
  6. Measure the result with logs, metrics, or user-facing outcomes.
  7. Revisit the decision after real usage exposes edge cases.

The sequence is deliberately conservative. It keeps the work grounded in outcomes instead of novelty.

[IMAGE: A seven-step implementation framework with discovery, boundary design, configuration, tests, documentation, measurement, and iteration. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared implementation framework]

Practical comparison

Decision areaStrong approachWeak approachWhy it matters
ScopeSolve one clear problemMix unrelated concernsFocus improves testing and search intent
ArchitecturePut logic in explicit classes or documented boundariesHide behavior in templates or incidental callbacksFuture changes stay easier to review
Data flowPass prepared data into the view or endpointQuery or compute in presentation codeReduces regressions and performance surprises
TestingCover the risky behavior directlyTest only the happy pathCatches production failures earlier
DocumentationExplain trade-offs and limitsRepeat generic definitionsBuilds E-E-A-T and reader trust
OperationsTrack logs, metrics, and rollback stepsShip without measurementMakes the decision reversible

This table is intentionally practical. It gives a reviewer something to check before the implementation becomes expensive to change.

Expert workflow

Expert tip: "Treat PHP Profiling in Production: Blackfire, Tideways & SPX Compared as a system boundary. If the next developer cannot find where the decision lives, how it is tested, and when it should be avoided, the implementation is not finished."

A useful workflow is simple:

  • Start with the smallest working example.
  • Add the constraints that exist in your real project.
  • Remove anything that only demonstrates cleverness.
  • Write down the failure modes.
  • Add links to related decisions so future readers can navigate the topic cluster.

That last point matters for both humans and search systems. A single article can answer a question; a cluster proves authority.

Common mistakes

Mistake 1: Copying a pattern without its context

A pattern that works in a small demo can fail in a real application. The missing context is usually data volume, team experience, deployment process, security requirements, or observability.

Before copying the pattern, ask what assumption made it safe in the original example.

Mistake 2: Putting business logic in the wrong layer

This is the fastest way to make future debugging expensive. In Laravel, PHP, and server-rendered websites, presentation should receive prepared data, not discover rules on its own.

Keep decision logic in models, actions, services, policies, requests, jobs, or documented helpers where it can be tested directly.

Mistake 3: Optimizing for novelty instead of maintainability

Newer tools and language features can be valuable. They can also hide simple behavior behind unfamiliar syntax.

Use the option that makes the next production incident easier to understand.

Mistake 4: Publishing without a measurement plan

If the article describes a performance, SEO, security, or architecture improvement, define how success will be checked. Logs, tests, crawl diagnostics, analytics, and user behavior are all stronger than assumptions.

[IMAGE: A common-mistakes board with context loss, wrong layer, novelty bias, and missing measurement highlighted. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared common mistakes]

Image placeholders

  • [IMAGE: A concept diagram for PHP Profiling in Production: Blackfire, Tideways & SPX Compared with input, decision boundary, implementation, tests, and production feedback. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared concept diagram]
  • [IMAGE: A mobile screenshot-style checklist for PHP Profiling in Production: Blackfire, Tideways & SPX Compared. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared mobile checklist]
  • [IMAGE: A comparison table visualization for strong versus weak implementation choices. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared comparison table]

Video placeholder

[VIDEO: Insert a 5-8 minute YouTube walkthrough that demonstrates the main decision, the implementation boundary, the test strategy, and the production caveats for PHP Profiling in Production: Blackfire, Tideways & SPX Compared.]

Internal linking opportunities

Original Technical Deep Dive

Production profiling has one job: explain real slowness without creating more slowness.

That immediately rules out a lot of profiler habits from local development. Xdebug profiler output is useful on a workstation, but you do not leave Xdebug tracing on for production traffic. A one-off microtime(true) timer can prove a suspicion, but it cannot explain a request tree. A load test can show an endpoint got slower, but not which function, query, template, serializer, or network call caused it.

This guide compares three PHP profiling options:

  • Blackfire
  • Tideways
  • SPX

The comparison focuses on production use:

  • setup shape
  • overhead model
  • callgraph and timeline usability
  • regression alerting
  • security and operational risk

This guide was reviewed on May 7, 2026 against the current Blackfire, Tideways, and php-spx documentation.

The short version

ToolBest fitProduction posture
BlackfireOn-demand deep profiles, CI performance assertions, release checksStrong production story for triggered profiles and monitoring
TidewaysAlways-on PHP APM, sampled traces, transaction monitoring, alertsStrong production story for continuous monitoring and sampled profiling
SPXLocal, private staging, CLI profiling, self-hosted diagnostic sessionsNot a production-ready public profiler by its own README

Use Blackfire when:

  • developers need deterministic profiles on exact requests
  • you want callgraph, timeline, SQL, HTTP, memory, and assertions in one workflow
  • CI performance budgets matter
  • profiling should be triggered deliberately

Use Tideways when:

  • you want always-on production monitoring for every request
  • transaction grouping, percentiles, alerts, and trace sampling matter
  • the team needs daily operational visibility, not only manual profiles
  • you want callgraphs on sampled or tracepoint-triggered requests

Use SPX when:

  • you want a free profiler inside your own infrastructure
  • you need local or private staging flame graphs and flat profiles
  • CLI profiling matters
  • the environment can be strictly isolated

Do not expose SPX publicly. Its README explicitly warns about production readiness and web UI security concerns.

What production profiling must answer

Good profiling answers specific questions:

  • Why did checkout p95 move from 420 ms to 850 ms?
  • Is slow time in PHP, SQL, HTTP, filesystem I/O, template rendering, or lock waits?
  • Which function owns self time?
  • Which call path owns inclusive time?
  • Did a release increase memory?
  • Did a serializer, event listener, hydrator, or middleware suddenly run too often?
  • Is this one slow request or a transaction-wide regression?

[IMAGE: Supporting visual 1 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 1]

[IMAGE: Supporting visual 1 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 1]

A profiler that only gives one massive call table is not enough. A production workflow needs:

  • low default overhead
  • sampling or explicit triggering
  • route or transaction grouping
  • callgraph navigation
  • timeline view
  • comparison before and after a change
  • alerting or performance budgets
  • safe handling of sensitive data
  • clear retention and access controls

Overhead model matters

Profiler overhead is not one number.

It depends on:

  • whether profiling is always on or triggered
  • whether the tool records every function call
  • whether it captures arguments
  • whether it samples requests
  • whether it collects only timing spans or full callgraphs
  • how many very small functions the request executes
  • whether data is written locally, sent to a daemon, or uploaded directly

Use this mental model:

ModeTypical useRisk
Basic monitoringp95, memory, status, transaction namelow detail
Timeline tracespans, SQL, HTTP, framework layersmoderate detail and moderate overhead
Full callgraphevery relevant function call and caller/callee shapehigh detail and potentially high overhead
Continuous profilerprobabilistic samples over timeless exact per request, good trend visibility

Full callgraphs are expensive because they observe function-level execution. Keep them triggered, sampled, or limited.

Blackfire: production-safe triggered profiling

Blackfire's strongest position is deterministic, on-demand profiling that can run in production without impacting ordinary end-user traffic.

The Blackfire stack has three moving parts:

  • PHP probe
  • Blackfire agent
  • profiling client, such as the browser extension, CLI, or SDK

The installation docs describe the need for a language extension, an agent, and a profiling client.

Minimal PHP probe configuration shape:

[blackfire]
extension=blackfire.so
blackfire.apm_enabled=1
blackfire.agent_socket=unix:///var/run/blackfire/agent.sock

Keep server credentials in the agent where possible. Blackfire's PHP configuration docs specifically recommend avoiding server credentials in shared php.ini unless the deployment really needs per-host or per-vhost credentials.

Trigger Blackfire profiles

For browser-driven profiling:

  1. Install the probe and agent on the target environment.
  2. Install the browser extension.
  3. Visit the real URL.
  4. Trigger a profile.
  5. Open the call graph or timeline.

[IMAGE: Supporting visual 2 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 2]

For APIs, POST requests, or requests with headers, use the CLI:

blackfire curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer test-token' \
  --data '{"sku":"ABC-123","quantity":2}' \
  https://example.com/api/cart/items

For CLI commands:

blackfire run php bin/console app:reprice-catalog --limit=1000

This is useful for:

  • Symfony Console commands
  • Laravel Artisan commands
  • queue worker jobs run as one-off commands
  • import scripts
  • report generation

Do not profile a random endpoint. Profile a known slow transaction with production-like input.

[IMAGE: Supporting visual 2 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 2]

Read a Blackfire callgraph

Blackfire gives you:

  • call graph
  • function and method list
  • inclusive and exclusive cost
  • call counts
  • wall time
  • CPU time
  • I/O time
  • memory
  • network, HTTP, and SQL dimensions
  • timeline view

Start with hot paths, but do not stop there.

Checklist:

  • Sort by exclusive wall time to find expensive leaf work.
  • Sort by call count to find runaway loops.
  • Compare inclusive and exclusive time.
  • Check SQL and HTTP dimensions separately from PHP CPU.
  • Open the timeline when waiting time matters.
  • Compare two profiles before declaring an optimization worked.

Example investigation:

ObservationLikely meaning
High exclusive time in json_encode()large payload or repeated serialization
High inclusive time in controllercontroller calls expensive children; drill down
Large SQL time but low PHP timedatabase problem, not PHP CPU
Many calls to template partialsrendering loop or cache miss
High memory jump in timelinehydration, buffering, or collection growth

Blackfire prunes very small calls to keep profiles readable, so the callgraph is not a byte-for-byte record of every microscopic call. That is usually the right tradeoff for production analysis.

Blackfire regression checks

Blackfire has a strong performance-budget workflow through assertions.

Example .blackfire.yaml:

tests:
  "Checkout stays inside budget":
    path: "/checkout"
    assertions:
      - "main.wall_time < 500ms"
      - "main.memory < 64Mb"
      - "metrics.sql.queries.count < 25"

  "Product page does not fan out":
    path: "/products/.*"
    assertions:
      - "metrics.http.requests.count < 4"
      - "metrics.twig.render.count < 80"

Use assertions for stable paths:

  • checkout summary
  • cart update
  • login
  • product detail
  • API aggregation endpoint
  • background report command

Do not assert tight wall-time budgets on noisy infrastructure. Prefer budgets that catch meaningful regressions:

  • query count doubled
  • HTTP calls appeared
  • memory crossed a safe boundary
  • template renders exploded
  • wall time moved far beyond expected variance

Blackfire operational guardrails

Use Blackfire in production with rules:

  • install the probe and agent through the same image or host automation used for PHP
  • keep Blackfire and Xdebug disabled together unless the docs explicitly support your combination
  • trigger profiles from allowed developers or automation
  • avoid profiling PII-heavy requests unless query and argument collection are understood
  • write assertions for key user journeys
  • compare profiles before and after changes
  • monitor sample overhead separately from profile overhead

[IMAGE: Supporting visual 3 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 3]

Blackfire is a good default when developers need deep, repeatable profile evidence without making every end-user request pay for it.

Tideways: production monitoring plus sampled profiling

Tideways is closer to PHP-specific APM with profiling built in.

The typical setup has:

[IMAGE: Supporting visual 3 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 3]

  • Tideways PHP extension
  • Tideways daemon
  • API key
  • service and environment names
  • trace sample rate
  • optional dynamic tracepoints

Debian/Ubuntu installation uses the Tideways package repository and installs tideways-php plus tideways-daemon.

Global configuration shape:

extension=tideways.so
tideways.api_key=YOUR_API_KEY
tideways.service=app
tideways.trace_sample_rate=25

Docker setup usually runs the daemon as a separate container and points PHP to it:

FROM php:8.4-fpm

ENV TIDEWAYS_APIKEY=replace-at-runtime
ENV TIDEWAYS_SERVICE=app
ENV TIDEWAYS_TRACE_SAMPLE_RATE=25
ENV TIDEWAYS_CONNECTION=tcp://tideways-daemon:9135

COPY --from=ghcr.io/tideways/php:latest /tideways/ /tideways/
RUN docker-php-ext-enable --ini-name tideways.ini "$(php /tideways/get-ext-path.php)"

Do not bake the API key into the image. Inject it at runtime through your orchestrator secret mechanism.

Compose shape:

services:
  php:
    image: registry.example.com/app:2026-03-23
    entrypoint:
      - /bin/sh
      - -lc
      - export TIDEWAYS_APIKEY="$(cat /run/secrets/tideways_api_key)" && exec php-fpm
    environment:
      TIDEWAYS_SERVICE: app
      TIDEWAYS_TRACE_SAMPLE_RATE: "25"
      TIDEWAYS_CONNECTION: tcp://tideways-daemon:9135
    secrets:
      - tideways_api_key

  tideways-daemon:
    image: ghcr.io/tideways/daemon
    command: "--env=production"

secrets:
  tideways_api_key:
    file: ./secrets/tideways_api_key.txt

The entrypoint reads the mounted secret file and exports TIDEWAYS_APIKEY before starting PHP-FPM. Keep the real value out of the image.

Tideways sampling

Tideways uses sampling to control production overhead.

Important distinction:

  • monitoring still records request-level performance and failures
  • the trace sample rate decides how many requests collect detailed trace data
  • tideways.collect=full activates timeline plus callgraph collection

Tideways' own sampling documentation warns that always keeping callgraph traces with tideways.collect=full can add at least 50% overhead and has seen much higher overhead in some cases. It also says full mode is not recommended permanently in production.

Production configuration should usually favor:

tideways.monitor=basic
tideways.collect=tracing
tideways.trace_sample_rate=25

Use full callgraphs through:

  • on-demand profiling
  • dynamic tracepoints
  • scheduled tracepoints
  • short investigation windows

Do not set full callgraph collection globally and forget about it.

Tideways callgraph workflow

Tideways callgraph profiler gives:

  • calls table
  • call count
  • total time
  • self time
  • total memory
  • self memory
  • parent calls
  • child calls
  • slowest code path
  • callgraph view
  • filtering by function, namespace, Composer package, and supported framework grouping

Use the calls table differently from a timeline:

QuestionTideways view
Which function itself is slow?self time
Which function owns expensive children?total time
Which call path leads here?parent calls
Which dependencies fan out below this function?child calls
Which function allocates memory?memory view
Did a transaction get slower after deploy?alert plus trace comparison

[IMAGE: Supporting visual 4 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 4]

For Laravel and Symfony applications, Tideways' framework support is useful because it can name transactions and expose framework layers without requiring every team to manually instrument routing and controllers.

Tideways alerts and regressions

Tideways has alerting closer to operations than a pure profiler.

It can notify on:

  • response time thresholds
  • failure rate thresholds
  • new release comparison against prior release performance
  • new exceptions and fatal errors
  • new slow SQL queries
  • tracepoint completion

[IMAGE: Supporting visual 4 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 4]

Notification integrations include email, Slack, Microsoft Teams, OpsGenie, PagerDuty, and Splunk OnCall.

Use alerts this way:

SignalAction
checkout response time threshold exceededcompare traces before and after deploy
new slow SQL queryinspect query, index, and calling transaction
failure rate threshold exceededcheck exception trace and deploy marker
tracepoint completedinspect collected callgraph while context is fresh
release comparison regresseddecide rollback, feature flag, or focused fix

Tideways is a strong choice when production visibility and alerting are as important as individual deep profiles.

Tideways operational guardrails

Keep the daemon private. Tideways' Docker docs warn that the daemon does not authenticate by itself, so network rules must prevent public access.

Checklist:

  • run a daemon close to the PHP process
  • name services and environments consistently
  • keep sample rate explicit
  • avoid permanent collect=full
  • lock down daemon network access
  • set response time thresholds for important transactions
  • mark releases so regressions can be compared
  • review what data is collected and scrubbed before it leaves your infrastructure

Tideways works best when it is part of production operations, not only a developer debug tool.

SPX: self-hosted profiler for controlled environments

SPX is different.

It is a free PHP extension with a built-in web UI. It supports:

  • web request profiling
  • CLI profiling
  • flat profiles
  • timelines
  • flame graphs
  • multiple metrics such as wall time, CPU time, memory, object count, I/O, and GC counters
  • manual start and stop through spx_profiler_start() and spx_profiler_stop()

Install from PIE:

pie install noisebynorthwest/php-spx

Or from source:

git clone https://github.com/NoiseByNorthwest/php-spx.git
cd php-spx
git checkout release/latest
phpize
./configure
make
sudo make install

[IMAGE: Supporting visual 5 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 5]

Enable:

extension=spx.so

Private local web UI:

spx.http_enabled=1
spx.http_key=dev
spx.http_ip_whitelist=127.0.0.1

Then access:

http://localhost/?SPX_KEY=dev&SPX_UI_URI=/

CLI flat profile:

SPX_ENABLED=1 php bin/console app:import-feed

CLI full report for the web UI:

SPX_ENABLED=1 SPX_REPORT=full php bin/console app:import-feed

Long-running worker span:

<?php

declare(strict_types=1);

final readonly class ProfiledJobRunner
{
    public function run(Job $job): void
    {
        if (function_exists('spx_profiler_start')) {
            spx_profiler_start();
        }

        try {
            $job->handle();
        } finally {
            if (function_exists('spx_profiler_stop')) {
                spx_profiler_stop();
            }
        }
    }
}

Run with automatic start disabled:

SPX_ENABLED=1 SPX_REPORT=full SPX_AUTO_START=0 php bin/worker

This is useful when the worker process lives for hours but one job is slow.

SPX production warning

SPX is not a SaaS. That is useful for privacy and cost.

But the README calls the project experimental and says it can safely be used in a non-production environment. It also has a security section warning that the web UI can expose sensitive application information and that a costly profiling setup can be abused for denial of service.

So treat SPX as:

  • local profiler
  • private staging profiler
  • emergency profiler behind VPN and IP allowlist
  • CLI profiler for controlled commands

[IMAGE: Supporting visual 5 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 5]

Do not treat SPX as:

  • always-on production APM
  • public web profiler
  • alerting platform
  • replacement for Blackfire or Tideways in a high-traffic environment

The README also warns that enabling HTTP profiling at INI level for all requests can quickly exhaust storage on high-traffic systems.

SPX visualization workflow

SPX is strong when you want local visual evidence quickly:

  • timeline to inspect request phases
  • flat profile to sort by inclusive or exclusive cost
  • flame graph to see hot stack shape
  • function highlighting to connect visual spans to call table entries
  • metrics beyond time, including memory and some I/O counters

Use SPX when:

  • a CLI command is slow on staging
  • a local request has a strange memory pattern
  • you need a flame graph without a SaaS account
  • you can isolate the target environment

Avoid SPX when:

  • multiple developers need shared retention and access controls
  • production alerting is required
  • reports must be tied to release markers
  • sensitive reports need a managed security model
  • traffic volume is high

Direct comparison

CapabilityBlackfireTidewaysSPX
Production HTTP profilingTriggered synthetic or allowed requestsSampled traces and tracepointsOnly in strictly private environments
Always-on monitoringYes, through monitoringYes, core use caseNo
CallgraphYesYesFlame graph and report UI, not APM-style managed callgraph
TimelineYesYesYes
CLI profilingYesYes, with extension/API patternsYes
AlertingAssertions, monitoring, recommendations, CI workflowsResponse time, failure, release, exception, SQL, tracepoint alertsNo built-in production alerting
Data hostingBlackfire platformTideways platform after local daemon processingYour infrastructure
Security modelSaaS with controlled profile accessSaaS with daemon-side processing and controlsYour responsibility
Best daily userdeveloper and performance revieweroperations plus backend teamdeveloper diagnosing a controlled target

[IMAGE: Supporting visual 6 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 6]

Which one should you choose?

Choose Blackfire if the main need is:

  • "Profile this exact endpoint safely."
  • "Compare this pull request or deployment against a budget."
  • "Give developers callgraphs and timelines without making all users pay overhead."

Choose Tideways if the main need is:

  • "Tell us when production got slower."
  • "Show which transaction regressed."
  • "Keep sampled traces around real traffic."
  • "Alert operations and developers."

Choose SPX if the main need is:

  • "Give me a free local profiler."
  • "Profile this private staging request."
  • "Show a flame graph for this CLI command."
  • "Keep data off SaaS entirely."

[IMAGE: Supporting visual 6 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 6]

For many teams, the practical setup is:

  • Tideways or Blackfire Monitoring for production visibility.
  • Blackfire for deterministic profiles and CI performance budgets.
  • SPX for local or private staging experiments.

Do not force one tool to solve every profiling problem.

Profiling playbook

Use this sequence when production gets slower:

  1. Confirm with metrics: p95, error rate, memory, queue latency, SQL time.
  2. Identify the transaction, not only the URL.
  3. Compare before and after release if deploy markers exist.
  4. Capture a timeline trace.
  5. Capture a full callgraph only when needed.
  6. Fix one bottleneck.
  7. Re-profile the same request with comparable input.
  8. Add an assertion, alert, or benchmark so the regression is harder to repeat.

Do not start with a full profiler if logs already show the database is saturated. Do not stop at "SQL is slow" if the PHP code creates 2,000 queries.

What to measure

For each important transaction, track:

  • p50, p90, p95, and p99 response time
  • request count
  • failure rate
  • memory maximum
  • SQL count and duration
  • external HTTP call count and duration
  • cache hit rate where available
  • queue job duration
  • template render cost
  • serialization cost

For full profiles, also track:

  • top exclusive wall-time functions
  • top inclusive wall-time functions
  • functions with suspicious call counts
  • callgraph changes after deploy
  • memory jumps in timeline

Data safety

Profiles can contain sensitive hints:

[IMAGE: Supporting visual 7 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 7]

  • URLs
  • route names
  • SQL shapes
  • service hostnames
  • class names
  • function arguments when configured
  • report metadata
  • stack structure
  • business workflow names

Before enabling production profiling:

  • know what arguments are collected
  • redact SQL values where possible
  • restrict profile access
  • set retention rules
  • avoid profiling sensitive admin and payment flows without review
  • protect profiler UI routes and daemon sockets
  • never expose SPX UI to the public internet

Performance tooling is observability infrastructure. Treat it like access to logs, traces, and production dashboards.

Regression guard examples

Blackfire assertion:

tests:
  "API search budget":
    path: "/api/search"
    assertions:
      - "main.wall_time < 350ms"
      - "main.peak_memory < 96Mb"
      - "metrics.sql.queries.count < 10"

Tideways alert policy:

Transaction: CheckoutController::submit
Alert: p95 response time over 800 ms for 10 minutes
Notify: Slack #backend-alerts and PagerDuty primary
Action: compare traces before and after latest release marker

SPX private staging run:

SPX_ENABLED=1 \
SPX_REPORT=full \
SPX_METRICS=wt,ct,zm,io \
php bin/console app:rebuild-search --tenant=demo

The important part is not the exact threshold. It is that each tool feeds a decision:

  • rollback
  • keep deploy
  • add index
  • remove duplicate call
  • lower fan-out
  • cache a stable read
  • split a worker job
  • add a performance test

Common mistakes

Mistake: enabling full callgraph collection permanently.

[IMAGE: Supporting visual 7 for PHP Profiling in Production: Blackfire, Tideways & SPX Compared, showing PHP Profiling in Production: Blackfire, Tideways & SPX Compared decisions, examples, and PHP, Profiling, Blackfire. Alt: PHP Profiling in Production: Blackfire, Tideways & SPX Compared php-profiling-production-blackfire-tideways-spx-compared visual 7]

Fix: sample, trigger, or tracepoint full profiles. Use monitoring for the baseline.

Mistake: comparing a local profile to production latency.

Fix: compare profiles from the same environment and similar input.

Mistake: optimizing the hottest function without checking request impact.

Fix: connect function cost back to transaction p95, request count, and business impact.

Mistake: using SPX on a public production endpoint.

Fix: keep SPX local or behind lower-layer access controls in private staging.

Mistake: writing a performance budget with impossible thresholds.

Fix: start with broad regression budgets and tighten only when variance is known.

Mistake: profiling only happy paths.

Fix: profile expensive real paths: empty cache, large cart, slow provider, high-tenant account, export job.

FAQ

What is PHP Profiling in Production: Blackfire, Tideways & SPX Compared?

PHP Profiling in Production: Blackfire, Tideways & SPX Compared is a practical performance topic that should be evaluated through implementation scope, production risk, testing, documentation, and long-term maintainability.

When should a team use PHP Profiling in Production: Blackfire, Tideways & SPX Compared?

Use PHP Profiling in Production: Blackfire, Tideways & SPX Compared when it solves a real project constraint, improves clarity, or reduces operational risk. Avoid it when it only adds novelty or hides behavior from future maintainers.

What is the biggest risk with PHP Profiling in Production: Blackfire, Tideways & SPX Compared?

The biggest risk is copying a pattern without its context. Production systems need clear boundaries, rollback options, tests, and observability before a technique becomes dependable.

How do you test PHP Profiling in Production: Blackfire, Tideways & SPX Compared?

Test the smallest unit that owns the behavior, then add integration coverage for the path users or systems actually rely on. Include failure cases, configuration differences, and regression checks.

How does PHP Profiling in Production: Blackfire, Tideways & SPX Compared affect SEO and AI search visibility?

It improves visibility when the article gives a direct answer, expert context, structured headings, internal links, trustworthy references, and FAQ content that matches the visible page.

Conclusion

PHP Profiling in Production: Blackfire, Tideways & SPX Compared is worth doing when the implementation improves clarity, reliability, or delivery speed. It is not worth doing when it hides ownership, increases operational risk, or makes the system harder to explain.

Use the framework above as a review checklist. Then connect this topic to the rest of the project documentation so readers can move from concept to implementation without losing context.

Top