Blackfire, a complete observability solution

By Thomas di Luccio, on Mar 01, 2023

The quest for perfect performance is a never-ending journey. It is not won as soon as that one bottleneck has been patched, even if that might feel like an epic and glorious battle. No, it is an ongoing effort to quickly identify issues and squash them before they spiral out of control,  to keep the performance running as smoothly as possible in the long run.

That raises the question: is perfect performance even possible? Well, perfection in any field isn’t really possible. But you can get very, very close.  

An Observability Strategy: the battle plan for near-perfect performance

Let’s come up with a battle plan! Or better yet, an Observability Strategy. That type of plan is critical for organizations looking to deliver reliable, high-performance software in a fast-paced and constantly changing environment.

Implementing an Observability Strategy allows organizations to take a proactive approach to monitoring their systems, which is a far better tack to take than waiting for problems to arise, then reacting to them.

Blackfire provides a unique and extensive Observability Solution that lets you build your own strategy. By smoothly integrating Blackfire into your daily operations, you are better optimizing your chance of success.

The following are the factors of a possible Observability Strategy you can adopt. If you choose to accept it, your mission is to build a plan that fits your organization as well as your coding and deployment practices.

Blackfire Monitoring

Blackfire Monitoring provides a bird’s-eye view of one application’s performance, including all the HTTP traffic that is monitored out of the box. The CLI one can be instrumented as well with a simple configuration.

Blackfire Monitoring lets you know when and where a specific issue happened so you can react quickly to it. It allows you to drill down to a specific transaction to explore the contribution of the different services used (such as Redis, Database, HTTP, etc.) to the response time.

Discover Blackfire Monitoring in action on demo.blackfire.io.

Blackfire Alerting

As you won’t be sitting all day waiting for a crash to happen, you can set up alerts so you can be notified. Accessing critical information doesn’t have to conflict with your existing workflow. Alerts and cooldowns escalate to any channel you are already using, such as  email, Slack, Microsoft Teams, or other web services.

Blackfire Profiler

Once a diagnosis is made, you can dig as deep as possible into the application behavior with Blackfire Profiler until you locate the exact function or service calls that are responsible for the performance issue. Blackfire Profiler also lets you understand why your application behaves a certain way.

All your SQL queries and HTTP calls are identified and listed alongside the call graphs and timeline views. The profile also provides Recommendations, a list of actionable insights, and detailed information about the cache usage and configuration.

Blackfire Tests suite

Once the code of a script is optimized, a good practice is to compare the before and after profiles to ensure our fix doesn’t cause any side effects. 

There’s one more thing to do before pushing to production: writing tests.

Blackfire provides an extensive test suite. Custom assertions are defined in a .blackfire.yaml file, and they are evaluated every time a profile is triggered. This eases the detection of performance regressions.

There are also integrations with PHPUnit, Behat, Symfony Functional Tests, and Laravel tests. Other integrations could be made thanks to Blackfire PHP and Python SDKs.

Discover the Blackfire tests suite by reading the dedicated series of blog posts starting with part one

Synthetic monitoring

The performance of your applications’ critical user journeys can also be evaluated regularly. Those user journeys, as well as the expectations for each of them, can be described in Scenarios.

When evaluating, a profile is triggered at every step of every scenario. As for all profiles, the assertions matching the requests are evaluated. A Build Report is the aggregated results of all those profiles.

A Build Report is a convenient tool for checking the health of large parts of an application at once. Blackfire Builds can be triggered manually, periodically, and through webhooks.

We cannot recommend you enough to plug the latest generation of Blackfire Build into your CI/CD pipelines. Such integrations prevent a pull request from being merged or code from being deployed into production if it degrades the performance of your application. It ensures the performance of your applications in the long run.

Then, automated and periodic performance tests plugged into the CI/CD pipelines safeguard the application preventing performance degradations.

Tell us your battle plans!

What about you? What are your own Observability Strategies? Tell us all about your battle plan by continuing the discussion on Reddit or Twitter.

Happy Performance Optimization!

Thomas di Luccio

Thomas is a Developer Relations Engineer at Platform.sh for Blackfire.io. He likes nothing more than understanding the users' needs and helping them find practical and empowering solutions. He’ll support you as a day-to-day user.