Request big JS file very slow if enable gzip on

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

  1. 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

  1. 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:

On Monday 27 October 2014 10:29:46 Dewangga wrote:

Hi,

Have you tried to put gzip_comp_level on level 9? Based on
Module ngx_http_gzip_module

This is a very bad advice. The difference in compression ratio
between level 1 and level 9 is about ~10%, while the last one is
a few times more CPU hungry.

wbr, Valentin V. Bartenev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Have you tried to put gzip_comp_level on level 9? Based on
http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_comp_level

And tried to put gzip_proxied any
http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_proxied

On 10/27/2014 10:04, colky wrote:

http {

}

}


for others settings all are default.

(222KB) and http://dev.szsmk.com/wx/js/libs/angular/angular.min.js

sending response to client, client: 49.73.183.141, server: ,
Request big JS file very slow if enable gzip on

_______________________________________________ nginx mailing list
[email protected] nginx Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQEcBAEBAgAGBQJUTbwpAAoJEF1+odKB6YIxsrAIALTHByADso70Sl1/qMPpJfEF
/6T+uDt7mB4D3+x0QAoVbQ9KSofDUZiujL0weOKtuL+3YkLy+fSSmdHA1pIIWnq+
Mjfpr4Qwtr/k5cWl39SuKm3RATLodJznCqyLiTTAkHPM8LNcvvch8jgWgoPVnmRb
ihZYjCgVDk0Nx0WjS7phUWqf7uwiALYTSMtHELcdAKT6zOQr8JfhVVoFU5EO6kin
OWShNVyd7AtkwgWE2d8cYzYMNuKYpKKlrifz3YBOMZf62B1NAPhgpwEko8AqYn2w
28WdMCf/J/iD/YdecjVIbtvXxyKFQjXcdRJrqVfgw4qqeSlrl6UjXJE1lF2hjBM=
=r5uY
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Oh sorry, I still use the comp_level to 9. Should I decrease it? If
yes, which value?

Sorry for thread discussion hijacking :slight_smile:

On 10/27/2014 10:44, Valentin V. Bartenev wrote:

few times more CPU hungry.

wbr, Valentin V. Bartenev

_______________________________________________ nginx mailing list
[email protected] nginx Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQEcBAEBAgAGBQJUTcF5AAoJEF1+odKB6YIxfZwH/0CaEU1l0aj/Fp6Ganz7rKCg
tUhciElYHvV3WIm7dqBTKUQlajvoLq1FOvRtbiAreHNiKIBVevOW9Dj+eqDW6tNU
SWjKGCsKWlR7V0zypg+y3AFN9vUtFAS0rY8S14VcdJ4bnhpAUiTs9K5xQzcXptbB
8koy+KwBV+FKpl+Pe4vYI9Wrg2qJygLEBLBmpzeC/MaKy/YEfnspVUNHDt3kx7vs
a9KTJEckSMgK+uP0D/dbDjGbZxUha7fvNDvj8N2wowM+6j7zD9xfTWBZHHnntGGj
J1oJrOEYVuN0QwqRy90CPWu1fGtXNx3mP/P0CjotZaGno0aaE5ef6SB4XvfD6jc=
=s6Oj
-----END PGP SIGNATURE-----

On Monday 27 October 2014 10:52:26 Dewangga wrote:

Hi,

Oh sorry, I still use the comp_level to 9. Should I decrease it? If
yes, which value?

Try to benchmark to find out what is the best for your server.

I think the optimal levels for realtime compression is 1-3.

wbr, Valentin V. Bartenev

Does anybody knows how to resolve the issue? Thanks very much if can got
your help~

Posted at Nginx Forum:

On Tuesday 28 October 2014 21:45:10 colky wrote:

Does anybody knows how to resolve the issue? Thanks very much if can got
your help~

It looks like a network problem. Without additional information and
investigation what’s happening on the wire, it’s really hard to suggest
something.

wbr, Valentin V. Bartenev

I always use " gzip_comp_level 4;".

and i already tried “gzip_proxied any;” before, the gzip_proxied
property is use for jboss response content. in my settings, js file is
handled by Nginx, not jboss:

location /wx/js/ {
    root

/home/developer/jboss/server/citycard_dev/deploy/citycard.war/;
}

What the issue made me headache is sometimes the page load very fast(1
second), sometimes /wx/js/libs/jquery-ui-1.10.3.min.js load pending more
than 30 seconds. I’m sure it should be Nginx issue but don’t know how to
find reason of the issue. In debug log i cannot found any valuable logs.

Posted at Nginx Forum: