13 releases

Uses new Rust 2024

new 0.5.1 Feb 8, 2026
0.5.0 Jan 10, 2026
0.4.2 Dec 8, 2024
0.3.0 Dec 6, 2024
0.1.4 Sep 23, 2024

#1157 in Network programming

MIT license

44KB
1K SLoC

jlot

jlot Documentation Actions Status License

This is a command-line tool for JSON-RPC 2.0 over JSON Lines over TCP.

$ cargo install jlot

$ jlot -h
Command-line tool for JSON-RPC 2.0 over JSON Lines over TCP

Usage: jlot [OPTIONS] <COMMAND>

Commands:
  req         Generate a JSON-RPC request object JSON
  call        Read JSON-RPC requests from standard input and execute the RPC calls
  bench       Run JSON-RPC benchmark
  stats       Calculate statistics from JSON objects outputted by the bench command
  echo-server Run a JSON-RPC echo server (for development or testing purposes)

Options:
      --version Print version
  -h, --help    Print help ('--help' for full help, '-h' for summary)

Examples

Basic RPC call

Start an echo server in a terminal (":9000" is shorthand for "127.0.0.1:9000"):

$ jlot echo-server :9000

Execute an RPC call in another terminal:

$ jlot req hello --params '["world"]' | 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 echo-server :9000

Execute 100,000 RPC calls in benchmarking mode and gather the statistics:

$ jlot req put --count 100000 | \
    jlot bench :9000 --concurrency 10 | \
    jlot stats
{
  "elapsed_seconds": 0.356318,
  "requests_per_second": 280648,
  "avg_latency_seconds": 0.000034634,
  "detail": {
    "count": { "success": 100000, "error": 0 },
    "size": { "request_avg_bytes": 43, "response_avg_bytes": 81 },
    "latency": { "min": 0.000013, "p25": 0.000024, "p50": 0.000028, "p75": 0.000035, "max": 0.038994 },
    "concurrency": { "max": 10 }
  }
}

UDP

UDP is supported for simple testing with one-packet request/response.

$ jlot echo-server --udp :9001
$ jlot req hello --params '["world"]' | jlot call --udp :9001

Dependencies

~0.5–2.6MB
~49K SLoC