Request big JS file very slow if enable gzip on

colky nginx-forum at nginx.us
Mon Oct 27 03:04:42 UTC 2014


Sorry about everyone, i posted in another forum but not got any response,
really really hope can got your all help about the issue which already
confuse me many days.

I installed nginx-1.6.2-1.el6.ngx.x86_64 with yum on CentOS 6.5 system.
below are my settings:

nginx.conf
--------------------------------------------------------------------------------------------------------------
http {
error_log /var/log/nginx/error.log debug;

.............
#added
limit_conn_zone $binary_remote_addr zone=addr:10m;
gzip on;
gzip_types text/plain text/css application/json application/x-javascript
text/xml application/xml application/xml+rss text/javascript;

upstream szsmk_dev {
ip_hash;
server 172.17.3.22:28080;
server 172.17.3.22:28180;
}


server {
listen 172.17.3.22:80 default_server;

location /wx/js/ {
root /home/developer/jboss/server/citycard_dev/deploy/citycard.war/;
}
location /wx/css/ {
root /home/developer/jboss/server/citycard_dev/deploy/citycard.war/;
}



location / {
limit_conn addr 1000;
proxy_pass http://szsmk_dev;
}

}

}
--------------------------------------------------------------------------------------------------------------
for others settings all are default.

Test page: http://dev.szsmk.com/wx/ticket/index
Test browser: Chrome (disabled cache)

when i disabled gzip and everything runs well, but if set gzip as on, i got
below 3 different results if refresh the page in chrome.

1. very slow to load (80%)
Most times the page will need more than 20 ~ 60 seconds to be loaded. I
checked and found mostly were blocked by
http://dev.szsmk.com/wx/js/libs/jquery-ui-1.10.3.min.js (222KB) and
http://dev.szsmk.com/wx/js/libs/angular/angular.min.js (105KB). For all
other files which little than 100kb load very fast.

error.log:
2014/10/26 20:44:30 [info] 20917#0: *80 client 49.73.183.141 closed
keepalive connection
2014/10/26 20:44:30 [info] 20917#0: *83 client 49.73.183.141 closed
keepalive connection
2014/10/26 20:44:30 [info] 20917#0: *82 client 49.73.183.141 closed
keepalive connection
2014/10/26 20:44:30 [info] 20917#0: *85 client 49.73.183.141 closed
keepalive connection

2. Response error: (10%)

for jquery-ui-1.10.3.min.js or angular.min.js, often got below error when
request:

in browser shows: "(failed) net::ERR_EMPTY_RESPONSE"


in error.log shows:
2014/10/26 20:27:13 [info] 20917#0: *28 client prematurely closed connection
(104: Connection reset by peer) while sending response to client, client:
49.73.183.141, server: , request: "GET /wx/js/libs/jquery-ui-1.10.3.min.js
HTTP/1.1", host: "dev.szsmk.com", referrer:
"http://dev.szsmk.com/wx/ticket/index"


3. load success(10%)
Sometimes i will can load the page success within 10 seconds

Anybody can tell me how to enable gzip and resolve the issue?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254292,254292#msg-254292



More information about the nginx mailing list