0.0.1 • Published 11 years ago

speed-test-http-server v0.0.1

Weekly downloads
1
License
-
Repository
-
Last release
11 years ago

What's the service

Setup a website, or join a website using NodeJS connect module, when user access the web page, net rate testing is auto started, it will send back page data chunk by chunk, and at the end of every chunk transferred, the page will update rate statistics, including average network rate, last 1M transfer rate, accumulated total transferred data. All rate will expressed in MB/min, KB/sec, kb/s for convenience evaluation. Progress bar will advanced when more chunk was transferred.

You can test with any size (in MB), you can alway see the recent 1M transfer rate (that could stand for network rate in stable state).

Design

Firstly print the visible part of the testing page, and init all stat counters. It include a form, you can fill the size input and submit, that will change the test transfer size and rerun the test.

Secondly, run the loop, repeating write a chunk followed by a update call the update will update statistics numbers and advance the progress bar.

Finally, do final update and print body/html close tag.

Configuration & Deployment

Note: it is only for my own deployment work.

edit the setting.cfg

for default listening port, transfer chunk size, default transfer size

deploy to target server from my local macbook

rsync -av -C -e "ssh -p 60222" ~/dev/project/net-speed-test node@noradle.com:

run the service website

ssh -p node@61.181.22.93 cd net-speed-test nohup forever net-speed-test.js > trace.log &

Socket Upload/Download Speed Test Service

上行

Server 每收到数据(和客户端的包划分不同),都将该数据大小和距离上次收到包的时间差(ms毫秒-千分之一秒)发给客户端。 发送格式为 (UInt32BE - size) - (UInt32BE - ms-delta) 共8个字节

下行

连接到 test server 后,server 不停的吐数据给客户端,客户端可以根据收到的数据的时间和大小得到下载速率, 客户端关闭写socket的信号到了 server 端后,server 停止吐数据。 客户端可以采用设置指定大小下载量到达后单向关闭连接或者由用户点停止后关闭单向连接。

上行下行合并服务

上行和下行共用一个服务端口, 如果服务端在接受到连接请求10ms内发送数据并被测速服务器接受到 则认为是上行测试, 否则认为是下行测试 测试地址为 60.29.143.50:1234