Optimize Magento 2 Performance with BlackFire

Optimization for a Magento 2 site is critical for improving sales or conversions. Any area of a Magento site that loads slowly will correlate to a drop-off in visitors, and ultimately a drop in revenue. Magento 2 is a complex eCommerce engine, so sometimes it can be difficult to pin down where problem areas are. Is a single page loading too many blocks? Is a template file loading too much data for a single product page view? Knowing exactly where a bottleneck is makes it that much easier for your web developer to deploy improvements.

There are server configurations that can help, usually these are in the form of cache (a storage location with very short access time used for frequently / recently used instructions & data). Cache tools like Redis, Varnish, etc. will be able to speed up your site, but they can only do so much. If there are problem functions in custom code or 3rd party extensions, these can still cause loads to be much slower than desired.

The same can be said for other optimizations, like JavaScript / CSS minification, server compression, image optimization, and other common front-end speed increasing techniques. If a product query function is unoptimized and taking 10 seconds to complete, it won’t matter how small your JavaScript files are. The server will still have to chug through the unoptimized function.

Magento & BlackFire

BlackFire is a powerful performance / profiling tool that we use in our client’s Magento environments to find performance bottlenecks and to facilitate testing and continuous code improvement. BlackFire provides a variety of metrics that can help your developers speed up and identify problem areas in your Magento installation. These metrics include wall time (i.e., the speed in which a function runs), I/O time, CPU time, memory consumption, query speed, and others. Basically, these metrics are extremely granular, and wouldn’t be possible to measure without a tool like BlackFire.

The granularity extends to a function by function basis, so you can determine the exact function in an extension or template that is taking too long to process. This makes it easy to diagnose the site page by page, removing the need for ‘educated guessing’. This helps diagnosing a site as large and complex as a Magento 2 installation much, much faster.

BlackFire Scenarios

BlackFire runs automated tests that you schedule how and when they are run. For example, on Magento Cloud, when you push code to the cloud environment, BlackFire automatically runs the scenario tests that you define and include in your file-system.

BlackFire scenarios and tests are setup in a yml file. It looks a little something like:

tests:
Pages should be fast enough:
path: /.*
assertions:
- main.wall_time < 850ms
- main.io < 500ms
- main.cpu_time < 500ms

scenarios:
Home:
- /
Cart:
- /checkout/cart/

The structure of the yml file is pretty simple. First, define your tests. There is a lot of documentation here, but your developers will be able to define the tests that should be run. The default tests that come with Magento Cloud BlackFire setup that are a good starting point.

The second set of configurations are the scenarios (or URLs, basically) that you want to automate all the tests for. BlackFire will run all tests at every scenario you list. This can let you get tons and tons of data from a huge variety of URLs.

BlackFire for Chrome

Another cool feature of BlackFire is it’s Chrome extension. It can let you ‘at a glance’ get performance data while you browse around your Magento site. Visit the Chrome extension store and install BlackFire for Chrome. Once enabled you can browse to any URL on your site you would like to profile. Create a reference profile, then click the ‘Profile’ button. Within a few seconds you will have a Call Graph or Comparison Graph to view and see the results.

Take Control of your Magento Performance

BlackFire can help demystify your Magento 2 installation and provide real data for you and your developers to improve performance. Your reward will ultimately be a better shopping experience for your customers, and real improvements for your bottom line.

Leave a Comment


Work With Us

We've been building websites for over twenty years, and have learned a thing or two about how to make web projects go smoothly.

What Our Clients Say

Watermelon Web Works, LLC place picture
4.7
Based on 19 reviews
powered by Google
OMS Anita profile picture
OMS Anita
22:20 29 Nov 24
Watermelon Web Works has been incredible to work with. They are patient, understanding, and quick to answer any questions (or emergencies) you might have. After switching over to them to help re-vamp our online retail store, we hired them to build our wholesale website as well. I can't recommend them enough - Thank you team!
Garrett Lister profile picture
Garrett Lister
19:55 10 Jul 24
Jared and the watermelon team were great - they quickly interpreted our website needs and designed a wonderful site. The project management site worked great to keep track of project.
N B profile picture
N B
21:23 14 Nov 23
My previous web developer who I was very happy with retired and I was pretty sad about it because it seems now days it is hard to hire a web developer close by with a good set of skills who is interested in helping small business at reasonable prices. Then I found Watermelon and I have been very happy. They are responsive, are able to solve problems, and work at reasonable prices.
Dark Star Magick profile picture
Dark Star Magick
18:05 03 May 23
We hired Watermelon to help us with our website. They were very thorough and took the time to explain in layman's terms what they were doing and how we could improve SEO and site functionality. We will definitely be back for future website needs!
Astoria Column profile picture
Astoria Column
18:42 24 Apr 23
Great work and amazing service! We're a non-profit, and our priorities are always focused on maintaining the Astoria Column. We had a website built by someone else a few years ago, but without regular updating and maintenance, sections of our site were no longer functional. Joanna and the rest of the team came in and had everything working within a week and it's been smooth sailing since then!
Ben Harris profile picture
Ben Harris
19:25 26 Aug 19
Watermelon has been a fantastic web development partner. Through every phase of our project they have always been 100% responsive to our requests and have always provided highly knowledgeable, creative, prompt, and personable team members to work with. As a financial institution we’re always concerned about the security and maintenance or our website and Watermelon has always provided the appropriate resources in order to meet and/or exceed our compliance and security requirements. We would surely refer them to any business associates looking for a qualified WordPress web designer in the future. – Denali Federal Credit Union
Mohr IP Law Attorneys profile picture
Mohr IP Law Attorneys
00:33 11 Apr 19
Watermelon Web Works did a great job creating a custom shopping cart page for our firm. Gavynn in particular was especially helpful and responsive. We appreciated the upfront costs and the technical competency of Watermelon Web Works and would not hesitate to work with the people there again.
Kim Markle profile picture
Kim Markle
23:36 08 Feb 19
Our company has been working with the Watermelon team for more than 10 years to help build and grow our website and customer portal. They are not only extremely talented and responsive, but are continuously looking for ways for us to enhance our current website. They are consistent, provide excellent customer service and really know what they are doing. Highly recommend!
Rick Brodner profile picture
Rick Brodner
23:23 12 May 17
I cannot say enough good things about Watermelon. They are terrific communicators, highly competent coders, and really, really nice people. They were instrumental in helping us to assemble a very usable, easily maintainable website for our organization. They' have demonstrated great flexibility in accommodating our evolving needs. They have been highly responsive to any technical issues, typically resolving them in less than 4 hours. Watermelon Web Works will make your organization better, and your CFO/Treasurer will be happy when they see the bill - what more can you ask for?
CLOSE