21. 21
With HTTP2, you
don’t need to worry
as much about
round trips...
...but you should
still consider what
you’re transferring,
and how.
21
#SMX @jonoalderson
24. HSTS
● Become compliant by adding extra HTTPS checks.
● Register for the HSTS the preload list.
● Skip the HTTP/HTTPS redirect when people type example.com!
24
24
#SMX @jonoalderson
25. Packet sizes & cookie worries aren’t a thing any more
25
https://hpbn.co/building-blocks-of-tcp/
25
#SMX @jonoalderson
26. ...but data & connection
efficiency is.
26
26
#SMX @jonoalderson
27. For devices...
● Detect early, and adapt. Responsive = expensive!
● Make CSS mobile-first (build up from min-width); typically reduces sizes.
○ Conditionally layer on / load more for larger devices.
27
27
#SMX @jonoalderson
37. Which metrics matter?
● There’s no such thing as ‘speed’. What are we measuring,
exactly?
● Numbers from Google Pagespeed Insights, Pingdom,
WebPageTest, GA, etc, are all nonsense.
● User satisfaction metrics > any technical speed metrics.
37
37
#SMX @jonoalderson
40. Which metrics matter?
● Don’t ignore, or get fixated on time ‘til first byte.
● You need to fix the front end and the back end.
40
40
#SMX @jonoalderson
48. Options for handling
angular/react sites...
1. Hope for the best
2. Serve static HTML versions, then let the framework pick up
the heavy lifting (using something like or PhantomJS)
3. Use something like Prerender.io (paid, or self-hosted).
48
48
#SMX @jonoalderson
49. ● There comes a point where you outgrow a single server.
● If you’ve finite RAM and CPU, consider separating servers and databases.
Latency, however!
● Consider caching, varnish, load-balancers
Server Ecosystems
49
49
#SMX @jonoalderson
51. ● It's a pain supporting HTTP2 with Varnish and other performance frameworks.
So just put it on the front end as a reverse-proxy.
● (Fixed in newer versions)
Varnish + HTTP2
51
51
#SMX @jonoalderson
61. CDNs are still important
● Localisation is important!
● Latency is a bottleneck more often than you’d think.
● Use resource CDNs (eg., cdnjs.cloudflare.com) for things like jQuery.
● Your first line of defense.
61
61
#SMX @jonoalderson
63. Above the fold (critical path)
rendering
63
#SMX @jonoalderson
● Reduces waiting time for the
browser to download assets.
● ...but can’t be cached!
● http://bit.ly/criticalpathcss
64. (Re)paint & (Re)flow
64
#SMX @jonoalderson
● Consider how the page is constructed and how it behaves.
● Minimise unknowns to reduce tearing and reflow in particular.
● Small technical gains, big perception gains.
66. CSS specificity = slow paint
● .container > nav > ul > li > a { color: red; }
● .main-nav-link { color: red; }
66
#SMX @jonoalderson
67. Animation & FPS
● jQuery, scrolling and changing elements costs GPU and CPU
● Consider the user’s physical hardware!
● Measure with Chrome, and kick your devs!
67
#SMX @jonoalderson
68. Deferring / async resources
● Do you need to load everything immediately?
● Do you need to load everything in the <head>?
● Do you need to load everything on every page?
● Do you understand the dependencies?
● What can you defer, load asynchronously, or load conditionally?
68
#SMX @jonoalderson
No Fili!
Lots of little tips; I’ve included links, but you can Google everything in here.
I know you’re not web developers… but this is going to get techy.
Why is performance important?
Everybody seen the Amazon studies (and all of the others?)
Why is it only going to get more important? Instantaneous is the new 2 seconds is the new 5 seconds!
This session is for anybody who wants to go faster (either with AMP, or without), but doesn’t know where to start; front end, back end, and everything inbetween.
The AMP project in particular has pushed performance forward (not without politics)...
(AND, there may be good reasons why you don’t want to use AMP, but still want the benefits).
Why is AMP not a magic bullet? Ad networks, walled gardens and dependency on Google, poor implementation.
Yet another language/framework to maintain (for them, and for us).
Deprecation? Invalid code? Security? Pinging, caching.
Pros and cons? Control! Ownership!
Are there alternatives?
Have to ping to manage versions
But no guarantees; flakey!
Other people are getting involved.
But is it enough?...AND… their implementation is a little… odd…
not easy to do your own amp cache, as you need to host and maintain your own version of the amp library#
no guarantees your amp cache is used by third parties such as search engines
What’s your motivation for adopting AMP; the performance, or access to the sandpit?
You can have all the performance advantages without having to be in the cache, etc.
But it’s a choice, with implications.
And there are other options.
But it’s also the tip of the iceberg; if your goal is performance, there are a million other things you can do.
HTTPS is mandatory. Security. Performance. Acceptance.
This thinking assumes that you’re already compliant, or are about to be.
No reason not to (ad platforms, etc)
“HTTPS is slower!” - the myth of secure handshake bottlenecks
Cheap certs often = long chains!
Cloudflare = shared/cheap
Let’s Encrypt; install in/on server. Also, cPanel now DIY’s, too.
Better certs = closer to trusted sources, and also better liabilities
Apache config, or automate via Cloudflare (etc)
Cloudflare - also, upgrade insecure resources, force https, free sll certs, etc.
At some point you have to sort all of this out, so it should probably be now.
A FAST, wired connection from east coast to west coast USA might take ~60-100ms.
A 4g connection to a remote server might take up to ~200ms (‘sluggish’)!
HTTP services do round-trips to get resources; HTTP2 services run in parallel.
What goes into your first few packets?
Parallelised/individual resources & require.js, etc
Enables keep-alive by default
No more hostname sharding (or, maybe - to support some browsers [esp older mobile]; serve from same IP [cached hostnames])
Itemised SASS/LESS/JS outputs - only load the bits you need
A lot of the page speed tools misreport on this.
Combine your javascript! Distribute your resources!
Still bottlenecks based on the number of assets you’re loading, the size of those, where they’re hosted, etc.
CSS3 is often faster than using images
...Though processing and rendering are your bottlenecks
SVGs > JPG/PNG is a good general rule. WebP even better, but challenges.
Although… inlining resources makes them harder to cache, and may not be optimal in terms of prioritsation
Base64 encode fonts and icons, and SVGs!
Doesn’t need an extra request, which still carries overhead
Conditional media queries still (can) load all the assets
Mechanisms which use display:none still load the image
Mechanisms which replace the image src attribute to lazy-load probably aren’t great for accessibility or SEO
Up to 40% smaller!
Better compression, shared headers, etc.
Most systems don’t cache 404s (or other errors)
Some scenarios mean that requests to errors redirect, download subsequent resources, etc. Cost-intensive.
Robots.txt, favicons, app icons, msapplication policies, requests to old URLs, security probes.
Most systems don’t cache 404s (or other errors)
Some scenarios mean that requests to errors redirect, download subsequent resources, etc. Cost-intensive.
Robots.txt, favicons, app icons, msapplication policies, requests to old URLs, security probes.
Your best tool is your brain, and your experience.
Use the Chrome waterfall, look for slow request/respond/paint processes.
Click on them, and read! It’ll give you tips.
Diagnosing bottlenecks
Longest single wait is often connect + receive*
Nothing else can happen until this is done.
More time processing, or more time delivering?
Don’t ignore, and don’t get obsessed!
CDNs; later!
VPS, Heart?
Email, FTP, SQL, PHPmyadmin. Start to see behind the curtain.
Gzip
RAM allocation
Gzip variablles!
PHP versions, addons, etc
Be careful about accidentally consuming CPU/GPU, wasting bandwidth, triggering JS, etc
https://www.w3.org/TR/page-visibility/ - page visibility API is generally supported, and lets you check if a tab is active/visible.
Edge caching assets easy; html less so. Uncommon.
More complex setups; distributed servers/etc.
Homepage icon
Online/offline hybridisation; control local caching, etc
Need URL-based nav (which you already need for app indexing)
Precursor to sideloaded APKs
Consider that maybe a separate app isn’t the future
...That Google want to push for seamless search>content transition (albeit with monetisation)
The app store disrupts this; and Google Now scraping apps isn’t a good enough fix.
AMP and PWA pages are increasingly gaining access to mobile hardware; seamless transition into apps, and even into VR.