对于LAMP服务器提供的html、css和javascript文件,这两种方法都有什么好处?有没有更好的选择?

服务器使用Json向地图应用程序提供信息,因此需要大量的小文件。

是否有任何性能打击涉及选择gzip而不是deflate的http压缩?


当前回答

There shouldn't be any difference in gzip & deflate for decompression. Gzip is just deflate with a few dozen byte header wrapped around it including a checksum. The checksum is the reason for the slower compression. However when you're precompressing zillions of files you want those checksums as a sanity check in your filesystem. In addition you can utilize commandline tools to get stats on the file. For our site we are precompressing a ton of static data (the entire open directory, 13,000 games, autocomplete for millions of keywords, etc.) and we are ranked 95% faster than all websites by Alexa. Faxo Search. However, we do utilize a home grown proprietary web server. Apache/mod_deflate just didn't cut it. When those files are compressed into the filesystem not only do you take a hit for your file with the minimum filesystem block size but all the unnecessary overhead in managing the file in the filesystem that the webserver could care less about. Your concerns should be total disk footprint and access/decompression time and secondarily speed in being able to get this data precompressed. The footprint is important because even though disk space is cheap you want as much as possible to fit in the cache.

其他回答

在已经安装了Apache2和deflate模块的Ubuntu上(这是默认的),你可以在两个简单的步骤中启用deflate gzip压缩:

a2enmod deflate
/etc/init.d/apache2 force-reload

你走了!我发现我通过adsl连接访问的页面加载得更快。

编辑:根据@GertvandenBerg的评论,这支持gzip压缩,而不是deflate。

我认为deflate和gzip之间没有太大的区别,因为gzip基本上只是一个包在deflate周围的头文件(参见rfc 1951和1952)。

There shouldn't be any difference in gzip & deflate for decompression. Gzip is just deflate with a few dozen byte header wrapped around it including a checksum. The checksum is the reason for the slower compression. However when you're precompressing zillions of files you want those checksums as a sanity check in your filesystem. In addition you can utilize commandline tools to get stats on the file. For our site we are precompressing a ton of static data (the entire open directory, 13,000 games, autocomplete for millions of keywords, etc.) and we are ranked 95% faster than all websites by Alexa. Faxo Search. However, we do utilize a home grown proprietary web server. Apache/mod_deflate just didn't cut it. When those files are compressed into the filesystem not only do you take a hit for your file with the minimum filesystem block size but all the unnecessary overhead in managing the file in the filesystem that the webserver could care less about. Your concerns should be total disk footprint and access/decompression time and secondarily speed in being able to get this data precompressed. The footprint is important because even though disk space is cheap you want as much as possible to fit in the cache.

GZip只是deflate加上一个校验和和页眉/页脚。不过,我从惨痛的教训中学到,通缩的速度更快。

(来源:typepad.com)

如果我没记错的话

Gzip将压缩比deflate多一点 通缩更有效