From 7db3f6b9dc59c25cbdc457b96401e1b9b281d1e2 Mon Sep 17 00:00:00 2001 From: Micooz Date: Sun, 8 Jul 2018 18:02:43 +0800 Subject: [PATCH] docs: update --- docs/benchmark/README.md | 135 ++++++++------------- docs/config/README.md | 4 +- docs/examples/http2/blinksocks.client.json | 4 +- docs/examples/http2/blinksocks.server.json | 6 +- 4 files changed, 58 insertions(+), 91 deletions(-) diff --git a/docs/benchmark/README.md b/docs/benchmark/README.md index 6e36123..fbb438c 100644 --- a/docs/benchmark/README.md +++ b/docs/benchmark/README.md @@ -5,7 +5,7 @@ We use [iperf](https://en.wikipedia.org/wiki/Iperf) as network bandwidth measure ## Prerequisites * Linux or macOS -* Node.js 8.x or above +* Node.js 10.x or above * iperf 3.x * blinksocks 2.5.x or above @@ -21,9 +21,7 @@ $ npm install ### 2. prepare test cases -Open and edit [benchmark/cases.js], choose what you want to test. - -For usage about each preset, please check out [docs/presets]. +Open and edit [benchmark/cases/**/*.bench.js], for usage about each preset, please check out [docs/presets]. ### 3. run benchmark @@ -31,111 +29,76 @@ For usage about each preset, please check out [docs/presets]. $ npm run benchmark ``` -Save stdout/stderr to files: - -``` -$ 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. +benchmark will run each `*.bench.js` one by one and take a few minutes to get a report named `*.bench.json`. ### 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: -2.8.4 +$ node benchmark/report.js ... +``` + +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: -cpu Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz +cpu Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz cores 4 -memory 16722878464 -type Linux -platform linux +memory 8589934592 +type Darwin +platform darwin arch x64 -release 4.4.0-101-generic +release 17.6.0 Node.js Versions: -http_parser 2.7.0 -node 8.9.3 -v8 6.1.534.48 -uv 1.15.0 +http_parser 2.8.0 +node 10.5.0 +v8 6.7.288.46-node.8 +uv 1.20.3 zlib 1.2.11 -ares 1.10.1-DEV -modules 57 -nghttp2 1.25.0 -openssl 1.0.2n -icu 59.1 -unicode 9.0 -cldr 31.0.1 -tz 2017b - -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 ------------------------------------------ +ares 1.14.0 +modules 64 +nghttp2 1.32.0 +napi 3 +openssl 1.1.0h +icu 62.1 +unicode 11.0 +cldr 33.1 +tz 2018e (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"}}] - 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"}}] - 3: Test Case 3, Bitrate = 2.04 Gbits/sec, 1.38 Gbits/sec - [{"name":"ss-base"},{"name":"ss-aead-cipher","params":{"method":"aes-256-gcm"}}] - 4: Test Case 2, Bitrate = 1.43 Gbits/sec, 896 Mbits/sec - [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"camellia-256-cfb"}}] - -Done in 61.94s. +┌─────────┬──────────────────────────────────────┬────────────────────┬─────────────────┬─────────────────┬────────────────────┐ +│ (index) │ file │ description │ interval │ transfer │ bitrate │ +├─────────┼──────────────────────────────────────┼────────────────────┼─────────────────┼─────────────────┼────────────────────┤ +│ 0 │ 'shadowsocks/stream-cipher.bench.js' │ 'none' │ '0.00-3.02 sec' │ '1.5 GBytes' │ '3.97 Gbits/sec' │ +│ 1 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-128-ctr' │ '0.00-3.02 sec' │ '1.06 GBytes' │ '2.8 Gbits/sec' │ +│ 2 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-192-ctr' │ '0.00-3.03 sec' │ '1.03 GBytes' │ '2.71 Gbits/sec' │ +│ 3 │ 'shadowsocks/stream-cipher.bench.js' │ 'aes-256-ctr' │ '0.00-3.03 sec' │ '1.01 GBytes' │ '2.67 Gbits/sec' │ +│ 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' │ +│ 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. - -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. +> You can check out [benchmark/iperf.sh] and see how it works. ## History Reports [See here](../../benchmark/reports). [docs/presets]: ../presets -[benchmark/cases.js]: ../../benchmark/cases.js [benchmark/iperf.sh]: ../../benchmark/iperf.sh [shadowsocks stream ciphers]: https://shadowsocks.org/en/spec/Stream-Ciphers.html [shadowsocks aead ciphers]: https://shadowsocks.org/en/spec/AEAD-Ciphers.html diff --git a/docs/config/README.md b/docs/config/README.md index 7fef1b9..da5edd2 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -10,7 +10,7 @@ $ blinksocks init **blinksocks.client.json** -``` +```json { "service": "socks5://127.0.0.1:1080", "server": { @@ -48,7 +48,7 @@ $ blinksocks init **blinksocks.server.json** -``` +```json { "service": "tcp://0.0.0.0:19997", "key": "<=p(^tr;DpEfVe