ddsol / speedtest.net

node.js SpeedTest.net client module
MIT License
607 stars 125 forks source link

Weird Results since 1/25 ~2:30pm EST #70

Closed tingham closed 5 years ago

tingham commented 5 years ago

I wrote a tool around this (very nice) package and noticed this morning that it's reporting strange values starting at the time mentioned above. Is it possible that the scale of the throughput has changed on the provider side?

image

Thanks!

ddsol commented 5 years ago

The throughput isn't being scaled except to make it more speed-test-like. But what happens is that we time how long it takes to send and receive a bunch of bits. Then we divide the number of bits we sent, or received, by the time. A slight adjustment is performed to be more speed-test like, but it's a linear adjustment and so what you're seeing has nothing to do with this. Your internet may be slow, or the server you're connecting to is broken somehow.

Unfortunately, I have no control over this stuff at all...

tingham commented 5 years ago

Thanks for responding so quickly! I've tested speeds using a bunch of different services and they're all reporting gigabit. I'm wondering if the remote is getting throttled because of the recent changes made to speedtest.net that make ads takeover the page load rendering it unusable.

ddsol commented 5 years ago

No. This module works like the code on the page, not like the page itself. It asks SpeedTest about where the client is (based on IP) and where the servers are. Then we can figure out which server is closest and we connect directly to this server. Servers are donated by sponsors (in return for some minor advertising of their name, I assume). So these servers are not owned by Ookla (which owns the SpeedTest brand).

To be clear, the actual speed test is performed on a 3rd party server that is not (directly) affected by changes on Ookla's side. I presume from time to time Ookla could mandate the servers change their API, but I would presume they don't. It's very tough to take an established network of 3rd party servers, contact all their owners, and somehow mandate they change over to a new system. Even if all of them were willing, they may not be able. Inevitably, this would cause a loss of usable servers (at least using the new API).

Moreover, the API that is being used for these servers is very simple: Allow upload of dummy data (which is discarded) and allow download of dummy data (which may be generated from random data). In any case, there's no good reason to change this API, ever, as it does everything we could want from a SpeedTest server.

But ads have less than nothing to do with the speed test as used in this module. This module never comes into contact with any ads.

Finally, I don't know why the speedtest may be off by a mile, but many things could be the case.

One of those is that it uses 1 thread to download. If your CPU bottlenecks the download then your network is not saturated. At 1Gb/s this could very well be the case. You could try running multiple tests at once, preferably using multiple node.js processes. As long as they are running concurrently, it should be fine to just add those numbers together.

Another option is that the code in this module is just really old and for a lack of oil and due to play in the parts (causing the parts to become loose) it's slowed down to the point where it registers a mere fraction of the speed. Have you tried cleaning and oiling your rig?

If you should find a screw loose or a worn function, please consider fixing and creating a pull request so I can pull the new function into the old code and make it awesomer.

Other than that, I'm afraid I can't be of much help as I currently have no temporal resources at my disposal to dedicate to the diagnosis or refurbishment of this module.

tingham commented 5 years ago

You've been most helpful already. I've been using this lib for years to sample hourly bandwidth (for use in complaining to internet service providers, resulting in several free-months of service; which means I owe you several coffees or beers should we ever meet in person.)

I wasn't trying to imply that ads would come in contact with the API; but more that it seems Ookla's business practices have changed such that they are serving malware from the ads they allow on the speed test site; and that this change in policy might have filtered downstream to any of their participating nodes policies as well. Apologies for not being more clear on that point.

Lastly, have an amazing day and thank you again!

ddsol commented 5 years ago

I believe this is fixed in the latest release. I haven't tested it but I hear from the community that the latest fix resolves the strange happenings.

tingham commented 5 years ago

Confirmed.

image