Cloudfront vs Origin - consistently higher speed index.

Hi,

I’ve been using WPT to test a CloudFront implementation, and have noticed that despite the general timing measurements being faster for requests to Cloudfront vs the Origin, the Speed Index seems to be consistently lower for the Origin.

Can anyone shed some light on why this might be? This behaviour has repeated fairly consistently across 180 tests, from varied geographic locations.

This is a test against the Origin from Sydney:
http://www.webpagetest.org/result/141214_D2_KAQ/

This is a test against the CF implementation from Sydney:
http://www.webpagetest.org/result/141214_VK_KAS/

And here’s the comparison:
http://www.webpagetest.org/video/compare.php?tests=141214_VK_KAS,141214_D2_KAQ

Again for a test from Ireland:
Origin
http://www.webpagetest.org/result/141214_TQ_K9C/

CF
http://www.webpagetest.org/result/141214_WY_K9G/

Comparison
http://www.webpagetest.org/video/compare.php?tests=141214_WY_K9G,141214_TQ_K9C

The origin always seems to fare better with visual progress. Cloudfront is set to cache everything, so there shouldn’t be an additional RT to fetch from the origin for any requests (with the exception of 3rd party scripts), assuming a cache-hit (response headers indicate that CF is mostly delivering hits).

The origin server is in AWS US west coast, CF is US east coast.

If anyone can set me straight on this, I’d really appreciate it.

It’s whatever triggers the loading of this image - http://www.dairywellness.com/asset_upload_file696_136618.jpg (it’s the farmers legs used as the background)?

In both Cloudfront tests, and in testing locally here it’s one of the last images to be loaded so delaying visual progress and SpeedIndex.

In the non-CloudFront waterfall it’s much earlier in the timeline.

I’d have a look at what triggers the loadHeroImage function and debug from there.

Also consider trying with Firefox and Chrome Canary. There have been some recent changes in Chrome’s rendering path that may better be able to show the CDN benefit (it is better about drawing early).

Hi Andy / Pat,

I’m really interested in something you’ve both hit on there - the fact that the page is somehow rendered in a different order when requested via Cloudfront (the fact certain images appear much earlier in the Waterfall when requested via Cloudfront)

In almost all tests I’ve run, across three different sites, the introduction of a Cloudfront increases the speed index when compared with tests against the origin (it seems the latency reduction provided by Cloudfront isn’t enough to positively impact the speed index) and I’d love to better understand why this is the case.

Cheers,

Mark.