tool: frigate-bench for measuring backend RPC cost#2
Merged
Conversation
A small benchmark that runs the same call patterns frigate uses against
bitcoind, on a single persistent HTTP connection (matching frigate's
Java HTTP client behavior rather than a naive curl-per-call). Useful
for A/B-ing a loopback deployment vs a remote-backend deployment to
quantify how much network latency the consumer actually pays.
Covers four phases:
- pure latency: getbestblockhash, getblockcount (small in/out)
- chain meta: getblockhash, getblockheader (small)
- big payload: getblock(tip, 0) raw block hex
- mempool init: getrawmempool + getrawtransaction × 1000 sample,
with an extrapolation to the full current mempool
Reads `user:password` from stdin (so the password doesn't leak into
process listings) and takes the RPC URL as argv[1]. Exposed via the
flake's `packages.<system>.frigate-bench` (a writePython3Bin with
no system Python dependency) and `apps.<system>.frigate-bench` so:
sudo cat /run/agenix/bitcoind-rpc-creds \\
| nix run github:2140-dev/roost#frigate-bench -- http://10.42.0.1:8332/
works on any frigate consumer without installing python or the script.
Does not measure fulcrum/electrum proxying or ZMQ steady-state
delivery latency — both are noted as future extensions in the README.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
tools/frigate-bench/— a small benchmark that runs the same call patterns Frigate uses against bitcoind, on a single persistent HTTP keep-alive connection (matching Frigate's Java HTTP client, not a naive curl-per-call). Useful for A/B-comparing a loopback deployment against a remote-backend deployment.tools/frigate-bench/bench.py— the scripttools/frigate-bench/README.md— usage docsflake.nix— exposes aspackages.<system>.frigate-bench(via `writePython3Bin`) +apps.<system>.frigate-benchso it's runnable as:```
sudo cat /run/agenix/bitcoind-rpc-creds \
| nix run github:2140-dev/roost#frigate-bench -- http://10.42.0.1:8332/
```
Measured
Four phases:
Real numbers (loopback kingfisher vs WG-edge albatross, mainnet)
Confirms what's been observed informally on the multi-box deployment: per-call latency dominates for small RPCs (basically the link RTT), bandwidth dominates for big payloads, and mempool init is the architectural cost that frigate pays on every restart.
Test plan
Not measured
🤖 Generated with Claude Code