BRISTOL JS MEASURING PERFORMANCE WITH
SERVER TIMING @drewm
Slide 2
LET’S TALK PERFORMANCE.
Slide 3
Slide 4
Slide 5
TTFB: WAITING FOR YOUR SERVER
Slide 6
MEASURING PERFORMANCE WITH SERVER TIMING
WHAT CREATES THE DELAY? ▸ Database calls / slow queries ▸ Templating ▸ Synchronous API interactions ▸ Cold cache hits ▸ Bottlenecked operations of any kind ▸ Stupid stuff like sending emails, resizing images, rainbow painting
Slide 7
WE NEED TO DISCOVER WHAT’S CAUSING THE DELAY.
Slide 8
SERVER MONITORING TOOLS
Slide 9
WOULDN’T IT BE GREAT IF WE COULD PUT THAT INFO HERE
Slide 10
GOOD NEWS MY FRIENDS.
Slide 11
SERVER TIMING https://www.w3.org/TR/server-timing/
Slide 12
MEASURING PERFORMANCE WITH SERVER TIMING
WHAT IS SERVER TIMING? ▸ W3C Specification ▸ HTTP response header ▸ Sends basic timing information from server to client ▸ That’s it.
Slide 13
A thing called db had a duration of 123 milliseconds.
Server-Timing: db;dur=123, tmpl;dur=56
A thing called tmpl had a duration of 56 milliseconds.
Slide 14
💯
Slide 15
1
2
3
Server-Timing: metric, metric, metric
Slide 16
MEASURING PERFORMANCE WITH SERVER TIMING
EACH METRIC HAS THREE POSSIBLE PROPERTIES 1.
A short name for the metric (such as db in our example)
2.
A duration in milliseconds (expressed as dur=123)
3.
A description (expressed as desc=“My Description”)
Each property is separated with a semicolon as the delimiter.
Slide 17
Description
Name
db;dur=123;desc=“Database”
Duration
MEASURING PERFORMANCE WITH SERVER TIMING
CONSIDERATIONS ▸ Keep names and descriptions short-ish ▸ Don’t expose anything secret or sensitive ▸ Have some way to enable / disable timing code in your app
Slide 34
IT’S GOOD. Search developer.mozilla.org for “server timing”