Is it good to use Transfer-Encoding: chunked on static files?

I have your normal static site where the server grabs .html files and submits them.

I understand the importance of Transfer-Encoding: chunked

dynamic server pages, as that's what it is for. The acceleration can be pretty incredible. But is this speed increase for static files? Do browsers already process and fetch with requests using Content-Length

when the file arrives over the wire?

I have very serious HTML (documents over a hundred pages) so progressive HTML processing will be critical. (Kind of like the WHATWG provides a monolithic one-page HTML5 spec.)

+3


source to share


1 answer


Short answer: Yes, browsers gradually render content sent with a header Content-Length

. In fact, the browser does a little less computation if it has a header Content-Length

, since it knows how long it takes for the document to take from parsing the document for chunk information.

The header Content-Length

(if any) must be submitted before any content is posted. Therefore, the server must know the length of the document before sending any document content.



Interleaving encoding is performed only for dynamic content. If the server could only use the header Content-Length

, for dynamic content, it would need to finish document creation before sending any content at all. This can lead the client to wait, possibly a long time, without seeing any document.

Chunked encoding solves this by allowing the server to not send the header Content-Length

.

+4


source







All Articles