Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gzip、deflate的压缩支持 #4

Open
kaingeyy opened this issue Jan 22, 2021 · 1 comment
Open

gzip、deflate的压缩支持 #4

kaingeyy opened this issue Jan 22, 2021 · 1 comment

Comments

@kaingeyy
Copy link

目前的版本不提供gzip、deflate的压缩支持?
我看配置文件里已经有gzip配置项了

@kehengzhong
Copy link
Owner

目前版本不支持采用gzip、deflate对文件进行压缩,原计划是将zlib开源库添加进来的,所以配置文件里确实留下了gzip压缩的配置项。

没有添加gzip到当前版本,考虑如下几个因素:

  1. 使用压缩后,会降低服务器发送数据给客户端的效率。由于大量采用zero-copy技术(sendfile、writev),服务器返回数据(包括大文件等)效率较高,如果采用gzip压缩,文件读入内存进行压缩运算,再返回给客户端,明显降低性能。
  2. 压缩功能主要针对text/*类型,数据量不大,且在当今网络带宽普遍较高的情况下,这点压缩解决不了痛点问题,反而使得客户端和服务器端额外消耗一定的运算开销。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants