e7db/speedtest

By e7db

•Updated over 3 years ago

A self-hosted, lightweight speed test implemented in JavaScript

Image
7

1M+

e7db/speedtest repository overview

⁠Speed Test

A self-hosted, lightweight speed test implemented in JavaScript, and based on Web Workers⁠ and XMLHttpRequest⁠.

⁠Demo

A demo is available here, running on a Digital Ocean server based on Amsterdam:

⁠Usage

⁠Compatibility
ChromeEdgeFirefoxOperaSafari
43*48.012.106.0
⁠Features
  • IP Address (with ISP) detection
  • Latency and jitter tests
  • Download and upload bandwidth tests
⁠Requirements
  • Some decent server CPU
  • Using HTTPS is highly discouraged, adding an heavy packet size and computing overhead
  • Using server compression is also discouraged, adding a computing overhead
⁠Configuration

You can configure the speed test server following your needs. Find below the list of configurable options through the file config.json available at the root level of the server.
The key corresponds to the JSON path where to affect the value. For example, setting the value 2000 for the key download.delay corresponds to the following JSON:

{
  "download": {
    "delay": 2000
  }
}

List of configurable options:

KeyDescriptionDefault valuePossible values
analytics.trackingIdThe Google Analytics tracking ID to use on the speed test."UA-XXXXXXXX-Y" or empty.
ignoreErrorsIgnore the errors yielded by upload/download requests. If false, the test will be aborted at the first error.truetrue or false.
endpointsThe available endpoints list.See Endpoints configuration⁠ below.
endpoint.xhrThe endpoint to request for XHR.current locationAny http:// or https:// endpoint exposing this speed test.
endpoint.websocketThe endpoint to request for WebSocket.current locationAny ws:// or wss:// endpoint exposing this speed test.
ip.pathThe path of the IP test on the XHR endpoint.ip
latency.pathThe path of the latency test on the WebSocket endpoint.ping
latency.countThe count of latency requests to emit during the latency test.nullAny positive integer.
latency.durationThe duration in milliseconds of the latency test.5000Any positive integer.
latency.gracetimeThe duration in milliseconds at start of the latency test during which results are ignored. Used for test warm-up.1000Any positive integer.
download.pathThe path of the download test on the XHR endpoint.download
download.streamsThe number of concurrent streams to use during the download test.6Any positive integer.
download.delayThe delay in milliseconds between the first request of each stream.200Any positive integer.
download.durationThe duration in milliseconds of the download test.10000Any positive integer.
download.gracetimeThe duration in milliseconds at start of the download test during which results are ignored. Used for test warm-up.2000Any positive integer.
download.sizeThe size in bytes downloaded on each download request.8388608 (8M)Any positive integer.
download.adjustSizeAuto adjust download packets size, depending on bandwidth.true
download.minSizeThe minimum size in bytes downloaded on each download request, to avoid excessively small requests.1048576 (1M)Any positive integer.
download.maxSizeThe maximum size in bytes downloaded on each download request, to avoid excessively huge requests.104857600 (100M)Any positive integer.
upload.pathThe path of the upload test on the XHR endpoint.upload
upload.streamsThe number of concurrent streams to use during the upload test.6Any positive integer.
upload.delayThe delay in milliseconds between the first request of each stream.200Any positive integer.
upload.durationThe duration in milliseconds of the upload test.10000Any positive integer.
upload.gracetimeThe duration in milliseconds at start of the upload test during which results are ignored. Used for test warm-up.2000Any positive integer.
upload.sizeThe size in bytes uploaded on each upload request.20971520 (2M)Any positive integer.
upload.adjustSizeAuto adjust upload packets size, depending on bandwidth.true
upload.minSizeThe minimum size in bytes uploaded on each upload request, to avoid excessively small requests.262144 (256K)Any positive integer.
upload.maxSizeThe maximum size in bytes uploaded on each upload request, to avoid excessively huge requests.20971520 (20M)Any positive integer.
result.pathThe path of the save result request on the XHR endpoint.save
⁠Endpoints configuration
{
  "endpoints": [
    {
      "label": "FR",
      "uri": "http://speedtest-fr.localhost:5080"
    },
    {
      "label": "FR (secured)",
      "uri": "https://speedtest-fr.localhost:5443"
    },
    {
      "label": "NL",
      "uri": "http://speedtest-nl.localhost:5080"
    },
    {
      "label": "UK",
      "uri": "http://speedtest-uk.localhost:5080"
    },
    {
      "label": "US",
      "uri": "http://speedtest-us.localhost:5080"
    }
  ]
}
⁠Docker

Docker Pulls Docker Stars

⁠Run the Speed Test container
docker run --name speedtest -d -p 80:80 e7db/speedtest
⁠Store the results permanently

To store results permanently, you need a volume:

docker volume create speedtest_results
docker run --name speedtest -d -p 80:80 -v speedtest_results:/app/results e7db/speedtest

Note: Results are never cleaned automatically, used space will grow over time.

⁠Use a custom configuration

To use a custom configuration through the config.json file, mount it through a read-only volume:

docker run --name speedtest -d -p 80:80 -v /path/to/config.json:/app/web/config.json:ro e7db/speedtest
⁠Self-hosted server

Having cloned this repository and moved into the directory, issue the following commands:

npm run setup
npm run build
npm run start

⁠Development

⁠Prerequisites
⁠Setup the repository

To setup, build and run the project for development, issue the following commands:

npm run setup:dev
npm run build:dev
npm run start:dev
⁠Issues

If you encounter a problem with the Speed Test, please check if an existing issue⁠ adresses it and join the discussion. If not, feel free to create a new issue.

⁠Support the project

You want to support the project? A speed test requires a server with high bandwidth. With Patreon, Paypal or cryprocurrencies, you can help me cover the fees!

Become a Patron on Patreon
Donate with Paypal
Donate Bitcoin 1D4fa6WDVNmKmwRJzTKDohYmHB9UzMsVVL
Donate Ethereum 0x57f1afbC888d6954F954B0960524E4aa5Fa188af

⁠License

MIT License

Copyright (c) 2017-2019 Michaƫl "e7d" Ferrand

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tag summary

Content type

Image

Digest

Size

88.9 MB

Last updated

over 3 years ago

Requires Docker Desktop 4.37.1 or later.