|
1 | | -# Playground |
| 1 | +# FDB Playground |
2 | 2 |
|
3 | | -This directory is used for testing and playing around with different things. Idea is to have a place where we can spawn |
4 | | -as many as possible nodes we want and see them in grafana dashboard how they behave. Behaviour include: |
| 3 | +The playground provides a flexible environment for testing and benchmarking the FDB P2P network under various conditions. It allows you to spawn multiple nodes with different roles and configurations, run predefined strategies against them, and monitor their behavior through observability tools like Grafana and OpenTelemetry. |
5 | 4 |
|
6 | | -- Network, latencies and availability |
7 | | -- RPC |
8 | | -- Raw TCP and Capn Proto |
| 5 | +## Features |
| 6 | + |
| 7 | +- Spawn multiple P2P nodes with customizable roles and configurations |
| 8 | +- Monitor network latencies, throughput, and node availability |
| 9 | +- Test RPC communications between nodes |
| 10 | +- Evaluate raw TCP performance and CapnProto serialization |
| 11 | +- Benchmark write operations with configurable concurrency and data sizes |
| 12 | +- Track per-node metrics with enhanced observability |
| 13 | +- Automatic clean shutdown when tests complete |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +### Basic Command Structure |
| 18 | + |
| 19 | +```bash |
| 20 | +# General syntax |
| 21 | +fdb playground [options] <strategy> [strategy-specific-options] |
| 22 | + |
| 23 | +# Examples |
| 24 | +fdb playground --nodes 5 --base-port 9000 write --workers 20 --data-size 100 --total-ops 5000 |
| 25 | +``` |
| 26 | + |
| 27 | +### Global Options |
| 28 | + |
| 29 | +- `--nodes <number>`: Number of nodes to create (default: 3) |
| 30 | +- `--base-port <port>`: Starting port number for node communication (default: 8000) |
| 31 | +- `--strategy <name>`: Name of the strategy to run (can also be specified as a command) |
| 32 | +- `--log-level <level>`: Logging level (debug, info, warn, error) |
| 33 | + |
| 34 | +### Available Strategies |
| 35 | + |
| 36 | +#### Write Strategy |
| 37 | + |
| 38 | +The write strategy tests write operations to the P2P network with configurable parameters: |
| 39 | + |
| 40 | +```bash |
| 41 | +fdb playground write [options] |
| 42 | +``` |
| 43 | + |
| 44 | +Options: |
| 45 | +- `--target-node <index>`: Index of the node to send writes to (default: 0) |
| 46 | +- `--workers <number>`: Number of concurrent workers (default: 10) |
| 47 | +- `--data-size <kb>`: Size of data to write in KB (default: 10) |
| 48 | +- `--ops-per-sec <number>`: Target operations per second (default: 100) |
| 49 | +- `--total-ops <number>`: Total number of operations (default: 1000) |
| 50 | + |
| 51 | +## Observability |
| 52 | + |
| 53 | +Each node in the playground is assigned a unique identifier (e.g., `playground_peer_0`) that is included in: |
| 54 | + |
| 55 | +1. All log entries |
| 56 | +2. Metrics reported to Prometheus |
| 57 | +3. Traces exported to OpenTelemetry |
| 58 | + |
| 59 | +This allows for detailed per-node analysis in Grafana dashboards and other observability tools. |
| 60 | + |
| 61 | +## Examples |
| 62 | + |
| 63 | +### Run a Write Test with 5 Nodes |
| 64 | + |
| 65 | +```bash |
| 66 | +# Create 5 nodes and run a write test with 20 workers, 100KB data size, and 5000 total operations |
| 67 | +fdb playground --nodes 5 write --workers 20 --data-size 100 --total-ops 5000 |
| 68 | +``` |
| 69 | + |
| 70 | +### Custom Port Configuration |
| 71 | + |
| 72 | +```bash |
| 73 | +# Start with base port 9000 instead of default 8000 |
| 74 | +fdb playground --base-port 9000 write |
| 75 | +``` |
| 76 | + |
| 77 | +### Detailed Logging |
| 78 | + |
| 79 | +```bash |
| 80 | +# Enable debug-level logging |
| 81 | +fdb playground --log-level debug write |
| 82 | +``` |
0 commit comments