Git Product home page Git Product logo

Comments (11)

JacobBennett avatar JacobBennett commented on August 17, 2024 1

Thanks Michael! Looking forward to the PR :)

:octocat: Sent from GH.

from laravel-http2serverpush.

JacobBennett avatar JacobBennett commented on August 17, 2024

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.

michaeldyrynda avatar michaeldyrynda commented on August 17, 2024

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.

bradleyfalzon avatar bradleyfalzon commented on August 17, 2024

No CF/Apache use Link headers approach, the Cookie thing was something else.

from laravel-http2serverpush.

JacobBennett avatar JacobBennett commented on August 17, 2024

https://twitter.com/simevidas/status/760892541654949888

image

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.

GrahamCampbell avatar GrahamCampbell commented on August 17, 2024

Ideal situation would be to use machine learning to learn which files change more often and push them.

from laravel-http2serverpush.

GrahamCampbell avatar GrahamCampbell commented on August 17, 2024

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.

bradleyfalzon avatar bradleyfalzon commented on August 17, 2024

@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.

JacobBennett avatar JacobBennett commented on August 17, 2024

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.

joruro avatar joruro commented on August 17, 2024

@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.

JacobBennett avatar JacobBennett commented on August 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.