Welcome! Log In Create A New Profile


Re: Extremely slow file (~5MB) upload via POST

Francis Daly
November 11, 2019 07:14AM
On Sun, Nov 10, 2019 at 01:03:20PM -0500, frank.muller wrote:

Hi there,

I don't have an answer for you, but there are some things you could
perhaps try, if you are happy to keep investigating.

> [DESCRIPTION] I've an upstream backend service behind Niginx (1.16.1,
> openssl-1.1.1) which allow people upload files from their browser. The files
> are simply stored on disk. Nothing else is performed on them.

The sequence is: client writes to nginx; nginx writes to upstream.

Can you see: is the extra slowness in the first part, or the second?

The usual first place to look is in the log files.

> error_log off; #/var/log/nginx/error.log info;

You can probably look in the file /usr/local/nginx/off to see what nginx
says is happening; but you might want to increase the log level to see
more details.

> access_log off; #/var/log/nginx/access.log;

You don't have an access log to look in. That probably does not matter
much here.

> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> types_hash_max_size 2048;
> open_file_cache max=10000 inactive=10m;
> open_file_cache_valid 1h;
> open_file_cache_min_uses 1;
> open_file_cache_errors on;

I think that those directives should not affect this test, either way.

> listen 443 ssl;
> location / {
> proxy_pass;
> }

> [PROBLEM] A 5MB file takes almost 30 seconds to upload via Nginx.
> When uploading it directly to the upstream backend, it takes ~400 millisec
> at max.

That does sound unnecessarily slow. The (presumed) ssl/no-ssl difference
should not account for that much overhead.

> Running strace, we've got this:
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 47.96 0.041738 11 3887 1489 read
> 21.73 0.018909 13 1509 epoll_wait
> 17.95 0.015622 22 708 writev
> 10.62 0.009241 13 712 write
> 0.47 0.000407 19 21 21 connect

I don't know the details, but what is nginx trying to connect() to that
is erroring every time? Is that likely relevant to the problem?

> A lot of errors in "read" calls: 1489 errors. They all correspond to (thanks
> again to strace):

It is possible that the nginx debug log might have more nginx-related
details than the bare strace.

Good luck with it,

Francis Daly francis@daoine.org
nginx mailing list
Subject Author Posted

Extremely slow file (~5MB) upload via POST

frank.muller November 10, 2019 09:57AM

Re: Extremely slow file (~5MB) upload via POST

Andrei November 10, 2019 06:00PM

Re: Extremely slow file (~5MB) upload via POST

Francis Daly November 11, 2019 07:14AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 98
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready