Vienna PHP meetup – Blackfire talk

By Emir Beganović, on May 03, 2018

Note from the Blackfire team: This blog post as been written by Emir Beganović, an active community member and speaker at PHP meetups. He reached out to us for some support on making a great meetup talk about Blackfire. Want to do the same? Get in touch with us!

Getting in the mood for making a Blackfire talk

As an active participant in local user group meetups, I wanted to use my knowledge of PHP development and almost a decade of professional experience and make an impact in my local area. Luckily, that went pretty good, so I want to share this small success story with you.

I was using Blackfire for over a year at my workplace. It has invaluably helped my overall team to inspect and resolve some of the performance issues we’ve had, and also made us learn valuable lessons in performance optimization. Now it was time to pass on that knowledge: I decided to apply for the next Vienna PHP meetup held in April, and hold a bit longer talk about Blackfire. I wanted to go an extra step for the purpose of this talk, to pass on the passion on the whole topic to other attendants and talk about a topic that has had positive impact on me.

Knowing that people behind Blackfire are the same core Symfony contributors working (in)directly for SensioLabs, I realised out there is a great chance to receive a nice response from the other side. So, I tried my luck and approached them via e-mail, asking if there is a possibility for collaboration.

Luckily, my request was well received by Christophe Dujarric, Chief Product Officer. We managed to agree on some nice benefits: special 20% coupon code to distribute during the event, granting a discount on any Profiler or Premium subscription. Furthermore, he offered to send me some hard copies of 24 days of  Blackfire, as well as some buttons/flyers/badges. That meant a lot to me as I realized that the full potential of the talk is not just in those attendants, but in everyone they knew, everyone who’d see their books, their stickers, and ask them where and how they got it. For me, it meant that more people would come to the meetup and most importantly, broader and better knowledge could be shared, and at least that cooler people would join for a drink! 🙂

A couple of days later, this nice thing came in:

Preparing my talk

During the course of April, I spent some time preparing the actual talk, and then preparing some assisting slides.

I figured out not much would be needed to be presented on the slides, as I wanted to do a real-world example app profiling and inspection. I decided on the topic: Profiling and inspection with Boris, the meetup organizer, gave me 45 minutes to do the talk.

Soon, description was prepared and sent out to Meetup members:

Wise men said that “premature optimisation is the root of all evil”.

On the other hand, as soon as your project takes off and matures, and you start seeing performance issues here and there: slow algorithm, excessive duplicated calls to some internal functions, loops iterating more than necessary…you hit a wall. Your CPU usage inexplicably tops 100% on Sunday afternoon.

You put on your detective hat and pipe and decide to do your best to reduce the complexity of that unoptimized loop!

However, there are tools that you wouldn’t think of using. Let’s improve that, and make those tools a part of your workflow. The tools that can help you be more efficient in your hunt.

We will do some brief live coding and benchmarking to investigate our messy code and turn it into a performant beauty.

As a helpful assistant, we will use, a SensioLabs product, to debug and inspect our code, optimize it and ensure it’s consistent performance.

In the end, all meetup attendants will get special discount codes, stickers, and some promo material!

The meetup

I decided to take roughly half of the allowed talk duration to show off an example, plain out of the box Symfony 3.4 app, doing an API call to (HTTP testing service), and then caching that call results in Redis. The actual cache addition would help reduce the response time, which I would then compare with the first profile.

We went into details on how the probe works and how easy is it to use it in conjunction with curl.

The other, first half of the presentation, I dedicated to introducing most of the meetup attendants to the importance of thinking about performance in day-to-day work and how it can be treated seriously like unit tests. I explained Blackfire is not just a profiler or a fancy tool around microtime, it’s rather a powerful profiler that can be used to write tests and scenarios, and also be used in CI but in production as well.

When the meetup day came, I was feeling positive and ready for the talk. I delivered the promo material and filled my laptop’s battery.

Yes, that’s me intentionally in a French-flag-themed T-Shirt. 🙂

There were a couple of nice questions in the end:

  • how often do you profile – each CI build, daily, or time to time?
  • do you run Blackfire in production? Does it incur any performance penalty? (this was also explained in depth)
  • how does Blackfire know that a request should be profiled – what is the request signing technique between the probe and server?
  • have you considered XDebug profiler (cachegrind outputs, uploadable to Blackfire) – &
  • how do you account for false alarms in CI due to overutilized underlying shared hardware, for example in Travis?

After the presentation, I was glad to see that I was able to communicate the topic fully to all the attendants and to still make the topic interesting for everyone to go and research on their own afterward. My goal was reached – I was able to speak about a tool I like to use and which helps me directly in my work, and I was able to spread that feeling to others.

Last but not the least, a nice friendship was made, and I’m glad that it turned out to be rather straightforward to talk to SensioLabs folks. They’re not corporate styled yet 🙂

And to all of you out there wondering if your voice will be heard, and if you crazy ideas will just stay ideas or turn into realizations: trust your gut feeling and just go ahead, you can make an impact!

Emir Beganović

Long-time open source contributor, Zend-certified software developer specialized in high-traffic enterprise PHP applications and websites, with almost 10 years of professional experience. Dedicated most of the recent career on large marketplaces. Currently a backend developer at Shpock, a flea market app popular in Europe. Continuous improvement seeker, with focus on performant and clean code, enjoys API development and quality refactoring.