gzippo icon indicating copy to clipboard operation
gzippo copied to clipboard

ETag is bad for clustered environment

Open asafyish opened this issue 12 years ago • 0 comments

Hi,

I see that you calculate the etag using the file mtime (modify time), this is all nice and good when working from a single machine with a single copy of the file been served, but can be really problematic when serving from a cluster since the file is located across machines (with different mtime) and therefor different etag, causing the cached file to invalidated over and over again.

Maybe you can use md5/sha1 of the file instead of mtime, this way even from different machines in the cluster you will get the same etag.

I am aware that I shouldn't serve static files straight from node.js and use some kind of reverse proxy(nginx, varnish, squid) between node.js and the outer world.

See http://developer.yahoo.com/performance/rules.html#etags

asafyish avatar Feb 15 '12 16:02 asafyish