jlot

Crates.iojlot
lib.rsjlot
version0.5.0
created_at2024-09-05 23:33:36.403011+00
updated_at2026-01-10 07:42:50.23398+00
descriptionCommand-line tool for JSON-RPC 2.0 over JSON Lines over TCP
homepagehttps://github.com/sile/jlot
repositoryhttps://github.com/sile/jlot
max_upload_size
id1365270
size44,174
Takeru Ohta (sile)

documentation

README

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 }
  }
}
Commit count: 274

cargo fmt