Macht Schnell The Dark Side of the Performance Moon



Macht Schnell The Dark Side of the Performance Moon

0 1


the-dark-side-of-the-performance-moon


On Github ajacksified / the-dark-side-of-the-performance-moon

Macht Schnell The Dark Side of the Performance Moon

Performance Golden Rule

Make Less Requests for Smaller Content

  • Global styles, not per-page styles
  • Lazy-load images
  • Lazy-load javascript
  • Concatenate css, javacsript
  • Load using sharded, cookieless domains
IN THE CLOUDHIGH LATENCY, PACKET LOSS, SLOW BROWSERS, DEEP PACKET INSPECTION, OLD COMPUTERS, 3G NETWORKS, SLOW REQUESTS

The Speed of Light

299,792,458 m / s

From EC2 in Virginia

  • 15ms to San Francisco
  • 37ms to Beijing

But Wait, I Don't Have a Cable From VA to My Computer

Oh. Right.

Packet Loss

Another round-trip if anything is corrupted along the way

distance * speed of light gives us two things to change

Lower the distance

Increase the speed of light

Wormholes

Are Prohibitively Expensive

Move The Content Closer

(Edge Caching)

(Akamai, ChinaCache)

Edge Caching

Local servers keep content cached, so users can load from somewhere close instead of across the world.

  • Images
  • CSS
  • Javascript
  • Pages that don't refresh often

TCP (how the internet works)

Imagine a train.

TCP Connection

Someone telegrams airbnb.com to say a train is coming airbnb.com sends a telegram back to say "okay" airbnb sets up a train track connection the train cars start small and get larger as they arrive successfully, until they get too big and start to fail

TCP Connection

You must establish a new connection for every request.

SPDY (how the better internet works)

Instead of new connections, SPDY reuses the existing connection and makes parallel requests.

SPDY, Also.

  • Header compression (you only send cookies, etc once)
  • Always SSL (yay security)
  • Less packet loss, better socket utilization

If You Have a SPDY Connection

  • No more domain sharding (a0-a3.muscache.com)
  • No need to concatenate scripts (except legacy support)
  • It's currently enabled for our static assets

Overview

  • Cheat spacetime by using edge caches
  • Lower time spent on data transfers by re-using connections
  • Any Questions?