docs: update

This commit is contained in:
Micooz 2018-07-08 18:02:43 +08:00
parent c2a49ebbba
commit 7db3f6b9dc
4 changed files with 58 additions and 91 deletions

@ -5,7 +5,7 @@ We use [iperf](https://en.wikipedia.org/wiki/Iperf) as network bandwidth measure
## Prerequisites ## Prerequisites
* Linux or macOS * Linux or macOS
* Node.js 8.x or above * Node.js 10.x or above
* iperf 3.x * iperf 3.x
* blinksocks 2.5.x or above * blinksocks 2.5.x or above
@ -21,9 +21,7 @@ $ npm install
### 2. prepare test cases ### 2. prepare test cases
Open and edit [benchmark/cases.js], choose what you want to test. Open and edit [benchmark/cases/**/*.bench.js], for usage about each preset, please check out [docs/presets].
For usage about each preset, please check out [docs/presets].
### 3. run benchmark ### 3. run benchmark
@ -31,111 +29,76 @@ For usage about each preset, please check out [docs/presets].
$ npm run benchmark $ npm run benchmark
``` ```
Save stdout/stderr to files: benchmark will run each `*.bench.js` one by one and take a few minutes to get a report named `*.bench.json`.
```
$ npm run benchmark > report.txt 2> error.txt
```
benchmark will take a few minutes to get a full report, the more test cases you added in [benchmark/cases.js] the more time it will spend.
### 4. get report ### 4. get report
Here is an example output about network performance of different [shadowsocks stream ciphers] and [shadowsocks aead ciphers] implemented by **blinksocks**: When the task is finished, a report table will be displayed on the screen. However, you can generate a standalone report by:
``` ```
blinksocks version: $ node benchmark/report.js <glob_pattern> ...
2.8.4 ```
Here is an example output about network performance among different [shadowsocks stream ciphers] and [shadowsocks aead ciphers] implemented by **blinksocks**:
```
$ node benchmark/report.js benchmark/cases/shadowsocks/stream-cipher.bench.json
```
```
blinksocks:
version 3.3.4
Operating System: Operating System:
cpu Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz cpu Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
cores 4 cores 4
memory 16722878464 memory 8589934592
type Linux type Darwin
platform linux platform darwin
arch x64 arch x64
release 4.4.0-101-generic release 17.6.0
Node.js Versions: Node.js Versions:
http_parser 2.7.0 http_parser 2.8.0
node 8.9.3 node 10.5.0
v8 6.1.534.48 v8 6.7.288.46-node.8
uv 1.15.0 uv 1.20.3
zlib 1.2.11 zlib 1.2.11
ares 1.10.1-DEV ares 1.14.0
modules 57 modules 64
nghttp2 1.25.0 nghttp2 1.32.0
openssl 1.0.2n napi 3
icu 59.1 openssl 1.1.0h
unicode 9.0 icu 62.1
cldr 31.0.1 unicode 11.0
tz 2017b cldr 33.1
tz 2018e
running 4 tests...
------------ Test Case 0 ----------------
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-ctr"}}]
Interval Transfer Bitrate
0.00-3.00 sec 1.84 GBytes 5.26 Gbits/sec sender
0.00-3.12 sec 1.71 GBytes 4.71 Gbits/sec receiver
-----------------------------------------
------------ Test Case 1 ----------------
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-cfb"}}]
Interval Transfer Bitrate
0.00-3.00 sec 972 MBytes 2.72 Gbits/sec sender
0.00-3.30 sec 856 MBytes 2.18 Gbits/sec receiver
-----------------------------------------
------------ Test Case 2 ----------------
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"camellia-256-cfb"}}]
Interval Transfer Bitrate
0.00-3.00 sec 510 MBytes 1.43 Gbits/sec sender
0.00-3.58 sec 382 MBytes 896 Mbits/sec receiver
-----------------------------------------
------------ Test Case 3 ----------------
[{"name":"ss-base"},{"name":"ss-aead-cipher","params":{"method":"aes-256-gcm"}}]
Interval Transfer Bitrate
0.00-3.00 sec 731 MBytes 2.04 Gbits/sec sender
0.00-3.89 sec 642 MBytes 1.38 Gbits/sec receiver
-----------------------------------------
(ranking): (ranking):
1: Test Case 0, Bitrate = 5.26 Gbits/sec, 4.71 Gbits/sec ┌─────────┬──────────────────────────────────────┬────────────────────┬─────────────────┬─────────────────┬────────────────────┐
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-ctr"}}] │ (index) │ file │ description │ interval │ transfer │ bitrate │
2: Test Case 1, Bitrate = 2.72 Gbits/sec, 2.18 Gbits/sec ├─────────┼──────────────────────────────────────┼────────────────────┼─────────────────┼─────────────────┼────────────────────┤
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-cfb"}}] │ 0 │ 'shadowsocks/stream-cipher.bench.js' │ 'none' │ '0.00-3.02 sec' │ '1.5 GBytes' │ '3.97 Gbits/sec' │
3: Test Case 3, Bitrate = 2.04 Gbits/sec, 1.38 Gbits/sec │ 1 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-128-ctr' │ '0.00-3.02 sec' │ '1.06 GBytes' │ '2.8 Gbits/sec' │
[{"name":"ss-base"},{"name":"ss-aead-cipher","params":{"method":"aes-256-gcm"}}] │ 2 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-192-ctr' │ '0.00-3.03 sec' │ '1.03 GBytes' │ '2.71 Gbits/sec' │
4: Test Case 2, Bitrate = 1.43 Gbits/sec, 896 Mbits/sec │ 3 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-256-ctr' │ '0.00-3.03 sec' │ '1.01 GBytes' │ '2.67 Gbits/sec' │
[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"camellia-256-cfb"}}] │ 4 │ 'shadowsocks/stream-cipher.bench.js' │ 'chacha20-ietf' │ '0.00-3.05 sec' │ '985.45 MBytes' │ '2.52 Gbits/sec' │
│ 5 │ 'shadowsocks/stream-cipher.bench.js' │ 'rc4-md5' │ '0.00-3.03 sec' │ '720.23 MBytes' │ '1.86 Gbits/sec' │
Done in 61.94s. │ 6 │ 'shadowsocks/stream-cipher.bench.js' │ 'rc4-md5-6' │ '0.00-3.05 sec' │ '712.31 MBytes' │ '1.82 Gbits/sec' │
│ 7 │ 'shadowsocks/stream-cipher.bench.js' │ 'camellia-128-cfb' │ '0.00-3.16 sec' │ '319.31 MBytes' │ '809.19 Mbits/sec' │
│ 8 │ 'shadowsocks/stream-cipher.bench.js' │ 'camellia-192-cfb' │ '0.00-3.01 sec' │ '249.37 MBytes' │ '662.21 Mbits/sec' │
│ 9 │ 'shadowsocks/stream-cipher.bench.js' │ 'camellia-256-cfb' │ '0.00-3.05 sec' │ '252.06 MBytes' │ '660.64 Mbits/sec' │
└─────────┴──────────────────────────────────────┴────────────────────┴─────────────────┴─────────────────┴────────────────────┘
``` ```
As you can see, the program first lists **blinksocks version**, **Operating System** and **Node.js Versions** parameters of the current platform. > You can check out [benchmark/iperf.sh] and see how it works.
Following the parameters, there are 4 test cases, each test case has different configuration(presets) defined in [benchmark/cases.js]. Test results are followed by configuration line.
The first line of results represents traffic from `iperf -c` to `bs-client` while the second represents traffic from `bs-server` to `iperf -s`.
```
[iperf -c] <----> [bs-client] <----> [bs-server] <----> [iperf -s]
1081 1082 1083
```
> You'd better check out [benchmark/iperf.sh] and figure out how it works.
**In my environment**, stream cipher with `aes-256-ctr` encryption method has the maximum transfer as well as bitrate among these 4 test cases.
## History Reports ## History Reports
[See here](../../benchmark/reports). [See here](../../benchmark/reports).
[docs/presets]: ../presets [docs/presets]: ../presets
[benchmark/cases.js]: ../../benchmark/cases.js
[benchmark/iperf.sh]: ../../benchmark/iperf.sh [benchmark/iperf.sh]: ../../benchmark/iperf.sh
[shadowsocks stream ciphers]: https://shadowsocks.org/en/spec/Stream-Ciphers.html [shadowsocks stream ciphers]: https://shadowsocks.org/en/spec/Stream-Ciphers.html
[shadowsocks aead ciphers]: https://shadowsocks.org/en/spec/AEAD-Ciphers.html [shadowsocks aead ciphers]: https://shadowsocks.org/en/spec/AEAD-Ciphers.html

@ -10,7 +10,7 @@ $ blinksocks init
**blinksocks.client.json** **blinksocks.client.json**
``` ```json
{ {
"service": "socks5://127.0.0.1:1080", "service": "socks5://127.0.0.1:1080",
"server": { "server": {
@ -48,7 +48,7 @@ $ blinksocks init
**blinksocks.server.json** **blinksocks.server.json**
``` ```json
{ {
"service": "tcp://0.0.0.0:19997", "service": "tcp://0.0.0.0:19997",
"key": "<=p(^tr;DpEfVe<m", "key": "<=p(^tr;DpEfVe<m",

@ -11,5 +11,7 @@
"name": "obfs-random-padding" "name": "obfs-random-padding"
} }
] ]
} },
"tls_cert": "cert.pem",
"tls_cert_self_signed": true
} }

@ -1,5 +1,5 @@
{ {
"service": "tcp://0.0.0.0:18732", "service": "h2://0.0.0.0:18732",
"key": "TZr[JmZYjNJ3USYq", "key": "TZr[JmZYjNJ3USYq",
"presets": [ "presets": [
{ {
@ -8,5 +8,7 @@
{ {
"name": "obfs-random-padding" "name": "obfs-random-padding"
} }
] ],
"tls_cert": "cert.pem",
"tls_key": "key.pem"
} }