Git Product home page Git Product logo

worker-speedtest-template's Introduction

Speed Test

Worker for measuring download / upload connection speed from the client side, using the Performance Timing API.

Installation

index.js is the content of the Workers script.

Note: when running this as your own worker, your latency measurements may differ a small amount from the official version. This is due to the fact that we rely on an internal mechanism to determine the amount of server processing time, which is then subtracted from the measurement.

Wrangler

You can use wrangler to generate a new Cloudflare Workers project based on this template by running the following command from your terminal:

wrangler generate myApp https://github.com/cloudflare/worker-speedtest-template

Before publishing your code you need to edit wrangler.toml file and add your Cloudflare account_id - more information about publishing your code can be found in the documentation.

Once you are ready, you can publish your code by running the following command:

wrangler publish

Serverless

To deploy using serverless add a serverless.yml file.

API Reference

This worker exposes two endpoints designed to support the measuring of bandwidth and latency from the client side.

Download

GET /down Request binary content of a certain size

Param Description Required Default
bytes The size of the response body in bytes no 0

Example: /down?bytes=10000

Upload

POST /up Receive content posted to the server

The content is discarded by the endpoint. A response is sent once all the content has been received from the client.

No query string parameters.

worker-speedtest-template's People

Contributors

kristianfreeman avatar vasturiano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

worker-speedtest-template's Issues

resource not found

After publishing, when accessing https://speedtest.oviliz.workers.dev I'm given "resource not found". What I'm doing wrong?
This is my sequence:

wrangler generate speedtest https://github.com/cloudflare/worker-speedtest-template
cd speedtest/
nano wrangler.toml #adding the account_id
wrangler publish

Had the same problem when doing "wrangler preview".

No upload speed test

Hi, from the screenshots in your blog it appears that the upload also needs to be tested. However this is not showing up when doing the test. It only does a download test.

Continue the latency measurements while up/downloads are running

Having another speedtest that also measures latency and jitter is great! However, the way the test is currently setup, where it only runs the latency test before the download/upload tests are started, misses an important metric for connection performance: Bufferbloat, or excess latency under load (see https://en.wikipedia.org/wiki/Bufferbloat and https://www.bufferbloat.net/projects/bloat/wiki/Introduction/ for details, ).

So please consider extending the test to keep the latency measurements running during the throughput tests, and report the latency added relative to the baseline. See https://www.dslreports.com/speedtest/results/bufferbloat for the aggregate results of a speedtest that does this right.

How is this supposed to be used?

I read through the code and it seems sound, but is there a recommended way to use this?

  • Publish the worker template
  • Do a get from the client-side to the down route and specify the number of bytes to test?

Speed issue

wrong server connection speed values
Above the ISP service contractor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.