Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#491 closed defect (worksforme)

performance issue on same url

Reported by: 玲奈 神楽坂 Owned by:
Priority: minor Milestone: 1.5
Component: nginx-core Version: 1.5.x
Keywords: Cc:
uname -a: Linux zh99998 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.5.8
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-http_spdy_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.5.8/debian/modules/headers-more-nginx-module --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-development-kit --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-http-push --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-upload-progress --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-upload-module-2.2 --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-cache-purge

Description

i have a site with one both http and websocket location

map $http_upgrade $connection_upgrade {

default upgrade;
close;

}
server {

location /rooms.json {

proxy_pass http://unix:/tmp/mycard-server.sock;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

}
.... other locations

}

about ~1000 long websocket connections on this url. then this url is very slow, choke up about 5s before it returns content.

but other urls is good. server load is low.

if connect to backend http://unix:/tmp/mycard-server.sock directly. it will be good. return content immediately

even i make a new url such as test.json. and configure as exactly same as rooms.json, it will be good. (there's no no load on the new test.json, while there's about 1000 long connections on production url rooms.json . my backend don't care about request path/url).

and even just a query-string will make things better
visit /rooms.json?a=1 will be good

then i add a rewrite to nginx conf to add a query automaticly

rewrite /rooms.json$ /rooms.json?$time_iso8601 last;

it works! no block anymore, visit to /rooms.json will return content immediately.

for me, this rewrite solved all. but it's very strange so i reported this as bug.

Change History (3)

comment:1 by Maxim Dounin, 11 years ago

Are you able to reproduce the problem without 3rd party modules compiled in? If yes - please provide debug log and full configuration to reproduce the problem, see http://wiki.nginx.org/Debugging for some tips.

comment:2 by Maxim Dounin, 11 years ago

Resolution: worksforme
Status: newclosed

Feedback timeout.

comment:3 by thresh, 10 years ago

I havent been able to reproduce performance degradation on "long" websocket connections, assuming long is 3 hours at least. Using node.js ws module as a simple server, tested on both unix domains and tcp sockets. I tried 1k, 2k and 10k websocket connections proxied by nginx-1.7.0 and response times didnt increase. New connections through nginx and directly to the backend server established just fine.

Note: See TracTickets for help on using tickets.