News for hackers. Stuff that matters.
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @12:53PM (#32523417)
2020-11 announcement with technical details on why they're removing it: 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.

Re:Removing HTTP/2 Server Push from Chrome by uluyol on Saturday August 20, 2022 @12:12AM (#32529007)
Disclosure: 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....

Re:Removing HTTP/2 Server Push from Chrome by therein on Friday August 19, 2022 @02:29PM (#32524500)
Yeah, 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.
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @02:49PM (#32524710)
How is this different from rel="preload" in HTML to preload (css javascript ... ) Ex: 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.

Re:Removing HTTP/2 Server Push from Chrome by coder543 on Friday August 19, 2022 @02:53PM (#32524753)
> 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.

Re:Removing HTTP/2 Server Push from Chrome by 0x457 on Friday August 19, 2022 @03:18PM (#32524994)
I guess the client could tell server that "I already have that file in cache", but it's still weird, might require another round-trip (server asking if client needs this file).
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @05:54PM (#32526430)
a push is an HTTP2 stream. the stream header contain everything the client need to know if it already have that file.

If it does already have that file, client simply close the stream it doesn't need to download the file or send request to server to say it doesn't need the file.

Re:Removing HTTP/2 Server Push from Chrome by coder543 on Friday August 19, 2022 @06:09PM (#32526576)
Even then, the average case would still be worse because the server would be sending all these unnecessary stream headers and forcing the client to send so many unnecessary RST_STREAM frames back. Each PUSH_PROMISE is supposed to contain the full set of headers for each resource.

I guess I hadn’t realized that clients could RST_STREAM on these pushes, but it doesn’t change the outcome here.

What you describe isn’t a win for anyone except a client with a cold cache, and then they start losing immediately after that. That’s why it isn’t done. That’s why HTTP/2 Push is going away.

Re:Removing HTTP/2 Server Push from Chrome by Matthias247 on Friday August 19, 2022 @07:00PM (#32527092)
Even if a client does a RST_STREAM, the origin server might already have done a lot of additional work (e.g. request the pushed file from an upstream if it's a proxy/CDN), and probably stuffed min(TCP_SEND_BUFFER_SIZE, STREAM_FLOW_CONTRO_WINDOW) of data into the stream. Which then also means all of that work might get billed if the server is a managed service. It's really quite some waste of resources compared to the client sending an additional request (which might even be a conditional request).
Re:Removing HTTP/2 Server Push from Chrome by coder543 on Friday August 19, 2022 @07:02PM (#32527120)
Yeah, and unless I’m wrong, this also means the TTFB could be significantly higher, since I think the PUSH_PROMISE frames need to come before the main content. Doing that at least requires gathering up the information on those objects, which takes time.
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @07:47PM (#32527489)
you are 100% right :-(

The spec say

"The server SHOULD send PUSH_PROMISE (Section 6.6) frames prior to sending any frames that reference the promised responses. This avoids a race where clients issue requests prior to receiving any PUSH_PROMISE frames."

Re:Removing HTTP/2 Server Push from Chrome by Matthias247 on Friday August 19, 2022 @08:52PM (#32527919)
even if a server implements that behavior, it could however just send the PUSH_PROMISE frame (containing HTTP headers) but doesn't have to send the associated data frames yet. The frames associated with the original response could follow earlier.
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @07:12PM (#32527209)
yeah depend if you care more about saving bandwidth or reducing the time it take to display the page.
Re:Removing HTTP/2 Server Push from Chrome by coder543 on Friday August 19, 2022 @07:14PM (#32527232)
As noted in other comments on this thread, increasing the TTFB is not a way of displaying the page faster.

HTTP/2 Push is such a cool concept, but the idea of it going away also makes perfect sense to me after years of not seeing anyone find benefit.

Re:Removing HTTP/2 Server Push from Chrome by rndgermandude on Saturday August 20, 2022 @04:04AM (#32530217)
The http/2 stream is multiplexed over a regular tcp stream. At least some push HEADERS and data was most likely already send over the tcp stream, and is most likely already a few hops away from the actual server. By the time the server actually gets the first http/2 RST_STREAM(s) a lot of data from multiple useless pushes could be inflight already. At this point you cannot just close the http/2 stream to avoid data being send. You can only either RST the entire tcp stream and kill all multiplexed http/2 flowing over it (avoiding some data transfer), or accept the data that arrives on your closed http/2 streams and send it in the direction of /dev/null.

Server push, as opposed to preload/hints, only makes sense when you know a) a client will absolutely need the data and b) you're reasonably sure the client does not have the data yet (e.g. data that is uncacheable).

Re:Removing HTTP/2 Server Push from Chrome by msoad on Friday August 19, 2022 @12:55PM (#32523445)
Push 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?

Re:Removing HTTP/2 Server Push from Chrome by nousermane on Friday August 19, 2022 @02:11PM (#32524341)
It 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?

Re:Removing HTTP/2 Server Push from Chrome by vbezhenar on Friday August 19, 2022 @02:43PM (#32524653)
How 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?
Re:Removing HTTP/2 Server Push from Chrome by mtoohig on Friday August 19, 2022 @06:35PM (#32526852)
As much as I agree in general, the last part affects me and many others. I only get 2.5Mb/s and I work for the WISP.

The wife's family living away from the main city have intermittent connection and slower speeds. We have only one submarine cable and poor infrastructure further out. So heavy, bloated sites eat up people's pre-paid internet packages quickly or have trouble loading altogether. Prepaid is around $1.25 for 500MB or $10 for 5.5GB.

I think lower bundle sizes should be a goal. Or lower bandwidth websites should be available such as a 'm.' Domain. IMO

Re:Removing HTTP/2 Server Push from Chrome by shadowgovt on Friday August 19, 2022 @10:24PM (#32528416)
This was one of the goals of AMP cache: require sites to use a subset of HTML and vend the data from a server local to the request.
Re:Removing HTTP/2 Server Push from Chrome by mrjin on Friday August 19, 2022 @11:04PM (#32528636)
Do you reinstall your OS/apps daily or even hourly?

^Who cares about 2 MB with 5G? That's exactly how we get into current shitty situation. Network is fast, memory is cheap so let's do whatever we want. In 2004, I only had 512MB memory on my computer, it run pretty smoothly. But now I got 64GB of memory and I run of memory now and then. I'm wondering how soon I'm going to put 1TB of RAM into my computer, not going to be too far away I reckon.

Re:Removing HTTP/2 Server Push from Chrome by doliveira on Friday August 19, 2022 @07:00PM (#32527091)
> Who cares about 2 MB with 5G

Statements like this reminds me we live in different planets. I'd argue we should still care, just like we care about accessibility in general, but obviously it's indeed a lost cause. Anyone not on 1Gbps and 32 GB of RAM is to be relegated

Re:Removing HTTP/2 Server Push from Chrome by nousermane on Friday August 19, 2022 @02:50PM (#32524726)
> 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
Re:Removing HTTP/2 Server Push from Chrome by the8472 on Friday August 19, 2022 @04:04PM (#32525408)
63 for me, and most of those are libraries which should already be in memory. Which is nanoseconds away from the CPU while servers are dozens to hundreds milliseconds away.
Re:Removing HTTP/2 Server Push from Chrome by jchw on Friday August 19, 2022 @03:46PM (#32525271)
That's not the whole story of course: there's an X server that feh is communicating with over a domain socket and usually shared memory, and X implements significant functionality on its end. Then there's drivers, and the stuff between these things.
Re:Removing HTTP/2 Server Push from Chrome by nousermane on Friday August 19, 2022 @04:04PM (#32525406)
Sure. And bloated websites aren't dropping from the race here, either. They are communicating, over HTTP (and maybe WS/SSE), with fair number of servers, that also implement significant functionality. Then, there are microservices, databases, network between those...
Re:Removing HTTP/2 Server Push from Chrome by jchw on Friday August 19, 2022 @07:25PM (#32527320)
Ultimately, though, even the script-free HTML pages that purists generally like and do not see as a problem do all of these things just as much. The point is that people have a lot of feelings about how simple, small and self-contained different software is, but realistically if you're not on a Commodore 64 they're all nightmarishly complicated. It only feels otherwise because encapsulation can be effective.
Re:Removing HTTP/2 Server Push from Chrome by LtWorf on Friday August 19, 2022 @07:33PM (#32527382)
an X server is not implementing as much functionality as a browser, but it's anyway needed to display our initial HTML
Re:Removing HTTP/2 Server Push from Chrome by jchw on Saturday August 20, 2022 @02:08AM (#32529586)
It's a bit nitpicky to go this direction, but in general having the display server implement all of the things X does is not necessary at all, especially because most apps, certainly browsers, essentially ignore those features of the display server, because they need more functionality and better performance.

That said, I would not be surprised if XFree86 was, at some point, significantly larger than contemporary web browsers, given the enormous amount of functionality that was loaded into it. Of course, modern web browsers definitely trump any old X server, so is this really relevant? I guess it depends. I get a huge sense that what people are longing for is a return to the "good ol days" when software was simple and fast, and X is a damning counter example, though it certainly doesn't mean that there's no point to be made at all, just that it is perhaps less black and white than people suggest.

I am not trying to say that feh is as complex or as slow as a web browser, only that in general, people treat the division of "native code" and "browser code" such that code running in a browser is always more bloated and slow. Somehow though, this is demonstrably not true. Looking at only very simple software with intentionally very limited scope is not going to give the whole picture. When you look at fairly complex software, the additional burden of having a browser underneath can fade away compared to algorithmic complexity issues and poorly optimized code. Your text layout and font shaping routines are probably going to struggle to compete with a browser if you have a very heavy layout to handle, and if you're doing accidentally quadratic things it's going to matter more than JIT or GC overhead.

Re:Removing HTTP/2 Server Push from Chrome by trasz on Saturday August 20, 2022 @08:24AM (#32531504)
I think X was kind of like this, yeah - in the eighties and early nineties; it's got its own chapter in the Unix Haters Handbook. There's been an incredible amount of work done to fix/work around its problems, and some of them - like security - turned up to be not practically fixable at all. Rewriting it into a properly minimalist design 20 years ago, like Apple did, instead of just now, would save everyone a lot of time.

And this time it's orders of magnitude worse.

Re:Removing HTTP/2 Server Push from Chrome by int_19h on Sunday August 21, 2022 @11:58AM (#32541418)
X was literally the thing they needed shared libraries for - it was too big to link statically.
Re:Removing HTTP/2 Server Push from Chrome by alerighi on Friday August 19, 2022 @07:21PM (#32527290)
There is a difference: a webpage is not a program, the program is the browser. The browser is a program to display documents, just like a text editor can display text, a PDF viewer can display a PDF or a video player can play a video.

The problem is that who make websites, instead of making documents, maybe built dynamically by the server and with some interactive elements in it, doesn't sent you a document but instead sends you an application that builds the document into the browser, basically turning an application that simply displays you document into a virtual machine that runs an entire graphical environment.

The fact is that most of the websites to function doesn't need a line of JavaScript, and still are downloading Mb of libraries to do what?

Re:Removing HTTP/2 Server Push from Chrome by slaymaker1907 on Friday August 19, 2022 @08:12PM (#32527642)
I think the web is a great application framework, but I agree some sites really don't need as much JS as they use. For example, my note taking setup is a self modifying HTML file that relies heavily on JS for obvious reasons. Your typical blog or news site really doesn't need it in the same way.
Re:Removing HTTP/2 Server Push from Chrome by alerighi on Friday August 26, 2022 @09:17PM (#32614590)
I think that one of the problem of the modern web is that it's seen as an application framework, and we forgot the origin that is the browser as a document viewer, basically.

Most of the problems wouldn't be even present if we reason in terms of documents, and in terms of operations that you can do on these documents (GET, PUT, DELETE, POST). You find out that for most website you don't need JS!

One could argue that JS is an optimization because you don't load up again the whole page each time you navigate to a different URL. That is false: if you cache the assets that doesn't change between pages such as stylesheets and images correctly, downloading just the HTML of the page is something trivial. Look at the number of requests that a webpage that uses JS does: is that more efficient?

Re:Removing HTTP/2 Server Push from Chrome by shadowgovt on Friday August 19, 2022 @10:26PM (#32528426)
> to do what?

Mostly to polyfill around the fact that basic DOM manipulation is garbage and the default UI widgets are ugly.

Re:Removing HTTP/2 Server Push from Chrome by okasaki on Friday August 19, 2022 @02:48PM (#32524698)
Even if so, the javascript doesn't replace the OS "bloat", it adds to it.
Re:Removing HTTP/2 Server Push from Chrome by mrjin on Friday August 19, 2022 @11:16PM (#32528706)
JS is the most abused stuff I guess. Current web apps is a "can we" rather than "should we" approach.
Re:Removing HTTP/2 Server Push from Chrome by allendoerfer on Saturday August 20, 2022 @02:52AM (#32529831)
Humanity is a "can we" approach.
Re:Removing HTTP/2 Server Push from Chrome by aaaaaaaaaaab on Friday August 19, 2022 @03:12PM (#32524945)
Yawn…

Strawman argument.

I just want to read a damn article. Why does it need to download hundreds of resources from dozens of origins? Reading a PDF article on my desktop touches exactly one file, the PDF. Ok, maybe some dylibs from the OS related to PDF rendering. But surprise! Browsers already have everything built-in for HTML rendering! No need to download an HTML rendering engine, because it’s already there: it’s the browser!

Re:Removing HTTP/2 Server Push from Chrome by vbezhenar on Friday August 19, 2022 @05:01PM (#32525855)
Basically because site owner wants to monetise your visit. Those who don't want to monetise you, usually don't put loads of trackers, ads and other stuff which is main reason of those hundreds of requests.
Re:Removing HTTP/2 Server Push from Chrome by staticassertion on Friday August 19, 2022 @05:28PM (#32526145)
Why is multiple files worse than one? PDF is an insanely complex format, I don't think the argument of "I can just read a PDF file" is strong.
Re:Removing HTTP/2 Server Push from Chrome by LtWorf on Friday August 19, 2022 @07:48PM (#32527494)
Because multiple files require multiple roundtrip times, more connections, and the total amount of data is higher because of all the waste that happens with headers.
Re:Removing HTTP/2 Server Push from Chrome by bruce511 on Saturday August 20, 2022 @03:15AM (#32529963)
The headers are not the wasteful part. Headers are typically in the low-hundreds of bytes. This extra data is insignificant as "waste" compared to the request/response content.

The real waste is in the time it takes to create and destroy the connection. (hence why http/3 switched to UDP, and also why multiplexing is a thing.)

Thing is, combining js and css on the server side into 1 file pretty much negates this speed benefit. I've been building sites this way forever, and performance is great. First page takes longer, but then those files are in the cache anyway.

The actual problem is Ads. They require tracking, and of course displaying. If you're looking for waste, or indeed why a server would bother with http/3 then look no further. No ads, no problem.

Unfortunately for those sites that rely on advertising for revenue, I don't have an alternative suggestion. I get it, ads pay for lots of the Internet I "browse". I'm not a fan of pay walls and subscriptions.

So http/3 is a solution to an economic reality - and really only benefits the ad-supported Web - but for them it is important.

Re:Removing HTTP/2 Server Push from Chrome by LocalH on Saturday August 20, 2022 @11:02AM (#32532517)
I/O. An anecdote. A friend of mine was modding a 360/PS3 game recently. He was trying to animate a texture by cycling through an image sequence. The first attempt read every image from disk each time, and ate shit. The second attempt pre-loaded them all, and it works perfectly fine
Re:Removing HTTP/2 Server Push from Chrome by dwheeler on Friday August 19, 2022 @06:49PM (#32527000)
> How exactly [has the] 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?

Ads.

Re:Removing HTTP/2 Server Push from Chrome by edude03 on Friday August 19, 2022 @06:56PM (#32527057)
Also bundlers without treeshaking - I personally once delivered 70MB of compressed JS to clients in production
Re:Removing HTTP/2 Server Push from Chrome by the-anarchist on Friday August 19, 2022 @11:16PM (#32528704)
Your honesty is being appreciated.
Re:Removing HTTP/2 Server Push from Chrome by w-ll on Saturday August 20, 2022 @12:19AM (#32529047)
we've all used moment.js at some point
Re:Removing HTTP/2 Server Push from Chrome by thejosh on Saturday August 20, 2022 @01:09AM (#32529267)
I remember looking at a graph showing our frontend usage of various libraries. Moment was huge, because it depended on so much. At the time there's wasn't really a good alternative though.
Re:Removing HTTP/2 Server Push from Chrome by zxcvbn4038 on Saturday August 20, 2022 @01:37AM (#32529432)
You used jquery? :)
Re:Removing HTTP/2 Server Push from Chrome by jupp0r on Friday August 19, 2022 @04:02PM (#32525389)
> How exactly modern web ended up in a situation where [...]

> it has to download 300 resources from 12 different servers,

> including 2 megabytes of minified javascript?

This is "best practice" that is used widely to work around HTTP 1.1 Head of Line Blocking [1]. HTTP/2 and to a greater degree HTTP/3 (as it also alleviates TCP head of line blocking) are fixing the underlying problem making the former best practice an anti pattern (but only for those users able to use modern HTTP implementations).

[1] https://en.wikipedia.org/wiki/Head-of-line_blocking#In_HTTP

Re:Removing HTTP/2 Server Push from Chrome by divbzero on Friday August 19, 2022 @04:20PM (#32525535)
“12 different servers” and “minified JavaScript” were indeed workarounds for head-of-line blocking, but I think the GP’s main point is that “300 resources” and “2 megabytes” should not be required for displaying a web page.
Re:Removing HTTP/2 Server Push from Chrome by nine_k on Friday August 19, 2022 @04:48PM (#32525741)
They are not required to display a web page. They are mostly required to make money off that web page, and, to a smaller degree, to observe how users interact with it and thus improve it (also aligns with making more money).

Fortunately, Reader Mode is available in a few user-friendly browsers.

Re:Removing HTTP/2 Server Push from Chrome by jupp0r on Saturday August 20, 2022 @04:05PM (#32534790)
Adobe Photoshop and Quake 3 are JS apps nowadays so depending on your use case it's completely legitimate to download hundreds of megabytes of code and data in modern browsers. I once worked on an app that was a heavily optimized tree shaken 40MB bundle of JS because it was a telephony system, video conferencing and document sharing and collaboration app. Completely ok size for that use case.

If it's just a normal non-interactive website then it shouldn't have any javascript in the first place.

Re:Removing HTTP/2 Server Push from Chrome by SahAssar on Friday August 19, 2022 @08:46PM (#32527875)
Newer HTTP versions solve some some things but are not magic pixie dust.

For example:

* If you have file A requiring file B requiring file C requiring file D you still get a chain of requests.

* Compression works a lot better the more data you throw at it, especially similar data which is usually the case for JS/CSS. SDHC was supposed to solve this, but it was never adopted by any major players besides linkedin (and google itself).

Re:Removing HTTP/2 Server Push from Chrome by jupp0r on Saturday August 20, 2022 @04:02PM (#32534777)
HTTP/3 is pixie dust. It solves most problems that previous transport layers had and also supports 0 RTT TLS handshakes in case of QUIC. Of course the transport layer can't magically resolve application layer dependencies as you mentioned, that's not its job.
Re:Removing HTTP/2 Server Push from Chrome by toast0 on Friday August 19, 2022 @09:52PM (#32528278)
HTTP/2 was supposed to help avoid openning too many connections, but of course TCP in TCP is bad form. Now HTTP/3 is TCP in UDP, and has separate connections (more or less) per resource. I'm not sure what the big difference is between that and HTTP/1.1 with multiple TCP connections.

There is an argument for better congestion control. Which is funny coming from Google where they control the kernel on the server and the clients. Yes, it takes more time to deploy better congestion control if it needs kernel updates, but if it's really important to update congestion control without kernel updates, you could make interfaces for usermode congestion control.

Re:Removing HTTP/2 Server Push from Chrome by jupp0r on Saturday August 20, 2022 @03:59PM (#32534762)
Too many TCP connections is a browser limitation (for DDOS prevention reasons mostly). Inside each connection you are limited by head of line blocking, either by HTTP/1.1 itself or by TCP when using HTTP/2. You are correct that HTTP/3 can stream multiple resources over one QUIC connection via multiple channels and each channel can make progress independently from each other channel. Nowadays (assuming a modern browser in a non-udp restricted environment), you can just download hundreds of resources at the same time from the same server through one HTTP/3 connection without much overhead and transport level limitations.
Re:Removing HTTP/2 Server Push from Chrome by toast0 on Saturday August 20, 2022 @05:54PM (#32535470)
Seems like all the churn could have been avoided by webservers advertising a limit on number of connections and browsers opening up to that limit if needed. Maybe in the connection header, or the keep-alive header, or some new header that Google servers and Chrome Browser could have tried out first.
Re:Removing HTTP/2 Server Push from Chrome by jupp0r on Sunday August 21, 2022 @11:45PM (#32547100)
That doesn’t really solve head of line blocking.
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @02:52PM (#32524749)
When working on the Bing web crawler, we tried to take screenshot of webpage to use as thumbnail.

What you describe was a huge pain, most page forced us to download 15MB of data and load it in memory just to display 2 small images and some text.

A format like PDF would have been much better because we could have read enough byte until we are able to render the visible part of the document.

But instead we had to download and execute 30 javascript files.

Re:Removing HTTP/2 Server Push from Chrome by mrjin on Friday August 19, 2022 @10:50PM (#32528552)
LOL, only 2MB of minified javascript? How about those over 20MB ones?
Re:Removing HTTP/2 Server Push from Chrome by Koffiepoeder on Friday August 19, 2022 @01:02PM (#32523539)
Use 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.
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @01:08PM (#32523594)
A stronger version of msoad's point would be deciding whether to push a dark or light image, based on the user's theme.
Re:Removing HTTP/2 Server Push from Chrome by msoad on Friday August 19, 2022 @04:19PM (#32525528)
You can solve this using the <picture> element. As Github does:https://github.blog/changelog/2022-08-15-specify-theme-conte...
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @07:36PM (#32527416)
We'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.
Re:Removing HTTP/2 Server Push from Chrome by mikewhy on Friday August 19, 2022 @01:16PM (#32523687)
That sounds exactly like "The client should manage the resources on the client not the server"
Re:Removing HTTP/2 Server Push from Chrome by zamadatix on Friday August 19, 2022 @10:09PM (#32528354)
Nowadays 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.
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @12:58PM (#32523481)
I 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/

Re:Removing HTTP/2 Server Push from Chrome by msoad on Friday August 19, 2022 @01:58PM (#32524182)
> 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!

Re:Removing HTTP/2 Server Push from Chrome by panopticon on Friday August 19, 2022 @02:19PM (#32524410)
Works on Chrome 104 for me: https://sec-ch-prefers-color-scheme.glitch.me/

Note that the server has to request that header using accept-ch.

Re:Removing HTTP/2 Server Push from Chrome by msoad on Friday August 19, 2022 @02:58PM (#32524792)

    curl --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"
Re:Removing HTTP/2 Server Push from Chrome by riedel on Friday August 19, 2022 @04:33PM (#32525645)
Push 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.
Re:Removing HTTP/2 Server Push from Chrome by fzfaa on Friday August 19, 2022 @01:22PM (#32523761)
> How the server can know if user wants dark mode or light mode CSS file?

Cookies? Custom header?

Re:Removing HTTP/2 Server Push from Chrome by nousermane on Friday August 19, 2022 @12:58PM (#32523485)
Wasn'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.

Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @01:02PM (#32523528)
That'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.
Re:Removing HTTP/2 Server Push from Chrome by vbezhenar on Friday August 19, 2022 @02:13PM (#32524363)
Client can send bloom filter with first request.
Re:Removing HTTP/2 Server Push from Chrome by habibur on Friday August 19, 2022 @02:50PM (#32524721)
How? The client needs to know what the resources are to create a bloom filter. It doesn't know that before 1st request.
Re:Removing HTTP/2 Server Push from Chrome by vbezhenar on Friday August 19, 2022 @05:02PM (#32525865)
First 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).
Re:Removing HTTP/2 Server Push from Chrome by mort96 on Saturday August 20, 2022 @04:33AM (#32530389)
But for subsequent requests the content is cached.
Re:Removing HTTP/2 Server Push from Chrome by skyde on Friday August 19, 2022 @02:56PM (#32524779)
your browser can have a bloom filter for each subdomain.
Re:Removing HTTP/2 Server Push from Chrome by saurik on Friday August 19, 2022 @01:57PM (#32524166)
I'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.
Re:Removing HTTP/2 Server Push from Chrome by 0x457 on Friday August 19, 2022 @03:16PM (#32524972)
I think it was something much simpler: oh, you're navigating to `index.html` without session? You're going to need this CSS, JS and PNG files as well.

And the idea is that client would already have those files by the time browsers parses `<head>` it already has them all. Except...browser cache exists, so who cares.

Re:Removing HTTP/2 Server Push from Chrome by mmis1000 on Friday August 19, 2022 @02:40PM (#32524613)
Ans it turns out the way this was implemented didn't really works well. There just isn't a universal format that you can generate the list and upload it to server/cdn/whatever. No one ever figure out how to actually use this list to generate a http2 server push from a common platform/cdn.

The alternative (Service worker/<meta> preferch/preload tags) on other hand are much easier to handle although have one extra round trip. Because they are just text files that you need to upload to the server.