Opened 4 years ago
Closed 4 years ago
#2156 closed enhancement (worksforme)
file transfer speed via http is even lower than https
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.19.x |
Keywords: | performance http https | Cc: | pei-jikui@… |
uname -a: |
root@jikui-performance-test:/usr/local/nginx# uname -a
Linux jikui-performance-test 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux |
||
nginx -V: |
nginx version: nginx/1.19.8
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) built with OpenSSL 1.0.2g 1 Mar 2016 TLS SNI support enabled configure arguments: --with-debug --with-stream --with-http_ssl_module --with-cc=/usr/bin/cc --with-cc-opt='-O0 -g' --prefix=/usr/local/nginx |
Description
1) using the 1.19.8 version of ngnix and configured to server as http and https server respectively.
nginx -v
nginx version: nginx/1.19.8
2) using the wrk tool to test the speed of http and https transfer speed and found that the speed of http is even lower then the speed of https especially when the reuseport is closed.
3) a) test result of http:
16:50:24] pei:~ git:(local*) $ wrk -t10 -c100 -d20m --latency http://10.145.78.69:80/
Running 20m test @ http://10.145.78.69:80/
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.00us 0.00us 0.00us nan%
Req/Sec 0.02 0.14 1.00 98.00%
Latency Distribution
50% 0.00us
75% 0.00us
90% 0.00us
99% 0.00us
100 requests in 20.00m, 575.87MB read
Socket errors: connect 0, read 4, write 0, timeout 100
Requests/sec: 0.08
Transfer/sec: 491.36KB
b) test result of https
[16:47:19] pei:~ git:(local*) $ wrk -t10 -c100 -d20m --latency https://10.145.78.69:443/
Running 20m test @ https://10.145.78.69:443/
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.00us 0.00us 0.00us nan%
Req/Sec 0.06 0.42 4.00 96.97%
Latency Distribution
50% 0.00us
75% 0.00us
90% 0.00us
99% 0.00us
100 requests in 20.00m, 593.50MB read
Socket errors: connect 0, read 4, write 0, timeout 100
Requests/sec: 0.08
Transfer/sec: 506.41KB
The very low transfer rate, about 5 Mbps in both cases, suggests that you are limited not by nginx but by something else. If the files you are testing are from the disk, most likely you are limited by disk speed.
It is normal that speed might vary between http and https, since these involve different code paths which might work differently with the disk. For example, in case of https sendfile() won't be used, and this may result in better performance if you are limited by disk rather than CPU.
Note well that wrk prints information about socket errors during the tests:
Usually such errors indicate that there is something wrong on the network level, such as not enough available local sockets on the wrk side, and the results aren't relevant at all.
If you need help with tuning your nginx instance, consider using support options available.