3 ms·
For the people who are downvoting, some more details on how this would work from a person who actually works on web platforms and standards: Along with crypto
by kevingadd 10y ago
For the people who are downvoting, some more details on how this would work from a person who actually works on web platforms and standards:
Along with crypto and improved compression, HTTP2 offers multiplexing. HTTP also has historically offered range requests, where you can request a small subrange of a file.
This means that a browser could collect image URLs when doing its initial parse of the page (pretty easy, since you want a small, simple page for AMP anyway) and then issue a set of requests for the headers of all the images - for PNG, at least, you know the header will be of known, relatively small size. The header requests can all be multiplexed by HTTP2, which means that you will be able to get all the headers before you start getting the full bodies of the images. You won't have to download the headers or images twice since you can download the rest of the image bodies with another range request. Range requests could also be cached under this scenario.
This optimization can be implemented (in theory) by every browser engine and doesn't require changes to developers' content or web servers. And it would be an improvement that is web-wide instead of just focused on AMP.
- querulous 10y agoyou can do even better with http2. on a request to get a page the server can just optimistically send the image headers to the client up front with the page text then backfill the image bodies in whatever order the client wants
- kevingadd 10y agoOh yeah, I forgot about server-driven preloading. There's some great stuff in HTTP2, thanks for pointing it out!
- cramforce 10y agoThis already happens, but the extra roundtrip still kills performance. Not having to make an extra HTTP request is the only way to get good performance in this case.