8 ms·
2020-11 announcement with technical details on why they're removing it: https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ https:
by jefftk 4y ago
2020-11 announcement with technical details on why they're removing it: https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYL...
No one as far as we know, inside or outside Google, ever figured out how to use server push to consistently speed up loading pages.
- msoad 4y agoPush is a bad design. The client should manage the resources on the client not the server. Stuff like resource media queries for instance. How the server can know if user wants dark mode or light mode CSS file?
- jefftk 4y agoI agree on removing it, since it turned out not to work well despite lots of people trying. On your particular question, there's the client hint Sec-CH-Prefers-Color-Scheme: https://web.dev/user-preference-media-features-headers/ https://web.dev/user-preference-media-features-headers/
- msoad 4y ago> The Sec-CH-Prefers-Color-Scheme client hint header is supported on Chromium 93. Other vendors' feedback, namely WebKit's and Mozilla's, is pending. I don't see this header being sent in Chrome 104!
- panopticon 4y agoWorks on Chrome 104 for me: https://sec-ch-prefers-color-scheme.glitch.me/ https://sec-ch-prefers-color-scheme.glitch.me/ Note that the server has to request that header using accept-ch.
- msoad 4y agocurl --head https://sec-ch-prefers-color-scheme.glitch.me/ HTTP/2 200 date: Fri, 19 Aug 2022 18:55:43 GMT content-type: text/html; charset=utf-8 content-length: 936 x-powered-by: Express accept-ch: Sec-CH-Prefers-Color-Scheme vary: Sec-CH-Prefers-Color-Scheme critical-ch: Sec-CH-Prefers-Color-Scheme etag: W/"3a8-iEB3drxZIB7EZYHQL534qwomDuI"
- Koffiepoeder 4y agoUse css variables for colors, then load the relevant set with a 'prefers-color-scheme' media query. No need to serve 2 CSS assets: the difference should be minimal.
- jefftk 4y agoA stronger version of msoad's point would be deciding whether to push a dark or light image, based on the user's theme.
- msoad 4y agoYou can solve this using the <picture> element. As Github does:https://github.blog/changelog/2022-08-15-specify-theme-context-for-images-in-markdown-ga/ https://github.blog/changelog/2022-08-15-specify-theme-conte...
- jefftk 4y agoWe're assuming here that the site owner wants to push the image.; Having the client request a different image as a follow-up based on the user's preferences is a different solution, and there are lots of specific ways to do that.
- mikewhy 4y agoThat sounds exactly like "The client should manage the resources on the client not the server"
- zamadatix 4y agoNowadays absolutely. Worth keeping in mind HTTP/2 made it into browsers 4 years before that media query though. You can also request that info via header nowadays if you for some reason were really dead set on sending the minimal CSS directly.
- fzfaa 4y ago> How the server can know if user wants dark mode or light mode CSS file? Cookies? Custom header?
- nousermane 4y agoIt is bad design, but more importantly, server push is a (subpar) solution to a problem we shouldn't have in the first place. How exactly modern web ended up in a situation where, first time browser is displaying a single page (with maybe 3 pictures and 2 paragraphs of text), it has to download 300 resources from 12 different servers, including 2 megabytes of minified javascript?
- vbezhenar 4y agoHow many files touches some typical desktop program to display 3 pictures and 2 paragraphs of text? How many megabytes its installation occupies? My bet is that numbers will be comparable. That's the way people write software. Standards and tools should adapt. It makes no sense to complain about it as nothing changes. Every popular JS build tool helps with good practices by building a single minified bundle. Popular JS frameworks are tiny portion of those 2 megabytes. Developers just don't care and you can't do anything about it. You can build better protocols and better tools to make those applications work faster. And developers will leverage those to make their apps even slower. Who cares about 2 MB with 5G?
- okasaki 4y agoEven if so, the javascript doesn't replace the OS "bloat", it adds to it.
- mrjin 4y agoJS is the most abused stuff I guess. Current web apps is a "can we" rather than "should we" approach.
- allendoerfer 4y agoHumanity is a "can we" approach.
- nousermane 4y ago> How many files touches some typical desktop program to display 3 pictures Not sure about typical, but here is rough estimate for the rock bottom of it: "feh" image viewer on Ubuntu/X11: $ strace -e openat -o >(wc -l) feh -F \ one.jpg two.jpg three.jpg 105
- riedel 4y agoPush would IMHO allow nice pub sub if combined with SSE. Particularly for short lived objects one could actually considerably reduce overhead. However, it has been build with the design goal to be an optional feature (as there is no client side API) : I guess it fulfilled at least that goal.
- nousermane 4y agoWasn't originally intended use for server push, something like this? 1) Load page through javascript-enabled browser (headless chrome, etc), and record resources accessed from the same server; 2) Save this list somewhere, where server can read it, keyed by URL; 3) When user requests same URL, push resources from the list.
- jefftk 4y agoThat's the idea that led to implementing server push. Lots of people it, and it turns out not to work very well. There's too much variation in what people will already have in their caches and the server is not great at predicting the order in which clients will need the resources.
- deleted 4y ago[deleted]
- saurik 4y agoI'm just still shocked that this wasn't obvious to more people before: it isn't like you even need to have implemented this feature to do the instrumentation required to know whether this would work, and it frankly had always seemed like a long shot.
- vbezhenar 4y agoClient can send bloom filter with first request.
- habibur 4y agoHow? The client needs to know what the resources are to create a bloom filter. It doesn't know that before 1st request.
- vbezhenar 4y agoFirst request is empty filter, server will push everything mentioned in HTML. For subsequent requests browser will fill filter with known hashes, server will push changed resources (and false positives).
- therein 4y agoYeah, that's the thing. So very many years ago when we started using HTTP/2 at LinkedIn, we simply just couldn't find a use for server push. It was a fascinating meeting. We got this technology, no matter how much we tried to use it, couldn't come up with a use for it. I still remember how awkward that meeting was to this day.
- skyde 4y agoHow is this different from rel="preload" in HTML to preload (css javascript ... ) Ex: https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload#what_types_of_content_can_be_preloaded https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types... The webserver could just parse the HTML and send http push for each dependency! What was the problem with doing this? To me this seem very similar to "open document format" are storing html with all its dependency in a ZIP package. So with HTTP/2 push you just push the whole package and the client tell the server if it already have some of the files.
- coder543 4y ago> The webserver could just parse the HTML and send http push for each dependency! What was the problem with doing this? Well… the client knows which resources are already in its cache. The server does not. You just suggested that the server should always send resources that client almost certainly already had cached, which is wasteful for everyone involved. > So with HTTP/2 push you just push the whole package and the client tell the server if it already have some of the files. That doesn’t make sense. Once the files have been pushed, the bandwidth and time has already been wasted. The client doesn’t get to tell the server anything in that scenario.
- uluyol 4y agoDisclosure: I was a (secondary) coauthor on this work. Vroom [1] is a research system to accelerate page loads. It identifies dependent resources for your page and uses a combination of client hints and and server push to improve network utilization. I believe that only important, non-cacheable content use server push. See the paper for results. To be clear, web performance is not my main field and I haven't kept up with the latest happenings. I only bring it up as evidence that push can be useful, but I can't actually say whether it's worth the complexity. EDIT: fixed some typos. [1] https://web.eecs.umich.edu/~harshavm/papers/vroom_sigcomm17.pdf https://web.eecs.umich.edu/~harshavm/papers/vroom_sigcomm17....