speedtest icon indicating copy to clipboard operation
speedtest copied to clipboard

speedtest behind nginx upload numbers wrong?

Open santowiryaman opened this issue 3 years ago • 4 comments

Hi e7d, I am very new to speedtest. I was able to run it on my debian system from the docker container. It listens at port 8081. I also configured nginx port 8443 (hhtps) to proxy-pass to port 8081. Seems to work but when going through nginx (port 8443) the upload numbers are twice as high. When going direct to port 8081, the numbers are more reasonable. My client is on a 1Gbps NIC and the server on 10Gbps. As you can see in the attached picture, the upload speed was reported as high as 1.9Gbps, which is not possible (see history in attached picture). Have you run into this problem? Thank you. Kind regards, -santo

Slide3

santowiryaman avatar Feb 04 '21 19:02 santowiryaman

Hi @santowiryamann

I'm sadly aware the speedtest is not running as expected behind a proxy. This is something I would be able to fix, but to be honest, which is not in top of my list.

I definitely reckon it as a bug, and will try to investigate at some point.

Regards.

e7d avatar Feb 19 '21 09:02 e7d

I found an irregularity in the bandwidth test part. I tagged a version 0.5.4-alpha.0 that you may try. I'm not sure that it was the root coause, but let me know if it helps.

Also built and available through Docker: https://hub.docker.com/layers/e7db/speedtest/v0.5.4-alpha.0/images/sha256-35ccac2eca91e63f46e706d9630353dfa0e498f1abc6e3b8c9b52cf5ad73ab74?context=repo

e7d avatar Feb 19 '21 13:02 e7d

I am getting correct numbers without the patch, so for me there is no need to change anything. I think it is important to disable any buffer/caching in your nginx config. This is my nginx config:

location / {
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-Host $http_host;
       proxy_set_header X-Forwarded-Server $http_host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       gzip off;
       proxy_redirect off;
       proxy_buffering off;
       client_max_body_size 256M;
       proxy_pass http://localhost:8181/;
    }

maltechx avatar Feb 27 '21 12:02 maltechx

I'm using speedtest with docker, behind Traefik proxy (also docker, same docker host). As I was having similar issues, I decided to test out the 4 combinations

Master + Traefik = 2000+- Mbps Tag + Traefik = 1200+- Mbps

Master + direct = 360 Mbps Tag + direct = 223 Mbps

Running iperf3 between client machine and docker host I got 375Mbps.

So I guess that the master is giving out correct numbers if the proxy is not messing up the values.

I can't look deeper now but besides knowing the specific settings for the proxy (as mentioned by @maltechx), maybe the test can be updated to generate unbufferable/compressible random text? As not everyone will be able/allowed to change their reverse proxy settings

rgriffogoes avatar Feb 28 '22 19:02 rgriffogoes