Shows libp2p usage scenario as a blockchain node. It is mainly an example to get performance stats of libp2p.
- ping
- floodsub (pubsub implementation)
- mdns (mainly for development purposes, to test faster on local machine)
The node gathers the following stats in a stats.txt
, which it saves on exit.
- Mean ping time to each peer
- Mean transmission rate (through floodsub) to each peer measured in bytes per unit of time
All mean stats are gathered with 95% confidence interval.
This stats are saved only for the latest N requests, where N is specified as command line argument
stats_window_size
- Connects to the swarm on startup
- Periodically pings other nodes
- Periodically sends
pending_tx
to other nodes - Logs all the incoming messages
- Exits after specified time saving the stats to a file
- Clone the repository
cargo run -- --help
to get the list of possible parameterscargo run -- --node_addr=ADDR
to deploy and connect to the swarm through the node withADDR
address- (Optional) Logging can be turned on by setting
RUST_LOG=info
before starting node. Example:RUST_LOG=info cargo run
As initially this repository is meant as a performance testing example for libp2p, the procedure to test and get results is the following.
All the nodes should be deployed on different machines, preferably in different networks.
- Deploy the first node and record it's address
- Deploy other nodes with the first node's address as a cli parameter
- Wait for the first node to exit (exit time can be also specified in cli args)
- Retrieve
stats.txt
from the first node's machine. It should be located near the executable file.
Note: by default each node runs for 1000 seconds.