From faa7d3becfed953c5fd7bb9b6eb5365b92667f4f Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Mon, 17 Feb 2025 21:10:54 +0900 Subject: [PATCH] update readme --- simlib/blendnet-sims/README.md | 65 ++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/simlib/blendnet-sims/README.md b/simlib/blendnet-sims/README.md index fcf5467..99a8dab 100644 --- a/simlib/blendnet-sims/README.md +++ b/simlib/blendnet-sims/README.md @@ -34,6 +34,9 @@ their last blend node and finally fully unwrapped. The simulation constructs a network with the `node_count` number of nodes. Each node establish connections with the `connected_peers_count` number of nodes randomly selected. +Nodes are distributed across multiple regions specified in the `network_settings.regions`. +Conneciton latency between regions can be set by `network_settings.network_behaviors`. + ### Protocol Parameters #### Tier 1: Persistent Transmission @@ -76,13 +79,71 @@ at the beginning of each epoch. At every selected slot, the node generates a cov ```bash cargo build --release -../target/release/blendnet-sims --input-settings ./config/blendnet.json +../target/release/blendnet-sims run --input-settings ./config/blendnet.json ``` The simulation prints a bunch of logs that can be used for analysis. We recommend piping logs to a file. ## Analysis -To analysis logs for latency and anonymity, see the README in the [scripts](../../scripts/). +### Bandwidth The bandwidth consumed by each node is printed as a log at the end of the simulation. +The unit of bandwidth is `bytes / second`. + +``` +2025-02-17T11:20:36.540603Z INFO netrunner::runner::sync_runner: Network state: NetworkState { total_outbound_bandwidth: 1295032320, total_inbound_bandwidth: 1293844480, min_node_total_bandwidth: 7823360.0, max_node_total_bandwidth: 17039360.0, avg_node_total_bandwidth: 12938444.8 } +``` + +### Latency + +The `analyze latency` command reads a log generated by the simulation, +and analyzes the total latency of each message that has reached to its final blend node. + +Also, it analyzes the latency of the connections that messages have traveled through. +This is useful to compare the distribution of the used connections with the configured distribution of the nodes. + +```bash +# Set the path of a log file printed from the simulation. +# Don't forget to use the step duration used in the simulation. +../target/release/blendnet-sims analyze latency --log-file --step-duration 10ms +``` + +```json +{ + "message": { + "count": 101, + "min": 1160, + "min_payload_id": "38479093-25ee-4eaa-a055-3817b92c0265", + "q1": 4050.0, + "avg": 5448.316831683168, + "med": 5100.0, + "q3": 7030.0, + "max": 10110, + "max_payload_id": "1efd8780-b574-4aee-9df5-f8732a93e182" + }, + "connection": { + "count": 19943, + "min": 30, + "q1": 50.0, + "avg": 111.3152484581056, + "med": 60.0, + "q3": 140.0, + "max": 400 + } +} +``` + +### Message History + +The `analyze message-history` command gathers all events related to a message from the log. +This is useful to investigate how much time was spent in each event (connection, persistent transmission, and temporal processor). + +```bash +# Set the path of a log file printed from the simulation. +# Don't forget to use the step duration used in the simulation. +../target/release/blendnet-sims analyze message-history \ + --log-file \ + --step-duration 10ms \ + --payload-id 1efd8780-b574-4aee-9df5-f8732a93e182 +```