Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Server Hint vs Server Push


On Tue, Mar 31, 2015 at 11:08 AM, Guillaume Drouet <guidrouet@xxxxxxxxx> wrote:
> Hi,
> There is an interesting answer from Simon Bordet on stackoverflow regarding
> server push exchanges:
> So, server starts pushing some resources that could be already in the client
> cache. When the browser detects the promised push is related to a cached
> value, it cancels  it, possibly after that the transfers starts. We can say
> that's the most efficient way to reduce latency and consequently to improve
> user experience.
> Another technique is server-hints, which let the browser check if the
> resources referenced in the link header's page exist in the cache before
> loading it.  We can't say that it's faster than server-push because
> additional exchange are required before the resource transfer starts.
> However it still very fast with HTTP/2 because the browser takes advantage
> from multiplexing. Moreover, it consumes only the bandwidth it really needs
> and should consume less CPU cycles than server push which often needs to
> perform a push cancellation.
> Do you consider that server-hints are absolete considering server-push
> capacity? I'm not convinced of that since an overhead is associated to
> server-push. HTTP/2 wants to optimize data transfer and consequently improve
> our battery life, which is not the case if our devices consume more
> bandwidth and CPU than necessary.
> In practice, we really need to compare the two techniques in real life
> project to see how server-push is faster that server-hints and how
> server-hints is economical comparing to server-push, but before this I want
> to know your opinion.

Indeed, benchmarks will be needed for this.

I can see value in server hints, but I feel they are cumbersome to add manually.
During the maintenance of a page, where resources such as CSS, JS or
images may be renamed, added or removed, you don't want to track this
manually, you want the container (or some other automation) to do this
for you.

However, perhaps the push mechanism may be converted to the hint
mechanism when the client is requesting the primary resource.
For example:

GET /primary.html HTTP/2
HTTP2-Push: hint

The additional "HTTP2-Push" header tells the server how it wants
pushes to be handled: could be "push" (i.e. send the pushes), "hint"
(i.e. send hints), or "none" (i.e. push is completely disabled).

When the container enters the push code, it can look at the request of
the primary resource, see if it has the "HTTP2-Push" header, and
either send PUSH_PROMISES or add "Link:" headers to the response.

This would be trivial to implement.

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

Back to the top