New greener region discount. Save 3% on Upsun resource usage. Learn how.
LoginFree trial
FeaturesPricingBlogAbout us
Blog

Blackfire: a complete observability solution

performanceBlackfireobservability
10 January 2024
Thomas di Luccio
Thomas di Luccio
DevRel Engineer

Note: Blackfire is the Upsun observability solution included with every PHP and Python project on the Upsun PaaS and powering the continuous profiling of your Go and Node.js applications.

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. 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.

But 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.  

Crafting an observability strategy 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 a monitoring and 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 monitoring and observability solution that lets you build your own strategy and the best part is, it’s available with Upsun. 

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.

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. To make monitoring and observability insights more comprehensive, the profile also provides Recommendations, an 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 PHPUnitBehatSymfony Functional Tests, and Laravel tests. Other integrations could be made thanks to Blackfire PHP and Python SDKs.

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.

Article originally published by Thomas di Luccio on Blackfire.io

Upsun Logo
Join the community