Comments (11)
Thanks Michael! Looking forward to the PR :) Sent from GH.
from laravel-http2serverpush.
Would be interested to read the spec on this, and how it is being handled elsewhere. Do you have any resources that you used when looking around on this?
from laravel-http2serverpush.
Only the conversations I had with @bradleyfalzon about it; he implemented a similar thing in Go for a project he was toying with.
It makes sense, though. You don't want to push bytes to the client that aren't needed, only for them to be rejected. Brad was saying that I think CloudFlare and S3 were using a similar cookie-based approach.
from laravel-http2serverpush.
No CF/Apache use Link headers approach, the Cookie thing was something else.
from laravel-http2serverpush.
https://twitter.com/simevidas/status/760892541654949888
is Nopush the solution here, so it would just preload?
Reading this article gives some insights
https://blog.yoav.ws/being_pushy/
from laravel-http2serverpush.
Ideal situation would be to use machine learning to learn which files change more often and push them.
from laravel-http2serverpush.
An easier more immediate thing that would be easy to do is keep track of what files were already pushed on a session, and don't push them for the next request.
from laravel-http2serverpush.
@JacobBennett nopush would simply tell the web browser there is a resource it probably needs and to fetch it, negating the benefits of h2push.
@GrahamCampbell in theory is right on his second point, but to be effective under any reasonable amount of requests would likely consume too much RAM (each resource needs to be tracked for each session). You'd want to bound the memory used, and this could still push more resources than required. For many sites it'd be fine.
I'm of the opinion, unless you know a resource is required, you shouldn't push it to optimise performance, you don't know what bandwidth or battery is available to the client.
The cookie method is pretty straight forward, if you already have cookies with expire times in the far future (even just a couple days based on old Yahoo research), and someone browses to your website without cookies - it's almost certain they don't have resources and you can safely push those that you know they will need. This is a simple and cheap strategy that is almost universally applicable.
Also, be careful about which resources you're pushing, the client knows best which resources it needs first, so often it's just better to push the resources that really matter, essentially CSS and perhaps fonts (but fonts are harder - which font type does the browser support?).
from laravel-http2serverpush.
Just finished reading This Paper on the topic and I'm now more confused than ever on what this Middleware should be doing. This spec still seems very much under development and testing and as it matures I'm sure that this Middleware will have to change to accommodate best practices.
from laravel-http2serverpush.
@JacobBennett Since at this moment is too soon to make a decision, why not you leave the responsible of choosing which files types to push and the push status to the developer side? For instance, using a config.
from laravel-http2serverpush.
@joruro this exists over here although I may eventually add the ability to push additional resources with a global helper.
from laravel-http2serverpush.
Related Issues (20)
- Wrong type comparison in Laravel 5.3 HOT 9
- Unclear documentation on usage HOT 2
- Package overwrites Link header HOT 1
- Incompatible with Laravel 5.6 HOT 1
- Incompatible with Laravel 5.6 HOT 1
- Premature end of script headers: ea-php71 HOT 4
- Duplicate links
- Error with relative urls
- You can use my fork HOT 1
- Exclude by keywords does not work HOT 1
- Laravel 6 support ? HOT 1
- Laravel 6.x dosn't install HOT 3
- Assets without protocol was inserted in header with a single slash HOT 1
- Packagist repo is not updated HOT 1
- Laravel 7 support? HOT 1
- Is it possible to support font type files? HOT 1
- Unable to locate publishable resources.
- Fetch type not supported HOT 1
- PHP8 Support? HOT 2
- Crashes on iOS Safari
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-http2serverpush.