views:

43

answers:

2

Since gzip takes time to pack on the server side, and more time to unpack on the client side, how large does a file need to be in order to benefit from it?

Are there any real numbers out there that demonstrate the efficacy of gzip at common download speeds?

+3  A: 

It will depend heavily in the nature of the data to be transferred (i.e. how much compressible is the data you are working on). If you are concerned about the time it takes to get the original file on the client side you should compare:

a) time taken to compress the file in the server + time taken to transfer the compressed file from the server to the client + time taken to decompress the file in the client

b) time taken to transfer the original (uncompressed) file from the server to the client.

I believe you would have to try and measure these figures using actual sample data of your application. For example, if you were dealing with video files (uncompressable) then it would probably be better just to send the file without compressing it. However, if for example, you were dealing with text files (highly compressable) then the overall time used for a) might be lower than b)

gusbro
+1  A: 

Not very large, gzip compress text very well, even small. CPU is much cheaper than transfer. 1M file compressed to 100K will be downloaded ten times faster. You should not gzip jpgs,mp3 and any other already compressed data.

iddqd