We would like to preface this tutorial by clarifying that speedtest-cli is definitely not the most reliable tool for evaluating server connection speeds. By design, it's meant to test residential connections, and its test servers often share network ports that can be oversaturated (on their end) at certain times. Additionally, there is a known bug in the default speedtest-cli package in CentOS/Fedora/Debian/Ubuntu repositories which can inaccurately report slow network speeds.
You can get around this issue by running speedtest-cli standalone, which usually yields better results.
To run speedtest-cli standalone, you need Python installed on your server, and then you can use the following commands:wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
Please note that the geo-IP data of speedtest-cli might not accurately indicate the true physical location of your VPS. This discrepancy can cause speedtest-cli to default to a server based on incorrect location information when run without flags. If you prefer to use a specific server for the test, you'll need to manually select it:./speedtest-cli --list
Then, use the "./speedtest-cli --server ID" command to specify a server. For instance:./speedtest-cli --server 21541
However, keep in mind that not all speedtest-cli testing servers might be displayed/accessible at a given time due to issues like high test usage, maintenance, GEOIP factors, etc, on their end.
Alternative to Speedtest-Cli:
Given the inconsistencies in speedtest-cli, you might want to consider other methods for testing your server's network connection speed. iperf3 is a highly recommended tool, however, it often necessitates the configuration of another remote server for testing.
As a result, a simpler, widely-used alternative involves using the wget command to assess download speeds. The following command can be executed to measure this:wget -O /dev/null http://test.b-cdn.net/100mb.bin
When interpreting the data from the wget command, it's crucial to distinguish between MB/s (megabytes per second) and Mb/s (megabits per second). Misunderstanding these units of measurement can lead to confusion about your results. You can learn more about these units of measurement in this tutorial.