Profiling Magento with Blackfire

in Performance

All Hypernodes (except the Magento Start plan) support Blackfire, an amazing tool to find performance bottlenecks in Magento. It is similar to New Relic, but much better suited for troubleshooting.

Byte customers get a 20% discount on the Premium plan. Contact support@hypernode.com for a coupon code.

blackfire toolbar

How to activate Blackfire

Signup for an account. Start with the free version, which includes a wealth of information. In your account tab, you will see this:
blackfireaccount

To connect your Hypernode to Blackfire, login on our service panel and select Instellingen -> Blackfire.
From this page, select Enable, insert your Server ID and Server Token.
Next, save the input by clicking Opslaan and wait a few minutes until the credentials are active on the Hypernode:

How is it different from New Relic?

New Relic is an Application Performance Monitoring utility. It is made to track real traffic, and to provide alerts and a first level of insight to business managers and developers. Analyzing the performance of an application’s code requires to instrument the code, which generates an overhead.

The more precise data is gathered, the slowest the app gets.

Therefore, analyzing all of the traffic makes it impossible to get pin-point information on the code’s resources consumption.

Blackfire works in a very different manner, and is therefore very complementary. End users requests are not instrumented; only the requests triggered by the developer or tool requiring performance information are. Blackfire’s profiling technology thereby provides and unequaled code introspection, and enables developers to understand the behavior of their code and identify optimization possibilities very fast. Blackfire is usable in production, just like New Relic, but provides an even better value-add in development in staging, through the use of performance tests, which proactively validate the code, before any go-live.

For more information, check the Blackfire documentation.

blackfire button

Using Blackfire with varnish

If you want to use varnish in combination with Blackfire, some additional configuration in your VCL is required.
This is quite an expert level change and requires enough experience with varnish to manually edit your VCL.

acl profile {
   "x.y.z.w";
}

sub vcl_recv {
  if (req.http.X-Blackfire-Query && client.ip ~ profile) {
    if (req.esi_level > 0) {
        # ESI request should not be included in the profile.
        # Instead you should profile them separately, each one
        # in their dedicated profile.
        # Removing the Blackfire header avoids to trigger the profiling.
        # Not returning let it go trough your usual workflow as a regular
        # ESI request without distinction.
        unset req.http.X-Blackfire-Query;
    } else {
        return (pass);
    }
  }
}

You can find the extended instructions in the blackfire documentation

0