Sadly, HTTP 103 hints, which provide a much saner way to preload content, are still unimplemented in all major browsers.
For people like me who are unfamiliar with the proposal, 103 Early Hints [1] would work like this. Client request: GET / HTTP/1.1 Host: example.com Server response: HTTP/1.1 103 Early Hints Link: ; rel=preload; as=style Link: ; rel=preload; as=script HTTP/1.1 200 OK Date: Fri, 26 May 2017 10:02:11 GMT Content-Length: 1234 Content-Type: text/html; charset=utf-8 Link: ; rel=preload; as=style Link: ; rel=preload; as=scr…
Blink: Intent to Remove: HTTP/2 and gQUIC server push
111–120 of 142 posts
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#112Five years ago, we built a company around HTTP/2 server push. Here is what we learned: - The interaction of HTTP/2 push with browser caches were left unspecified for the most part, and browsers implemented different ad-hoc policies. - Safari in particular was pretty bad. - Since HTTP/2 Push worked at a different layer than the rest of a web application, our offering centered around reverse-engineering traffic pattern…
People often claim HTTP/2 to be superior due to its multiplexing capabilities, but always reason with the mental model of having true stream-based flows and leaving TCP completely out of the argument loop. But guess what, that model is just a model, indeed you have packet-based TCP flows that are abstracted away to mimic a continuous stream as a socket - and those matter.
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#113Earlier quoted context omitted.
No, it's not possible. It will take a round trip for the client to tell the server if an object is cached. So you have two options: 1. Pessimistically start pushing the response, and stop if the client tells you it is already cached 2. Optimistically don't push the response until the client tells you that it doesn't have it cached. The first option is what push does. The second option is basically equivalent to sendi…
> It will take a round trip for the client to tell the server if an object is cached. Why wouldn't the client be able to give the server some information about what it has cached already when it makes the initial GET request for the HTML page?
Uploading an entire list of cached resources probably isn't feasible (and probably not possible or a privacy concern).
You could maybe do a bloom filter but probably still have privacy concerns.
There is a solution that mostly works. You can use cookies! A simple solution might be setting a cookie for the app version when you respond. On the next request you can avoid pushing resources that haven't changed between the client's last version and the current one. Or you can even try to set cookies for each asset, however I'm not sure that is a good strategy.
But this is still not perfect. The presence of the cookie doesn't mean the resource was ever downloaded (maybe it was aborted partway though?) and things can get purged from the cache and the cookie has no way of knowing.
You can also try to do out-of-band info. For example storing in a database which resources the client has downloaded before and a bunch of heuristics to determine if they are likely still in the cache. But at the end of the day only the client knows that.
So the TL;DR is I'm not sure this is possible. You are looking for `required resources - cached resources` and since `cached resources` is sensitive and probably much larger it is way easier to do this computation on the client.
So TL;DR it might be possible but is very tricky. The current state-of-the art isn't anywhere near a perfect solution.
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#114HTTP/2 Push allows to _really_ optimize first page load, giving a wow effect. (Especially when you can use a single server w/o geodns to serve the whole world with a really low latency!) I use it on my pet project website, and it allows for a remarkable first page load time. And I don't have to make all these old-school tricks, like inlining CSS & JS. HTTP/2 Push allows for such a pleasant website development. You ca…
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#115What if on link hover, some javascript code notifies the server and the server pushes the page? When the user clicks the link the page will have already been downloaded. Would that not be possible and useful?
This is a really weird system you have devised. You are making a custom request to ask the server to push something to the browser. Browser: POST /preload?url=/next-page Server: PUSH /next-page Just cut out the middleman and make a regular request. Browser: GET /next-page Even better use browser preloading mechanisms so that the browser knows how to best prioritize them. In fact if you do it this way the browser can…
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#116What if on link hover, some javascript code notifies the server and the server pushes the page? When the user clicks the link the page will have already been downloaded. Would that not be possible and useful?
This is a really weird system you have devised. You are making a custom request to ask the server to push something to the browser. Browser: POST /preload?url=/next-page Server: PUSH /next-page Just cut out the middleman and make a regular request. Browser: GET /next-page Even better use browser preloading mechanisms so that the browser knows how to best prioritize them. In fact if you do it this way the browser can…
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#117Server Push has a use case for web APIs. I just published a benchmark showing that under certain conditions APIs using Server Push (such as APIs implementing the https://vulcain.rocks specification) can be 4x times faster than APIs generating compound documents (GraphQL-like): https://github.com/dunglas/api-parallelism-benchmark They key point for performance is to send relations in parallel in separate HTTP streams.…
The bad news: For website requests Here is an analogy: If you want to compare the acceleration of 2 cars, you would have race them from point A to point B starting at a velocity of 0mph at point A, and measure the time it takes to reach to point B. In your benchmark, you basically allowed the cars to start 100 meters before point A, and will measure the time it takes between passing point A and B. Frankly, for cars, acceleration decreases with increasing velocity; for TCP its the other way around: the amount of data allowed to send on a round trip gets larger with every rountrip (usually somewhat exponentially).
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#118Earlier quoted context omitted.
Don't forget Server Sent Events[1] as well, which is yet another different technology. [1] https://en.wikipedia.org/wiki/Server-sent_events
Yea but unlike http2 push, server sent events were actually useful! You could use it super easily and by holding open a connection and pushing down little json or XML payloads you could build all sorts of things easily in JavaScript. I even saw super basic chat functionally built using two Iframes a form in one and the chat log pushed back from the server as a stream of valid but open ended HTML abusing how lax the b…
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#119Earlier quoted context omitted.
Would inlining CSS and JS work on web sites (not apps)? I kinda feel inlined JS will bypass bytecode cache and the parsing costs have to be paid on each page load.
Yep, inlining only optimizes first page load.
Re: Blink: Intent to Remove: HTTP/2 and gQUIC server push
#120What if on link hover, some javascript code notifies the server and the server pushes the page? When the user clicks the link the page will have already been downloaded. Would that not be possible and useful?
There are libraries [1] that achieve what you describe. [1]: http://instantclick.io/ "InstantClick"