Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ba0e89c
Add TPS monitoring tool
Vsevolod-Rusinskiy Jul 18, 2025
088f93a
Update .gitignore to include docs/ directory and optimize showStats m…
Vsevolod-Rusinskiy Jul 21, 2025
9b2793d
Refactor: modular TPS monitor with Utils class
Vsevolod-Rusinskiy Jul 21, 2025
883b6bd
Add CSV export to dedicated folder
Vsevolod-Rusinskiy Jul 21, 2025
21c391e
Move common components to shared folder
Vsevolod-Rusinskiy Jul 22, 2025
7175944
Decompose transaction sender into modular architecture
Vsevolod-Rusinskiy Jul 22, 2025
045a33f
Simplify CLI parameters with defaults
Vsevolod-Rusinskiy Jul 22, 2025
138e027
fix: add missing getApi method to ApiConnector
Vsevolod-Rusinskiy Jul 22, 2025
3abc506
Remove csv-report files from tracking and update .gitignore
Vsevolod-Rusinskiy Jul 22, 2025
2670ddb
feat: rename orchestrator to dashboard and update Phase 1 progress
Vsevolod-Rusinskiy Jul 22, 2025
c7e9119
feat: implement structured logging system - Phase 3a complete
Vsevolod-Rusinskiy Jul 22, 2025
56eda61
feat: migrate monitor core modules to structured logging
Vsevolod-Rusinskiy Jul 22, 2025
3238559
feat: migrate statistics-reporter to structured logging
Vsevolod-Rusinskiy Jul 22, 2025
43cd860
feat: complete monitor modules logging migration
Vsevolod-Rusinskiy Jul 22, 2025
b45cea7
feat: complete sender modules logging migration
Vsevolod-Rusinskiy Jul 22, 2025
0a5ce5f
feat(dashboard): complete TUI component system
Vsevolod-Rusinskiy Jul 23, 2025
263e8a1
Fix TUI dashboard startup and event loop
Vsevolod-Rusinskiy Jul 23, 2025
5598e1d
Fix dashboard layout and API logs display
Vsevolod-Rusinskiy Jul 23, 2025
758beb5
feat: increase log file size limits from 5MB to 20MB
Vsevolod-Rusinskiy Jul 23, 2025
06ba6ee
refactor: remove unused blessed-contrib dependency and simplify TPS g…
Vsevolod-Rusinskiy Jul 24, 2025
afe4a34
feat(dashboard): enhance process management and control panel functio…
Vsevolod-Rusinskiy Jul 24, 2025
d12b29c
refactor(dashboard): improve keyboard handling and logging
Vsevolod-Rusinskiy Jul 24, 2025
c49075b
feat(dashboard): implement file-based logging for console outputs
Vsevolod-Rusinskiy Jul 24, 2025
78f07fe
feat(dashboard): extend file-based logging to include console.warn
Vsevolod-Rusinskiy Jul 24, 2025
4f96afd
refactor(dashboard): update comments for clarity and consistency
Vsevolod-Rusinskiy Jul 24, 2025
6580385
refactor(dashboard): remove general update loop and replace TPS graph…
Vsevolod-Rusinskiy Jul 25, 2025
c76c1e7
feat(dashboard): add memory usage logging to EventLogComponent
Vsevolod-Rusinskiy Jul 25, 2025
cac9c25
refactor(dashboard): update comments for clarity in logging functiona…
Vsevolod-Rusinskiy Jul 25, 2025
263b4c4
refactor(dashboard): comment out TPS metrics updates due to conflict
Vsevolod-Rusinskiy Jul 25, 2025
1a2fa00
feat(dashboard): implement dynamic log file initialization in LogTPSR…
Vsevolod-Rusinskiy Jul 28, 2025
ca178f3
feat(dashboard): enhance logging functionality with custom debug logger
Vsevolod-Rusinskiy Jul 28, 2025
9f6a3e7
refactor(dashboard): simplify structure
Vsevolod-Rusinskiy Jul 28, 2025
c9e9ff4
refactor(dashboard): remove unused scripts and files, add documentation
Vsevolod-Rusinskiy Jul 28, 2025
e1336eb
chore: update .gitignore to include git directory
Vsevolod-Rusinskiy Jul 29, 2025
93f19b9
refactor(tps-monitoring): update README and package.json
Vsevolod-Rusinskiy Jul 29, 2025
773440d
docs: translate README to English and clean up project structure
Vsevolod-Rusinskiy Jul 29, 2025
416caa2
refactor(tps-monitoring): update author and license in package.json, …
Vsevolod-Rusinskiy Jul 30, 2025
078789e
fix(transaction-sender): add proper nonce management
Vsevolod-Rusinskiy Jul 30, 2025
e6008d4
feat(load-testing): add sub-flood load testing tool structure
Vsevolod-Rusinskiy Jul 31, 2025
ac44ebe
refactor(tps-monitoring): update package.json and package-lock.json f…
Vsevolod-Rusinskiy Aug 1, 2025
b598a2e
refactor(tps-monitoring): update package dependencies and clean up pa…
Vsevolod-Rusinskiy Aug 1, 2025
c11de81
chore(tps-monitoring): update .gitignore and tsconfig.json, enhance p…
Vsevolod-Rusinskiy Aug 4, 2025
93ee192
refactor(tps-monitoring): add detailed comments
Vsevolod-Rusinskiy Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tps-monitoring/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
*.log
.DS_Store
tps_stats_*.csv
package-lock.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

177 changes: 177 additions & 0 deletions tps-monitoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# 🚀 TPS-Real: Substrate TPS Measurement Tool

A tool for measuring real TPS (transactions per second) in Polkadot/Substrate blockchains with QuantumFusion support.

## 🎯 Features

- ✅ **QuantumFusion support** - works with transferAllowDeath and other modern Substrate runtimes
- ✅ **Correct TPS measurement** - analyzes blocks, not sending speed
- ✅ **Universal balance transfers** - supports transfer, transferAllowDeath, transferKeepAlive
- ✅ **Optimized logging** - clean output with essential information only
- ✅ **Manual nonce management** - supports multiple transactions
- ✅ **Interactive CLI** - change frequency in real time
- ✅ **Multiple instances** - distributed load from different accounts
- ✅ **Real-time monitoring** - separate program for measuring actual TPS
- ✅ **Data export** - save statistics to CSV

## 📦 Installation

```bash
# Clone the repository
git clone <repository-url>
cd tps-real

# Install dependencies
npm install
```

## 🔧 Requirements

- Node.js >= 16.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add .nvmrc.

- Access to Polkadot/Substrate node via WebSocket
- Accounts with balance for testing

## 🚀 Usage

### 1. Transaction Sender

Program for generating load:

```bash
# Interactive mode (transfers to self)
node src/transaction_sender.js -n ws://localhost:9944 -s "//Alice"

# Transfers between accounts
node src/transaction_sender.js -n ws://localhost:9944 -s "//Alice" -r "//Bob"

# Automatic mode with parameters
node src/transaction_sender.js \
-n ws://localhost:9944 \
-s "//Alice" \
-r "//Bob" \
--rate 10 \
--amount 1000000 \
--auto
```

#### Parameters:
- `-n, --node <url>` - Node URL (required)
- `-s, --sender <seed>` - Sender seed phrase (required)
- `-r, --recipient <seed>` - Recipient seed phrase (default = sender)
- `--rate <number>` - Sending frequency tx/sec (default: 1)
- `--amount <number>` - Transfer amount (default: 1000000)
- `--auto` - Automatic mode without interactivity

#### Interactive commands:
- `start` - start sending transactions
- `stop` - stop sending
- `stats` - show statistics
- `<number>` - change frequency (example: `5` for 5 tx/sec)
- `exit` - exit the program

### 2. TPS Monitoring

Program for measuring real TPS:

```bash
# Monitor all transactions
node src/tps_monitor.js -n ws://localhost:9944

# Monitor specific addresses with CSV export
node src/tps_monitor.js \
-n ws://localhost:9944 \
-a "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty" \
-o tps_data.csv
```

#### Parameters:
- `-n, --node <url>` - Node URL (required)
- `-o, --output <file>` - File to save CSV data
- `-a, --addresses <addresses>` - Tracked addresses (comma-separated)

## 🏃‍♂️ Complete Testing Example

### Step 1: Start monitoring
```bash
# Terminal 1 - TPS monitoring
node src/tps_monitor.js -n ws://localhost:9944 -o results.csv
```

### Step 2: Start senders
```bash
# Terminal 2 - Alice sends to herself
node src/transaction_sender.js -n ws://localhost:9944 -s "//Alice" --rate 5 --auto

# Terminal 3 - Bob sends to Charlie
node src/transaction_sender.js -n ws://localhost:9944 -s "//Bob" -r "//Charlie" --rate 3 --auto

# Terminal 4 - Charlie sends to Alice
node src/transaction_sender.js -n ws://localhost:9944 -s "//Charlie" -r "//Alice" --rate 2 --auto
```

### Step 3: Analyze results
The monitor will show:
- Real TPS in the network
- Number of our vs all transactions
- Block statistics
- Data will be saved to `results.csv`

## 📊 Result Interpretation

### TPS calculation:
```
TPS = (transactions in block) × 10 blocks/sec
```

### Example monitor output:
```
🧱 Block #1234 | Total TX: 8 | Our TX: 5 | TPS: 80 (50 ours)
```

This means:
- 8 transactions got into the block
- 5 of them are our test transactions
- Theoretical maximum: 80 TPS
- Our contribution: 50 TPS

## 🔍 Differences from Original Script

### ❌ Errors in original:
1. **Wrong transaction type**: `system.remark` → `balances.transfer`
2. **Automatic nonce**: led to transaction rejections
3. **Measuring sending speed**: instead of real TPS
4. **One-time execution**: sending batch and terminating

### ✅ Fixes:
1. **Balance transfer** - real money transfers
2. **Manual nonce** - correct handling of multiple transactions
3. **Block reading** - measuring real TPS
4. **Continuous operation** - configurable sending frequency
5. **Block monitoring** - separate program for analysis

## 🛠️ Troubleshooting

### Transactions don't go through:
- Check account balance
- Verify seed phrases are correct
- Check node connection

### Low TPS:
- Try reducing sending frequency
- Run multiple instances with different accounts
- Check node load

### Nonce errors:
- Restart sender (nonce will be recalculated)
- Use different accounts for parallel instances

## 📈 Gradual Load Increase

```bash
# Start with low load
node src/transaction_sender.js -n ws://localhost:9944 -s "//Alice" --rate 1

# In interactive mode, gradually increase:
# 1 → 5 → 10 → 20 → 50...
# Until you find the bottleneck
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Does it detect saturation and stop increasing the send rate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find this in the source code by the way.

31 changes: 31 additions & 0 deletions tps-monitoring/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "tps-real",
"version": "1.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.1.0?

"description": "Real TPS measurement tool for Polkadot/Substrate blockchains with QuantumFusion support",
"type": "module",
"main": "src/transaction_sender.js",
"scripts": {
"sender": "node src/transaction_sender.js",
"monitor": "node src/tps_monitor.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@polkadot/api": "^14.2.2",
"@polkadot/util-crypto": "^13.1.1",
"commander": "^11.1.0"
},
"keywords": [
"polkadot",
"substrate",
"quantumfusion",
"tps",
"blockchain",
"performance",
"measurement"
],
"author": "Your Name",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
}
}
Loading