In this post, we will discuss how to use speedtest for testing network speed for a Linux server. Slow network speed can lead to a decrease in productivity and can even result in system downtime. That’s why it is essential to regularly test your network speed to identify any potential issues and take necessary actions to improve it. One of the most efficient ways to test your network speed is by using a command-line speedtest script on your Linux server. This post was substantially  updated in March 2024

How to use SpeedTest for Testing

We will use the command line script (speedtest-cli) for the purposes of this blog post. Other options include the Speedtest by Ookla, Cloudflare’s speed detection, and bench.monster or YABS. We have discussed the last two in other posts, therefore, we will take a look at the command line tool. This script allows you to quickly and accurately measure your network’s upload and download speeds, as well as latency and jitter.

Step 1: Installing the Speedtest Script

The first step is to install the speedtest script on your Linux server. The script is available for download on GitHub and is compatible with most Linux distributions. You can either clone the repository or download the script directly from the website.

Step 2: Running the Speedtest

Once the script is installed, you can run it by navigating to the directory where it is located and executing the command `./speedtest.sh.` This will initiate the speedtest process, which will take a few minutes to complete.

Step 3: Interpreting the Results

Once the speedtest is completed, you will see a summary of the results, including your server’s upload and download speeds, latency, and jitter. The results will also be displayed in a graphical format, making it easier to understand. Upload speed refers to the rate at which data is transferred from your server to the internet, while download speed is the rate at which data is transferred from the internet to your server. Latency is the time it takes for a data packet to travel from your server to the destination and back, while jitter is the variation in latency over a period. All these factors play a crucial role in determining your network’s overall speed and performance.

Watch the Video screenshot tour of different speedtests on servers

Screenshots by Amar Vyas. Background Music is AI generated. If the video does not play, please click here

Step 4: Analyzing and Improving Network Speed

Once you have the results, it is essential to analyze them and take necessary actions to improve your network speed. If your upload or download speeds are significantly lower than expected, it could indicate a problem with your network infrastructure, such as a faulty cable or router. In such cases, you can troubleshoot and fix the issue to improve your network speed. If your latency and jitter are high, it could be due to a congested network.
Self hosted docker based Installation of speedtest. Post on How to use speedtest to measure server speed by Amar Vyas

Self hosted docker based Installation of speedtest (source: Speed test Tracker on github by Alex Justesen)

 

How to use Speedtest for testing on a vps with Debian Linux ?

For installing the speedtest-cli on a Debian Linux VPS, you can follow these steps:

  1. Install speedtest-cli: You can install the speedtest-cli application using the Python package manager, pip. Ensure that you have Python 2.4-3.4 or a higher version installed on your system. You can use the following command to install speedtest-cli:

    pip install speedtest-cli
  2. Run speedtest-cli: Once installed, you can run the speedtest-cli command in the terminal to test your internet speed. The command will provide you with information about your internet connection performance, including download and upload speeds, latency, and packet loss.

  3. View test results: After running the speedtest-cli command, you will receive the test results in the terminal.

Note that the above script has not been updated for several years now. Use with caution.
Speedtest results for VPS. bench.monster used

Speedtest using bench.monster

How to Install speedtest-CLI tool using other methods

To use speedtest-cli to test network speed on a Linux server, follow these steps:
  1. Install speedtest-cli if it’s not already installed. You can do this using your package manager, such as apt for Debian or Ubuntu. For example, on Debian, you would use:
    sudo apt install speedtest-cli
    
  2. Open a terminal window and run the speedtest-cli command with the --simple flag to get a shorter output:
    speedtest-cli --simple
    
  3. Wait for the test to complete, which should take about 30 seconds. The output will display your download and upload speeds, as well as latency (ping) information.
If you want to see more detailed information, such as the server location and IP address, run the command without the --simple flag.

This post was published under the category web hosting and updated on 2 March 2024
Categories: Notes Blog