nginx gzip 服务器性能不佳

nginx gzip 服务器性能不佳

我在托管在 EC2 免费套餐(轻量级服务器)上的 nginx 反向代理上启用了 gzip。我注意到我的请求延迟增加了近 2 倍(13+KB 压缩到 4+KB)。我能想到的唯一问题是服务器上的压缩对于大型有效负载需要很长时间,这就是为什么整体延迟更糟,但 1.) 我真的不确定如何验证这一点,2.) 调整参数似乎没有效果(压缩级别和缓冲区数量)。最后,我的主机的 CPU 利用率没有明显变化。

这是我的服务器块:

server {
    # ....

    gzip on;
    gzip_types text/plain application/xml application/json;
    gzip_comp_level 3;
    gzip_proxied no-cache no-store private expired auth;
    gzip_buffers 2048 4k; # unsure about effect here
    gzip_min_length 1024;


    location / {
        proxy_pass http://localhost:8080;
    }

有人对这个问题有什么指点吗?

相关内容