2

As I understand it, in SPDY push the server serves up an HTML doc, looks at it before sending it, and decides I need images/css resources X Y and Z, so sends them over as well.

How does it know to not bother, if they're already cached by my browser? Or is there basically no point in trying to cache static resources if your clients are using spdy/3 browsers?

(Obviously not every client will be, but i'm interested for this case)

2 Answers 2

3

According to the resources on the Chromium developer website this is one of the disadvantages. It is not possible for the server to know whether the client already has the resource so it could be a wasted transfer.

Source: http://www.chromium.org/spdy/link-headers-and-server-hint

4

If you really need to optimize the first page load time:

  • Generate a signature (substring of md5/sha hash) of all your bootstrap static files needed during the first page load. This is typically only basic css + js to bootstrap. From there on, usually js is loading stuff (specially of client-rich applications, so you won't need server push and clients will reuse cache appropriately)
  • Set a long lasting cookie "bootstrap-version" set to the bootstrap version signature.
  • When the client request the page:

    • if the bootstrap-version cookie is not up-to-date or it's not present, initiate server push of the bootstrap files.
    • Otherwise, assume client have them cached (might not, causing a small regression, but for 99% of the cases it will)

That way you will achieve a very high efficiency and first page loads will effectively look as repeated visits with cache due to server push.

Go and node spdy implementations allow you to play with server push. AFAIK nginx/apache modules don't yet have this features. I hope they add it soon based on application-provided headers or similar.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .