Measure and visualize churn times for Pkarr records in the Mainline DHT.
-
Rust Experiment (
main.rs
)- Publish: Pushes records to the DHT.
- Churn Tracking: Periodically checks record resolvability; logs churn times to
churns.csv
.
-
Python Analysis (
analyze.py
)- Reads
churns.csv
- Computes key metrics (mean lifetime, half-life, hourly survival probability)
- Plots the observed survival curve with an exponential model fit (saved as
survival_plot.png
)
- Reads
- Install Rust.
- Build & Run:
cargo build --release
cargo run --release -- --num-records 100 --stop-fraction 0.9 --ttl-s 604800 --sleep-duration-ms 1000 --max-hours 12
# or simply `cargo run` for defaults
- Install dependencies:
pip install -r requirements.txt
- Generate analysis and plot:
python analyze.py
Argument | Default | Description |
---|---|---|
--num-records |
100 | Total records to publish |
--stop-fraction |
0.9 | Fraction of churned records to stop |
--max-hours |
12 | Max hours to stop collecting data |
--ttl-s |
604800 | TTL for each record (seconds) |
--sleep-duration-ms |
1000 | Sleep duration between resolves (milliseconds) |
- Churn Data:
churns.csv
- Analysis & Visualization:
survival_plot.png
Additionally, key metrics (mean lifetime, half-life, hourly survival probability, and 95% CI) are printed to the terminal.
- Results may vary due to network conditions.
- A pkarr record is considered non-resolvable upon the first occurrence of
None
. - Non-churned records are logged with
time_s = 0
(and treated as right-censored in analysis).
MIT License. Contributions welcome!