/trpc-uwebsockets

trpc-uwebsockets

Primary LanguageTypeScriptMIT LicenseMIT

autocannon -c 500 -d 20 -p 100 http://localhost:8000/api/trpc/hello Running 20s test @ http://localhost:8000/api/trpc/hello 500 connections with 100 pipelining factor

┌─────────┬────────┬────────┬────────┬────────┬───────────┬──────────┬─────────┐ │ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ ├─────────┼────────┼────────┼────────┼────────┼───────────┼──────────┼─────────┤ │ Latency │ 223 ms │ 231 ms │ 245 ms │ 248 ms │ 232.09 ms │ 26.65 ms │ 1099 ms │ └─────────┴────────┴────────┴────────┴────────┴───────────┴──────────┴─────────┘ ┌───────────┬─────────┬─────────┬─────────┬─────────┬───────────┬──────────┬─────────┐ │ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤ │ Req/Sec │ 191,615 │ 191,615 │ 216,319 │ 219,519 │ 214,041.6 │ 6,000.34 │ 191,500 │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤ │ Bytes/Sec │ 31.4 MB │ 31.4 MB │ 35.5 MB │ 36 MB │ 35.1 MB │ 987 kB │ 31.4 MB │ └───────────┴─────────┴─────────┴─────────┴─────────┴───────────┴──────────┴─────────┘

Req/Bytes counts sampled once per second.

of samples: 20

4331k requests in 20.07s, 702 MB read

nodejs20-trpc-uwebsocketjs

autocannon -c 1000 -d 20 -p 100 http://localhost:8000/api/trpc/hello Running 20s test @ http://localhost:8000/api/trpc/hello 1000 connections with 100 pipelining factor

┌─────────┬────────┬────────┬────────┬────────┬───────────┬──────────┬─────────┐ │ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ ├─────────┼────────┼────────┼────────┼────────┼───────────┼──────────┼─────────┤ │ Latency │ 391 ms │ 468 ms │ 486 ms │ 491 ms │ 469.18 ms │ 58.71 ms │ 1428 ms │ └─────────┴────────┴────────┴────────┴────────┴───────────┴──────────┴─────────┘ ┌───────────┬─────────┬─────────┬─────────┬─────────┬───────────┬─────────┬─────────┐ │ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼─────────┼─────────┤ │ Req/Sec │ 178,175 │ 178,175 │ 213,119 │ 216,831 │ 211,116.8 │ 8,018.9 │ 178,170 │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼─────────┼─────────┤ │ Bytes/Sec │ 29.2 MB │ 29.2 MB │ 35 MB │ 35.6 MB │ 34.6 MB │ 1.31 MB │ 29.2 MB │ └───────────┴─────────┴─────────┴─────────┴─────────┴───────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.

of samples: 20

4323k requests in 20.14s, 693 MB read

benchmark 3

autocannon -c 1000 -d 20 -p 200 http://localhost:8000/api/trpc/hello Running 20s test @ http://localhost:8000/api/trpc/hello 1000 connections with 200 pipelining factor

┌─────────┬────────┬─────────┬─────────┬─────────┬────────────┬───────────┬─────────┐ │ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ ├─────────┼────────┼─────────┼─────────┼─────────┼────────────┼───────────┼─────────┤ │ Latency │ 651 ms │ 1398 ms │ 1439 ms │ 1444 ms │ 1360.06 ms │ 193.37 ms │ 2789 ms │ └─────────┴────────┴─────────┴─────────┴─────────┴────────────┴───────────┴─────────┘ ┌───────────┬─────────┬─────────┬─────────┬─────────┬───────────┬──────────┬─────────┐ │ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤ │ Req/Sec │ 135,807 │ 135,807 │ 142,719 │ 145,023 │ 142,374.4 │ 2,031.38 │ 135,761 │ ├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼──────────┼─────────┤ │ Bytes/Sec │ 22.3 MB │ 22.3 MB │ 23.4 MB │ 23.8 MB │ 23.4 MB │ 336 kB │ 22.3 MB │ └───────────┴─────────┴─────────┴─────────┴─────────┴───────────┴──────────┴─────────┘

Req/Bytes counts sampled once per second.

of samples: 20

3048k requests in 20.17s, 467 MB read

benchmark

general 40m, 0%

low memory and cpu using 150m,100%

trpc-uWebSockets.js 安装

pnpm add uNetworking/uWebSockets.js