WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.196 --> 00:00:04.426 align:middle
So let's get Blackfire installed
on our local computer.

00:00:05.046 --> 00:00:09.706 align:middle
Head over to https://blackfire.io and
log in or register for a new account.

00:00:13.676 --> 00:00:17.246 align:middle
As you can see, I've been
busy using Blackfire already.

00:00:18.166 --> 00:00:19.546 align:middle
Click the Docs link on top...

00:00:19.756 --> 00:00:21.746 align:middle
then installation on the left.

00:00:23.116 --> 00:00:28.996 align:middle
Before we jump in and install everything,
I want you to understand just a little bit

00:00:28.996 --> 00:00:33.676 align:middle
about how this all works:
understanding this helped me a bunch.

00:00:34.646 --> 00:00:38.856 align:middle
If you want to skip this and
head to the next video you can...

00:00:39.136 --> 00:00:42.466 align:middle
just prepare to miss out on some cool diagrams!

00:00:43.186 --> 00:00:46.786 align:middle
Click the "main components of Blackfire"
link and scroll down to find...

00:00:47.216 --> 00:00:53.016 align:middle
woh! A diagram that shows you
exactly how Blackfire works.

00:00:53.736 --> 00:00:54.746 align:middle
How about...

00:00:54.746 --> 00:00:57.386 align:middle
we look at a simplified version.

00:00:58.116 --> 00:01:00.206 align:middle
There are 3 things we need to install.

00:01:00.536 --> 00:01:05.216 align:middle
The first is called the "probe",
which is really just a PHP extension.

00:01:05.776 --> 00:01:08.826 align:middle
You'll install this wherever
your code is running -

00:01:09.336 --> 00:01:12.256 align:middle
like on your local machine,
and later on production.

00:01:13.056 --> 00:01:15.986 align:middle
The probe's job is simple, but huge!

00:01:16.516 --> 00:01:21.466 align:middle
It's responsible for collecting all of
the information: all the function calls,

00:01:21.826 --> 00:01:25.526 align:middle
how long each took, which function
called which other function,

00:01:25.666 --> 00:01:28.936 align:middle
how much memory did something
take, network requests...

00:01:29.126 --> 00:01:30.166 align:middle
you get the idea.

00:01:31.036 --> 00:01:37.486 align:middle
By the way, the process of "collecting all the
data" is sometimes called instrumentation...

00:01:37.816 --> 00:01:42.066 align:middle
which I only mention so that
if you see this fancy word...

00:01:42.326 --> 00:01:44.376 align:middle
it hopefully won't confuse you...

00:01:44.686 --> 00:01:45.686 align:middle
it confused me.

00:01:46.696 --> 00:01:50.426 align:middle
The second thing we will need to
install is called the "agent".

00:01:50.906 --> 00:01:57.746 align:middle
This is a service - or "daemon" - that runs on
your computer - or on your production machine.

00:01:58.346 --> 00:02:00.826 align:middle
It... just sits there and waits.

00:02:01.736 --> 00:02:04.136 align:middle
When the PHP extension - the probe -

00:02:04.406 --> 00:02:08.756 align:middle
finishes collecting all the data,
it sends that data to the agent.

00:02:09.406 --> 00:02:13.986 align:middle
The agent does some processing on it -
like removing unimportant information

00:02:14.036 --> 00:02:19.086 align:middle
and anonymizing things - then ultimately
sends that data to the Blackfire server.

00:02:19.886 --> 00:02:21.196 align:middle
It's... the middleman.

00:02:21.846 --> 00:02:27.226 align:middle
So basically, the probe and agent work together
to collect the info and send it to Blackfire.

00:02:28.226 --> 00:02:32.106 align:middle
The last piece you'll need to
install is a browser extension.

00:02:32.786 --> 00:02:37.646 align:middle
Remember: the probe is not
profiling every single request.

00:02:38.576 --> 00:02:42.146 align:middle
Normally, when a request comes in, it yawns...

00:02:42.146 --> 00:02:43.356 align:middle
and does nothing.

00:02:44.116 --> 00:02:47.586 align:middle
The browser extension's job
is to activate profiling.

00:02:48.286 --> 00:02:50.396 align:middle
It basically says: Hey probe!

00:02:50.616 --> 00:02:55.836 align:middle
Wake up! I'm going to make a request and
I actually want you to do your thing -

00:02:56.346 --> 00:02:58.706 align:middle
collect all the data and sent it to the agent.

00:02:59.156 --> 00:03:00.786 align:middle
Cool? Text me when it's done.

00:03:01.446 --> 00:03:02.936 align:middle
And... that's it!

00:03:03.646 --> 00:03:09.986 align:middle
This bottleneck-fighting superhero trio
is our ticket to performance glory.

00:03:10.816 --> 00:03:12.826 align:middle
Next, let's get them installed.

