WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.196 --> 00:00:05.386 align:middle
Often, your production server will
have different - hopefully bigger -

00:00:05.546 --> 00:00:07.516 align:middle
hardware than your staging server...

00:00:07.806 --> 00:00:11.616 align:middle
which means that your staging builds
may run slower than production.

00:00:12.216 --> 00:00:15.766 align:middle
That's going to be a problem
if you have time based metrics:

00:00:16.116 --> 00:00:21.346 align:middle
the wall time of a build may be
less than 100ms on production...

00:00:21.686 --> 00:00:23.836 align:middle
but more than that on staging.

00:00:24.456 --> 00:00:27.506 align:middle
That means the staging builds will always fail.

00:00:28.086 --> 00:00:29.556 align:middle
Bummer! No worries.

00:00:29.906 --> 00:00:33.386 align:middle
To help, each environment can define variables.

00:00:33.996 --> 00:00:40.496 align:middle
Check it out: inside the metric expression,
I'll add a set of parentheses around the 100ms

00:00:40.496 --> 00:00:44.456 align:middle
and then say times and call a var() function.

00:00:45.336 --> 00:00:49.956 align:middle
I'll invent a new variable: speed_coefficient

00:00:50.526 --> 00:00:55.186 align:middle
and give it a default value -
via the 2nd argument - of 1.

00:00:56.466 --> 00:01:02.316 align:middle
Now, when this assertion is executed, it
will assert that the wall time is less

00:01:02.466 --> 00:01:08.196 align:middle
than 100ms times whatever this
speed_coefficient variable is.

00:01:08.776 --> 00:01:10.906 align:middle
What is speed_coefficient?

00:01:11.396 --> 00:01:17.296 align:middle
It's totally something I just made
up and it is not set anywhere.

00:01:18.116 --> 00:01:19.896 align:middle
Where do we set it?

00:01:19.896 --> 00:01:21.926 align:middle
Inside our Blackfire environment!

00:01:23.006 --> 00:01:26.306 align:middle
Copy the variable name and go
into the Non-Master environment.

00:01:27.586 --> 00:01:32.606 align:middle
On the right, near the bottom, click
the pencil icon to edit our variables.

00:01:33.546 --> 00:01:35.106 align:middle
Add the variable set to...

00:01:35.486 --> 00:01:40.986 align:middle
how about 2: that will allow the
staging server to be twice as slow.

00:01:42.046 --> 00:01:46.166 align:middle
Do we also need to set this inside
the "Production" environment?

00:01:46.956 --> 00:01:50.516 align:middle
Nope: I'll just let it use
the default value of 1.

00:01:51.596 --> 00:01:52.166 align:middle
Let's try it!

00:01:52.866 --> 00:01:55.786 align:middle
Spin back over to your terminal,
add the change...

00:01:56.186 --> 00:02:02.746 align:middle
and commit: As a reminder, we're
on the some_feature branch.

00:02:03.606 --> 00:02:10.676 align:middle
So when we run: symfony deploy -- bypass-checks
We're deploying to that environment.

00:02:14.936 --> 00:02:16.186 align:middle
When that finishes...

00:02:16.576 --> 00:02:21.006 align:middle
move back over to the Blackfire
environment, refresh and...

00:02:22.376 --> 00:02:23.906 align:middle
hello new build!

00:02:24.766 --> 00:02:25.506 align:middle
Look inside.

00:02:27.376 --> 00:02:28.916 align:middle
There are two cool things.

00:02:29.736 --> 00:02:35.016 align:middle
First, under the homepage, you can
see the speed_coefficient in action -

00:02:35.366 --> 00:02:38.516 align:middle
the little "2" tells us the value it's using.

00:02:39.066 --> 00:02:47.036 align:middle
So, in reality, it's asserting that
50.8ms is less than 200 milliseconds.

00:02:47.836 --> 00:02:53.066 align:middle
The other thing I want you to notice is
that, if you go back to the builds page,

00:02:53.416 --> 00:02:57.356 align:middle
we have now built the some_feature branch twice.

00:02:58.016 --> 00:03:02.926 align:middle
When you click on the second, newer
build, it has the comparison stuff!

00:03:03.526 --> 00:03:09.916 align:middle
It allows us to compare this build to
the previous commit on the same branch.

00:03:10.746 --> 00:03:16.966 align:middle
This allows you to see - commit-by-commit - when
a feature started having performance problems.

00:03:17.506 --> 00:03:20.326 align:middle
And... that's it for the Blackfire tutorial!

00:03:20.986 --> 00:03:26.806 align:middle
I hope you loved this nerdy trip into the
depths of performance as much as I did.

00:03:27.436 --> 00:03:30.376 align:middle
Blackfire can give you a
lot of info immediately...

00:03:30.756 --> 00:03:33.576 align:middle
or you can really dive in and make it sing.

00:03:34.526 --> 00:03:39.496 align:middle
Personally, I love having the builds and this
performance history for SymfonyCasts.com.

00:03:40.136 --> 00:03:44.556 align:middle
Oh, and a special thanks
to Jérôme Vieilledent -

00:03:44.906 --> 00:03:47.596 align:middle
I almost definitely just slaughtered his name -

00:03:47.866 --> 00:03:52.226 align:middle
for his endless patience answering
my hundreds of Blackfire questions.

00:03:53.066 --> 00:03:56.216 align:middle
And as always, if you have any questions...

00:03:56.426 --> 00:03:59.496 align:middle
or we didn't explain something
you wanted to know about...

00:03:59.756 --> 00:04:01.426 align:middle
or you want a cake recipe...

00:04:01.986 --> 00:04:03.496 align:middle
we're here for you in the comments.

00:04:04.296 --> 00:04:09.176 align:middle
If you have any serious performance
wins, we would love to hear about them.

00:04:10.146 --> 00:04:12.546 align:middle
Alright friends - I wish you a speedy day!

00:04:13.006 --> 00:04:13.726 align:middle
Seeya next time!

