I enabled gzip on my nginx reverse proxy which is hosted on EC2 free tier (so lightweight server). I noticed that my request latency increased by almost 2x (13+KB compressed to 4+KB). The only issue that I can think of is that the compression on the server is taking a long time for large payloads which is why overall latency is worse, but 1.) I'm not really sure how to verify this and 2.) tuning the parameters seems to have no effect (compression level and # of buffers). Lastly, there isn't a noticeable change in CPU util for my host.
Here is my server block:
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;
}
Does anyone have any pointers on this issue?