speedtest icon indicating copy to clipboard operation
speedtest copied to clipboard

Download is very slow

Open kksse opened this issue 2 years ago • 24 comments

Description Download is very slow

Server OS : Windows 2016 iis10 + php : 8.1.6

Network : 1000/1000M, Fiber

Client Windows 10 x64 Chrome

Screenshot 20220602142949 s

kksse avatar Jun 02 '22 06:06 kksse

Have you ran any tests from other providers or repeated this test multiple times? Sometimes weird networking issues can cause problems and it is good to rule out any network issues.

Computroniks avatar Jun 02 '22 16:06 Computroniks

The network is normal. The above test is run on the LAN.

kksse avatar Jun 03 '22 03:06 kksse

install OpenSSL Troubleshooting

kksse avatar Jun 03 '22 05:06 kksse

Hmm, what are your PHP settings at. I think that this is something to do with either the client, server or network as librespeed has been operating for a number of years without these sorts of issued

Computroniks avatar Jun 03 '22 12:06 Computroniks

I'm seeing the same behaviour as OP, although on a different environment. The only common denominator I can see would be PHP 8.1.x Can anyone else confirm proper functionality with PHP 8.1.x?

OS: Ubuntu 22.04 nginx + PHP 8.1.2: image

Screenshot: image

Then iperf3 between the same devices just to rule out networking issues: image

sorano avatar Jul 25 '22 09:07 sorano

Same issue here, Librespeed installer on al LXC container with Alpine Linux, PHP8.0.22 with php-fpm (following this guide. IPerf from the same container shows 980Mb while LibreSpeed stops at 12Mb.

Any suggestion on what to check?

namadori avatar Aug 19 '22 22:08 namadori

I had the same problem after upgrading Ubuntu 20.04 to Ubuntu 22.04, where is default and only PHP version 8.1. I additionally install php7.4 and after that everything works fine.

prozbo avatar Sep 02 '22 11:09 prozbo

Debian 11 PHP 7.4.30 5 mbps, download 163 mbps upload

other speed test sites have me at over 100 mbps download

Cereal916 avatar Oct 08 '22 05:10 Cereal916

I am also testing again and encounter the same problems. LXC Container

  • 2 CPU cores
  • 1GB RAM
  • SSD memory

Started to play with various parameters to maybe fix the error. Here is my config:

server {
    listen 80;
    listen [::]:80;
    access_log off;
    server_name speedtest.domain.de;
    return 301 https://$server_name$request_uri;
}

server {

        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        access_log off;

        server_name speedtest.domain.de;
        ssl_certificate /etc/letsencrypt/live/speedtest.domain.de/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/speedtest.domain.de/privkey.pem;

        root /var/www/speedtest;
		
	server_tokens off;
		gzip off;
		gzip_vary off;
		gzip_proxied any;
		gzip_comp_level 9;
		gzip_buffers 16 8k;
		gzip_http_version 1.1;
		gzip_min_length 256;
		gzip_types text/plain application/rdf+xml application/atom+xml text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

        index index.php index.html index.htm;

        client_max_body_size 400M;

        location / {
           try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
           include snippets/fastcgi-php.conf;
           fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           include fastcgi_params;
        }
}

nano /etc/php/8.1/fpm/php.ini

>> cgi.fix_pathinfo=0
>> memory_limit = 1024M

nano /etc/php/8.1/fpm/pool.d/www.conf

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
clear_env = no

nano /etc/php/8.1/fpm/pool.d/www.conf


pm = dynamic
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18

nano /etc/php/8.1/fpm/conf.d/10-opcache.ini

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Hoerli1337 avatar Oct 18 '22 16:10 Hoerli1337

I'm experiencing the same issue with apache and php 7.4.32 on a Trunas jail(vm). I did not change any significant apache/php config, everything is vanilla aside from copying speedtest sources to the document root dir.

adonespitogo avatar Oct 28 '22 06:10 adonespitogo

I am noticing the same thing on Ubuntu 20.04.5 LTS and php 7.4.3. I haven't tweaked anything other than MTU being at jumbo packets. I'm still seeing a 500Meg/1Gig ratio though. I'm testing from a 2.5Gig/2.5Gig connection.

cvclukes avatar Nov 07 '22 22:11 cvclukes

Lucky for me, I have a running windows 7 as my server. I installed xamp there and I didn’t experience this issue that i had with bhyve in my truenas server.

adonespitogo avatar Nov 08 '22 10:11 adonespitogo

I was able to fix this by using the provided nginx settings.

Cereal916 avatar Nov 09 '22 05:11 Cereal916

@Cereal916 can you provide a link to the nginx config you used to fix this?

adonespitogo avatar Nov 09 '22 13:11 adonespitogo

Hey @sorano, maybe you need to check that your index.html and backend/ directory are in same directory and www-data has the write rights.

luqmanmahama avatar Nov 16 '22 10:11 luqmanmahama

Hey @sorano, maybe you need to check that your index.html and backend/ directory are in same directory and www-data has the write rights.

No, my issue was I still had the old php7 fpm.sock in config. After changing to 8.1 all worked good again.

sorano avatar Nov 16 '22 10:11 sorano

Hi guys! I've been dealing with nginx and the speedtest for a while now. I think I have now found a possible solution.

After trying just about all the parameters in nginx, I couldn't see any improvement. So I went to the speedtest script and started to change the parameters there. For my small setup the following changes helped. In the speedtest_worker.js file the following has to be changed:

	time_ul_max: 20, // Set test duration manually - 20 seconds is good
	time_dl_max: 20, // Set test duration manually - 20 seconds is good
	xhr_dlMultistream: 6, // Set it fix to 6
	xhr_ulMultistream: 6, // Set it fix to 6
	time_auto: false, // Set this to false
	xhr_ul_blob_megabytes: 30, // Increased to 30 to better fill the cache
	garbagePhp_chunkSize: 5, // 100 is too much, with 10 the test runs better with 5 actually usable good
	enable_quirks: true, // must be set to false, so that the time values above can be used

Screenshot 2022-11-25 at 21-02-41 LibreSpeed Example

Tested with:

  • Windows 10
  • Firefox, Waterfox, Brave (latest version as of 25 November 2022)
  • Local network with 1Gbits connection
  • HTTP2 + SSL
  • php8.1

Hoerli1337 avatar Nov 25 '22 21:11 Hoerli1337

I also encountered this problem, enabling openssl extension for php solved it.

I think, that if you use a one-click script to install your web server environment, you will hardly have this problem. It is easy to miss when installing manually.

Tested with: Win-server 2012 nginx latest php8 latest HTTP non SSL

xiaojiedev avatar Nov 30 '22 22:11 xiaojiedev

Is the docker-image affected by this?

Im getting much better results with iperf3 compared to web page. Testing between the same hosts. iperf3 gives me 200/200Mbps which is expected. librespeed container gives me 130/200Mbps, which is not expected

Environment is using only http and client and server are between an ipsec tunnel (lower than 1500 MTU) if that matters.

I see the container has

apachectl -M
...
 php7_module (shared)
...
root@a32114174e58:/etc/apache2# cat mods-enabled/php7.load
LoadModule php7_module        /usr/lib/apache2/modules/libphp7.so

docker image

root@nspeedtest:/opt/librespeed# docker images
REPOSITORY             TAG       IMAGE ID       CREATED         SIZE
adolfintel/speedtest   latest    a6292eb82e9d   12 months ago   478MB

sliddjur avatar Mar 30 '23 16:03 sliddjur

I think iperf test is not related to or does not connect to php scripts.

On Fri, Mar 31, 2023 at 12:11 AM sliddjur @.***> wrote:

Is the docker-image affected by this? Im getting much better results with iperf3 compared to web page. Testing between the same hosts. I see the container has

apachectl -M ... php7_module (shared) ... @.***:/etc/apache2# cat mods-enabled/php7.load LoadModule php7_module /usr/lib/apache2/modules/libphp7.so

docker image

@.***:/opt/librespeed# docker images REPOSITORY TAG IMAGE ID CREATED SIZE adolfintel/speedtest latest a6292eb82e9d 12 months ago 478MB

— Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest/issues/494#issuecomment-1490567500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5JNRGKC4YYPDNX2WXYKVLW6WWBLANCNFSM5XT4N7QA . You are receiving this because you commented.Message ID: @.***>

adonespitogo avatar Mar 31 '23 04:03 adonespitogo

Was getting very slow Download speeds (<50Mbps) when trying to run linuxserver/librespeedtest:latest as a MikroTik container, even on an RB5009 and RB4011 which should both have ample CPU power...

For a moment I was really disappointed & thought I would need to find another solution than Librespeed...

Thanks to @Hoerli1337 's suggestions, I've settled on the following changes to /app/www/public/speedtest_worker.js , which seems to have mostly solved the problem for me:

    xhr_dlMultistream: 4,
    xhr_ulMultistream: 4,
    xhr_ul_blob_megabytes: 4,
    garbagePhp_chunkSize: 4,

I also changed in /app/www/public/backend/garbage.php :

    //$data = openssl_random_pseudo_bytes(1048576);
    $data = random_bytes(1048576);

These settings seem to saturate the 1Gbps interface for both up & down tests quite consistently, which satisfies my needs

I hope this helps someone else :)

fragtion avatar May 20 '23 15:05 fragtion

thank you @fragtion that helped!

i went from sub-200Mbps tests to over 3.5Gbps speeds (capped by UDM-SE)

pugson avatar Jul 21 '23 14:07 pugson

Try removeing http2 http/2 from your config it causes issues for me. After switching to http1.1 everything works great. It seams like its Chrome/Firefox was shoving the 4 requests into one stream, that then had infighting between threads.

kingofkya avatar Nov 21 '23 01:11 kingofkya

I have encountered similar issues with download speed.

I was using LXC (Ubuntu 23.10), Nginx, and php8.2-fpm.

I set up the librespeed using the default config file comes with nginx.

I encountered 502 Bad Gateway for all of the PHP scripts in the librespeed, and Nginx is eating LOTS OF CPU power.

It turned out that the default scripts of Nginx in Ubuntu 23.10 says,

# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
        include snippets/fastcgi-php.conf;

        # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        # With php-cgi (or other tcp sockets):
#               fastcgi_pass 127.0.0.1:9000;
}

I forgot about the extact version, but after I changed the line,

        fastcgi_pass unix:/run/php/php7.4-fpm.sock;

into,

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;

The download speed backs to normal.

BTW, plz do remember adding

        client_max_body_size 100M;

in your nginx config file. Otherwise, it would not work.

loeeeee avatar Feb 17 '24 15:02 loeeeee