Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

Re: speed issues - how to diagnose it correctly?

$
0
0
I've done some tests and the picture is appears to be the following.

First, the app I'm deploying is an ASP.NET 5 app on Ubuntu machine. As it can only listen on local port (if not involving some root configurations), I'm using nginx to proxy-pass all requests to it from an external port and, optionally, a server name.

According to the app log, the requested page is actually rendered quite fast, then application starts to pass it to nginx, but suddenly stops transmitting data without warning (or nginx stops to read the data, while playing as if it is still listening). And transmission is always cut only when close to the end, so if there is more data, the part of this data can make its way through nginx. And if there is very small amount of data to be passed, then almost nothing is passed at all, just response headers. Nginx seems to be unaware of the transmission stop and just waits it to continue, and once it hits the timeout, it just transmits all the data it received to the moment. For small simple template pages it is just response headers. For the larger page with a couple of kilobytes it is also most of the page's html transmitted, but page is incomplete (no closing body and html tags and some other markup).

I've created an Ubuntu Desktop VM, and configured it just like I did to my server, except one thing - I did not used nginx this time, but just accessing the local port from the local (to the VM) browser, like http://127.0.0.1:5002. The app was working well. But once I've configured a nginx proxy-pass:

server {
listen 8080;
server_name localhost;

proxy_connect_timeout 5;
proxy_send_timeout 5;
proxy_read_timeout 5;
send_timeout 5;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:5002;
}
}

and tried to access from outside (like 192.168.0.1:8080, or even locally 127:0.0.1:8080), I've got the same issue again - partial response only after timeout is hit. Timeouts of 5 seconds are introduced so that I don't have to wait 60 or 600 seconds (which I also tried in case the app itself demand more time to answer);

So while the app working on it's own, all seems to be right. When nginx is introduced to the request chain, it behaves like this.

Um. Suggestions? :-/

Viewing all articles
Browse latest Browse all 972

Trending Articles