You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by 孙俊 <wi...@gmail.com> on 2011/06/07 05:06:48 UTC

[users@httpd] About file compression and transmission

About file compression and transmission

I know that the text file you can use the apache module gzip compressed
transmission.

The file is stored in text format prior to transmission is, every time there
is file access,
apache the file in memory after compression by gzip module to send to the
client.
That there is duplication of the same file read, compression, transmission.

Is there any function can use a similar gzip file compression program stored in
advance,
For example, jquery.js.gz, when there is access to jquery.js jquery.js.gz
sent directly to the client,
The client to decompress the file. Rather than to repeat the compression
jquery.js apache files.




关于文件压缩传输

我知道文本文件可以使用apache的gzip模块实现压缩后传输。

在文件被传输之前是以文本格式存放的,每次有文件访问,
apache将文件读入内存经gzip模块压缩后,传送给客户端。
这就存在同一个文件重复的读取、压缩、传递。

是否有什么功能能将文件使用类似gzip程序进行事先压缩存放,
例如,jquery.js.gz,在有访问jquery.js时直接将jquery.js.gz发送给客户端,
让客户端进行文件的解压缩。而不再使apache重复的压缩jquery.js文件。

Re: [users@httpd] About file compression and transmission

Posted by Mark Montague <ma...@catseye.org>.
 On June 6, 2011 23:06 , =?GB2312?B?y++/oQ==?= <wi...@gmail.com> wrote:
> The file is stored in text format prior to transmission is, every time
> there is file access,
> apache the file in memory after compression by gzip module to send to
> the client.
> That there is duplication of the same file read, compression,
> transmission.
>
> Is there any function can use a similar gzip file compression program
> stored in advance,
> For example, jquery.js.gz, when there is access to jquery.js
> jquery.js.gz sent directly to the client,
> The client to decompress the file. Rather than to repeat the
> compression jquery.js apache files.

Use mod_deflate, see
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html The files will not
be compressed in advance, but this is OK: cost of compression is
minimal, and modern CPUs can easily do it without problems.

I do not recommend this, but if you still want to compress files in
advance, see
http://www.cravediy.com/59-Simple-gzip-Support-for-Apache-with-mod_rewrite.html
Note that even though the files are compressed in advance, there is
duplication of the same file read and transmission -- the only thing you
save is the compression step. But this requires you to have two copies
of every file: a compressed copy, and an uncompressed copy (for browsers
that do not support compressed content encoding). Also, be careful to
re-create the compressed version any time you update the non-compressed
version, or you will serve different versions of the files to different
web browsers and this problem may be hard to diagnose.

--
  Mark Montague
  mark@catseye.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] About file compression and transmission

Posted by Eric Covener <co...@gmail.com>.
2011/6/6 孙俊 <wi...@gmail.com>:
> About file compression and transmission
>
> I know that the text file you can use the apache module gzip compressed
> transmission.
>
> The file is stored in text format prior to transmission is, every time there
> is file access,
> apache the file in memory after compression by gzip module to send to the
> client.
> That there is duplication of the same file read, compression, transmission.
>
> Is there any function can use a similar gzip file compression program stored
> in advance,
> For example, jquery.js.gz, when there is access to jquery.js jquery.js.gz


mod_negotiation can provide either jquery.js or jquery.js.gz depending
on the request, for requests of "jquery", but not "jquery.js".


> sent directly to the client,
> The client to decompress the file. Rather than to repeat the compression
> jquery.js apache files.
>
>
>
>
> 关于文件压缩传输
>
> 我知道文本文件可以使用apache的gzip模块实现压缩后传输。
>
> 在文件被传输之前是以文本格式存放的,每次有文件访问,
> apache将文件读入内存经gzip模块压缩后,传送给客户端。
> 这就存在同一个文件重复的读取、压缩、传递。
>
> 是否有什么功能能将文件使用类似gzip程序进行事先压缩存放,
> 例如,jquery.js.gz,在有访问jquery.js时直接将jquery.js.gz发送给客户端,
> 让客户端进行文件的解压缩。而不再使apache重复的压缩jquery.js文件。



-- 
Eric Covener
covener@gmail.com