Is it or can it be enabled for ResourceLoader modules?
Topic on Talk:ResourceLoader/Architecture
Push only works well for something that needs constant updating? Why would you update a RL module?
@Jeblad, no, that's not what push means in the context of HTTP/2. See also HTTP/2 Server Push.
The answer is, no it cannot be enabled for RL modules specifically. But we also don't need it as much, because we already have ResourceLoader (basically HTTP 2.0 push solves a problem that we already had to solve before http 2.0 became a thing). So while there are benefits to server push, we don't benefit as much of it as we would have, if we never would have had ResourceLoader.
If that makes sense.
As @TheDJ mentions, there isn't currently any code in ResourceLoader that relates to "Server Push" and we don't currently have a strong need to add explicit support for pushing responses given that we already have quite good performance without it.
Also, one should be careful with pushing resources because it can actually make performance worse. The main problem with Server Push is that it doesn't take into account the web browser's existing cache.
Without server push, the story is like this:
- User visits their first page on a wiki.
- User's web browser receives page HTML and makes subsequent requests for resources.
- MediaWiki, being made for scale, allows these resources to be cached by the browser.
- User visits another page on the wiki.
- User's web browser receives page HTML and discovers urls for resources. Web browsers realises it has these in its cache already and makes 0 subsequent requests.
With basic server push, if you push the resources each time, it will saturate the bandwidth and therefore needlessly cause competition with other resources (such as images, and the HTML itself).
See also https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/ and other articles about server push.
Lastly, note that in 2017, the Wikimedia Performance Team has introduces several uses of "preload" in MediaWiki and ResourceLoader. This browser feature is similar to push in that it allows telling a browser about a resource before it knows it needs it. The difference is that it makes the browser responsible for deciding to make a request, which means it works with browser cache.
Further reading: