11 unstable releases (3 breaking)
new 0.4.2 | Dec 8, 2024 |
---|---|
0.4.1 | Dec 8, 2024 |
0.3.0 | Dec 6, 2024 |
0.2.0 | Dec 6, 2024 |
0.1.4 | Sep 23, 2024 |
#927 in Network programming
797 downloads per month
27KB
634 lines
jlot
This is a command-line tool for JSON-RPC 2.0 over JSON Lines over TCP.
$ cargo install jlot
$ jlot
Command-line tool for JSON-RPC 2.0 over JSON Lines over TCP
Usage: jlot <COMMAND>
Commands:
call Read JRON-RPC requests from standard input and execute the RPC calls
req Generate a JSON-RPC request object JSON
stats Calculate statistics from JSON objects outputted by executing the command `call --add-metadata ...`
run-echo-server Run a JSON-RPC echo server (for development or testing purposes)
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
Examples
Basic RPC call
Start an echo server in a terminal (":9000" is shorthand for "127.0.0.1:9000"):
$ jlot run-echo-server :9000
Execute an RPC call in another terminal:
$ jlot req hello '["world"]' --id 2 | jlot call :9000 | jq .
{
"jsonrpc": "2.0",
"result": {
"id": 2,
"jsonrpc": "2.0",
"method": "hello",
"params": [
"world"
]
},
"id": 2
}
Benchmarking
Start an echo server in a terminal:
$ jlot run-echo-server :9000
Execute 1000 RPC calls with pipelining enabled and gather the statistics:
$ jlot req put --count 100000 | \
jlot call :9000 --concurrency 10 --add-metadata | \
jlot stats | \
jq .
{
"rpc_calls": 100000,
"duration": 0.608289541,
"max_concurrency": 10,
"rps": 164395.39604051816,
"latency": {
"min": 0.000016416,
"p25": 0.0000435,
"p50": 0.000057625,
"p75": 0.000074584,
"max": 0.000302208,
"avg": 0.000060041
}
}
Dependencies
~1.6–2.6MB
~50K SLoC