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

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

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


当前回答

Mod_deflate需要更少的服务器资源,尽管您可能会在压缩量方面付出一些代价。

如果您正在处理许多小文件,我建议您对压缩和未压缩的解决方案进行基准测试和负载测试——您可能会发现在某些情况下启用压缩并不能节省成本。

其他回答

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

(来源:typepad.com)

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

Mod_deflate需要更少的服务器资源,尽管您可能会在压缩量方面付出一些代价。

如果您正在处理许多小文件,我建议您对压缩和未压缩的解决方案进行基准测试和负载测试——您可能会发现在某些情况下启用压缩并不能节省成本。

实际上,你可能无法选择通缩作为一个选项。与你所期望的相反,mod_deflate使用的不是deflate而是gzip。因此,虽然大多数观点都是正确的,但可能与大多数人无关。

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.