WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:00.076 --> 00:00:01.696 align:middle
Hey friends!

00:00:03.206 --> 00:00:11.726 align:middle
Welcome to the fastest, most performant
SymfonyCasts tutorial of all time, on Blackfire.

00:00:12.326 --> 00:00:14.146 align:middle
The end. What?

00:00:14.476 --> 00:00:15.946 align:middle
We should say a bit more?

00:00:16.606 --> 00:00:23.226 align:middle
Uh, Blackfire is all about having fun while you
discover ways to make your site absurdly fast.

00:00:23.846 --> 00:00:28.686 align:middle
We're going to see big graphs,
numbers, statistics, animated gifs,

00:00:28.906 --> 00:00:34.946 align:middle
and watch all those numbers decrease as we hunt
down and eliminate performance bottlenecks.

00:00:35.846 --> 00:00:37.376 align:middle
This stuff is just fun.

00:00:37.666 --> 00:00:40.156 align:middle
And who doesn't want a faster site?

00:00:40.686 --> 00:00:41.666 align:middle
But... ok...

00:00:41.946 --> 00:00:46.496 align:middle
just "being fun" probably isn't a
good enough reason to use Blackfire.

00:00:47.336 --> 00:00:50.406 align:middle
If you're trying to "sell"
using a tool to your team...

00:00:50.526 --> 00:00:53.686 align:middle
or management, the real reason is profit.

00:00:54.246 --> 00:00:55.646 align:middle
Performance is money.

00:00:56.186 --> 00:01:00.226 align:middle
Heck, Google even has a page that
will measure the speed of your site

00:01:00.696 --> 00:01:03.236 align:middle
and tell you how much revenue you can gain

00:01:03.406 --> 00:01:07.606 align:middle
by de creasing the rendering time
of your site by various amounts.

00:01:08.356 --> 00:01:11.226 align:middle
On the flip side, I'm sure
you've heard the famous saying:

00:01:11.706 --> 00:01:16.776 align:middle
Premature optimization is the root of
all evil I thought it was Nickelback.

00:01:17.466 --> 00:01:18.446 align:middle
If that's true...

00:01:18.846 --> 00:01:20.926 align:middle
doesn't a having a cool profiling tool

00:01:20.926 --> 00:01:25.276 align:middle
like Blackfire make you think
more about prematurely optimizing?

00:01:25.896 --> 00:01:30.546 align:middle
Actually, it's the opposite: it
let's us focus on creating features

00:01:30.836 --> 00:01:34.606 align:middle
and then noticing performance
problems if there are any.

00:01:35.246 --> 00:01:38.936 align:middle
By the way, your site's performance
is really three things put together.

00:01:39.506 --> 00:01:42.486 align:middle
First, the time it takes your
server to build the page.

00:01:42.906 --> 00:01:46.606 align:middle
Second, the time it takes to
transmit that data over the network.

00:01:46.816 --> 00:01:51.876 align:middle
And third, the time it takes for the
browser to display stuff - the frontend.

00:01:51.876 --> 00:01:56.836 align:middle
You should focus on all of these, but the
main parts are the server and frontend.

00:01:57.456 --> 00:02:00.726 align:middle
Your browser has tools to understand
and optimize your frontend.

00:02:01.246 --> 00:02:03.476 align:middle
Blackfire helps optimize your backend.

00:02:04.086 --> 00:02:07.436 align:middle
But it's not the only way to
monitor performance on your server.

00:02:08.036 --> 00:02:10.816 align:middle
The most well-known way is by using an

00:02:10.816 --> 00:02:14.916 align:middle
"application performance
monitoring tool" - or APM...

00:02:15.526 --> 00:02:21.256 align:middle
which is an acronym I had to look up about 10
times before I could remember what it meant!

00:02:21.256 --> 00:02:26.016 align:middle
An APM is something that runs on your
servers all the time, collecting information

00:02:26.016 --> 00:02:30.566 align:middle
about load times, slow queries,
slow functions, errors and more.

00:02:31.096 --> 00:02:35.706 align:middle
The most famous one is probably
NewRelic, though Blackfire is planning

00:02:35.706 --> 00:02:37.496 align:middle
to release their own sometime soon.

00:02:38.386 --> 00:02:41.576 align:middle
The great thing about an
APM is that you can see data

00:02:41.626 --> 00:02:44.376 align:middle
from every request on your production servers.

00:02:45.106 --> 00:02:49.186 align:middle
The bad part is that, because
an APM is always running,

00:02:49.526 --> 00:02:53.236 align:middle
it needs to collect data
without slowing down the page.

00:02:53.786 --> 00:02:58.146 align:middle
If it tries to collect too much, it
would become the performance bottleneck!

00:02:58.746 --> 00:03:00.806 align:middle
Blackfire is a profiler.

00:03:01.446 --> 00:03:06.736 align:middle
The big difference is that, instead of running
on every single request that our users make...

00:03:07.056 --> 00:03:13.386 align:middle
and needing to stay very lightweight, Blackfire
only profiles a page when you tell it to.

00:03:14.136 --> 00:03:19.776 align:middle
It then makes its own request to the
page and collects an incredible amount

00:03:19.776 --> 00:03:22.156 align:middle
of extremely detailed information.

00:03:23.056 --> 00:03:26.366 align:middle
This process totally slows
down that page load...

00:03:26.616 --> 00:03:30.906 align:middle
which is fine, because there's not a
real user waiting for it to return.

00:03:31.846 --> 00:03:35.806 align:middle
The point is: use an APM and a profiler.

00:03:36.406 --> 00:03:40.206 align:middle
The APM will give you a constant
stream of information from production.

00:03:40.826 --> 00:03:44.036 align:middle
The profiler will give you
the deep information you need

00:03:44.296 --> 00:03:46.966 align:middle
when debugging performance on specific pages.

00:03:48.156 --> 00:03:49.736 align:middle
Ok, enough chat!

00:03:50.036 --> 00:03:51.196 align:middle
Let's do this!

00:03:52.016 --> 00:03:55.786 align:middle
To remove any bottlenecks and
maximize your learning performance,

00:03:55.946 --> 00:03:58.386 align:middle
you should totally code along with me.

00:03:59.196 --> 00:04:01.166 align:middle
Download the course code from this page.

00:04:02.016 --> 00:04:06.656 align:middle
When you unzip it, you'll find a start/
directory with the same code that you see here.

00:04:07.366 --> 00:04:10.716 align:middle
Follow the README.md file
for all the setup details.

00:04:11.506 --> 00:04:17.776 align:middle
This is a Symfony project - but that won't
matter much: we'll mostly focus on understanding

00:04:17.776 --> 00:04:19.336 align:middle
and getting the most out of Blackfire.

00:04:20.266 --> 00:04:25.086 align:middle
The last setup step in the README will be
to open a terminal, move into the project,

00:04:25.296 --> 00:04:29.086 align:middle
use the Symfony binary to start
a local web server by typing:

00:04:29.266 --> 00:04:33.686 align:middle
symfony serve Ok, let's see the site!

00:04:34.316 --> 00:04:37.936 align:middle
Find your browser and head
to https://localhost:8000.

00:04:38.626 --> 00:04:42.006 align:middle
Now you understand how important
this project is.

00:04:42.386 --> 00:04:47.156 align:middle
The world has been looking for Big
Foot, or "Sasquatch", for years.

00:04:47.706 --> 00:04:50.596 align:middle
Thanks to the Big-Foot fanatic
community on our site -

00:04:50.796 --> 00:04:54.146 align:middle
"Sasquatch Sightings" - we're closer than ever.

00:04:55.146 --> 00:05:00.346 align:middle
In our case, better performance doesn't
mean more profit, it means, more big foot.

00:05:01.066 --> 00:05:03.966 align:middle
Do... I know where the performance problems are?

00:05:04.526 --> 00:05:05.696 align:middle
Nope. No idea.

00:05:06.446 --> 00:05:11.866 align:middle
Honestly, I was too focused on getting this
site to production to obsess over performance.

00:05:12.216 --> 00:05:14.546 align:middle
And... I feel great about that!

00:05:15.036 --> 00:05:19.856 align:middle
We'll use Blackfire to find the
bottlenecks - if any - and Sasquash them!

00:05:20.776 --> 00:05:25.956 align:middle
Next, let's get Blackfire installed on my local
machine and start profiling this local website.

00:05:26.646 --> 00:05:31.496 align:middle
And yes, you can use Blackfire on
production - which is awesome -

00:05:31.646 --> 00:05:33.926 align:middle
and something we'll do later in the tutorial.

