Modern progressive web applications are complex pieces of software running in the browser. Fastly offers unparalleled control over the way the bytes fly from your servers to the user, enabling many of the features of advanced progressive web apps to truly shine. This talk will show how these latest web technologies can best take advantage of smarts in the network to deliver your web app at top speed.
17. • You can’t make light go faster
– TLS+TCP setup requires 3-4 round trips
– Get closer to the users
• You can’t optimise across multiple origins
– Even as HTTP improves, you will still need separate connections to
each origin
– Use a smaller number of origins
• Requests are getting cheaper
– Don’t worry so much about number of requests
Bottom line
25. • Never changes?
Cache-control: max-age=31536000, immutable
• Unique response?
Cache-control: private, no-store
• Changes when stuff happens?
Cache-Control: max-age=0, s-maxage=31536000
Good cache headers
Avoid revalidations
on refresh
26. Purging when things happen
User
Event:
Comment posted
Edge Server
Uncached, fetch
from origin
Hit! return “304 Not
Modified” from Edge
cache
After purge,
uncached again
PURGE
MISS...
28. Serve stale (while revalidate)
Users
Soft purge
Edge Server
400req/s for the
home page
One request goes to
origin. The rest are
held at the edge.
Future requests served
from fresh cache
After expiry, requests
still get fast cached
response
Asynchronous fetch
to refresh the cache
Cache repopulated
Does not wait for
origin response!
30. Serve stale (on error from origin)
Users
Purge
Edge Server
Requests flooding in
Just one request
goes to origin,
populates cache at
the edge
Request after expiry
causes fetch to origin
Origin server is
offline, refuses
connection
stale-while-reval expires
SERVER DOWN!
Server super-stale
object from cache
Fall back to stale
content
49. • More objects, smaller objects,
fewer origins
• Less bundling
• Smarter caching
• Serve stale (while-revalidating,
and if-error)
In summary...
• More purging
• More varying
• ServiceWorker and Silent push
• Origin policy and feature policy
50. Thanks for listening
I am Get the slides:
Andrew Betts
@triblondon
abetts@fastly.com
fastly.us/altitude-potn
53. Accept-Language around the world
Washington DC Frankfurt Tokyo
1 en-us en-US,en;q=0.8 ja-jp
2 en-US,en;q=0.8 it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4 ja-JP,en-US;q=0.8
3 en-US en-us ja-JP
4 en-US,en;q=0.5 it-it ja-JP,ja;q=0.8,en-US;q=0.6,en;q=0.4
5 en tr-tr ja,en-US;q=0.8,en;q=0.6
6 pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4 ru ja
7 en_US tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4 ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4
8 es-ES,es;q=0.8 pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4 ko-KR
9 en,* ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4 en-us
10 en-US;q=1 de-de ko-KR,en-US;q=0.8
+ over 5000 total variations
54. Normalise for vary (5000 -> 6)
Washington DC Frankfurt Tokyo
1 en (84%) en (60%) jp (74%)
2 es (7%) es (18%) en (23%)
3 pt (6%) de (12%) es (3%)
4 jp (2%) fr (7%)
5 fr (1%) pt (2%)
6 jp (1%)
https://docs.fastly.com/guides/vcl/accept-language%20header-vcl-features
accept.language_lookup("en:de:fr:pt:es:jp", "en", req.http.Accept-Language);