Skip to content

Commit 43c3ed3

Browse files
committed
feature/dev-tools
1 parent 83dde7c commit 43c3ed3

File tree

13 files changed

+5089
-0
lines changed

13 files changed

+5089
-0
lines changed

dev-tools/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Cardano DB Sync - Developer Tools
2+
3+
Local development tools for monitoring and profiling cardano-db-sync.
4+
5+
## Overview
6+
7+
Two complementary tools for understanding cardano-db-sync performance:
8+
9+
### 🔍 [Monitoring](monitoring/README.md)
10+
Real-time metrics with Prometheus/Grafana
11+
- PostgreSQL metrics (queries, cache, connections)
12+
- System metrics (CPU, memory, disk I/O)
13+
- Time-series visualization
14+
15+
### 🧠 [Profiling](profiling/README.md)
16+
Memory profiling with ghc-debug
17+
- Interactive heap exploration
18+
- Memory leak detection
19+
- Retainer chain analysis
20+
21+
## Installation
22+
23+
### Monitoring
24+
25+
```bash
26+
# macOS
27+
brew install tmux prometheus postgres_exporter node_exporter grafana
28+
29+
# Linux (apt)
30+
sudo apt-get install tmux prometheus postgres-exporter prometheus-node-exporter grafana
31+
32+
# Linux (yum)
33+
sudo yum install tmux prometheus postgres_exporter node_exporter grafana
34+
```
35+
36+
### Profiling
37+
38+
```bash
39+
# Install ghc-debug-brick
40+
git clone https://gitlab.haskell.org/ghc/ghc-debug.git
41+
cd ghc-debug/brick
42+
cabal install ghc-debug-brick
43+
44+
# Instrument cardano-db-sync (see profiling/README.md for details)
45+
```
46+
47+
## Running
48+
49+
### Start Monitoring
50+
51+
```bash
52+
cd dev-tools/monitoring
53+
./scripts/start-monitoring.sh
54+
```
55+
56+
Access at:
57+
- Prometheus: http://localhost:9090
58+
- Grafana: http://localhost:3000 (if started separately)
59+
60+
### Start Profiling
61+
62+
```bash
63+
cd dev-tools/profiling
64+
./scripts/start-profiling.sh
65+
66+
# In another terminal (after several hours):
67+
ghc-debug-brick /tmp/cardano-db-sync.ghc-debug
68+
```
69+
70+
### Run Both Together
71+
72+
```bash
73+
# Terminal 1: Monitoring
74+
cd dev-tools/monitoring && ./scripts/start-monitoring.sh
75+
76+
# Terminal 2: Profiling
77+
cd dev-tools/profiling && ./scripts/start-profiling.sh
78+
```
79+
80+
## Directory Structure
81+
82+
```
83+
dev-tools/
84+
├── README.md # This file
85+
86+
├── monitoring/ # Prometheus/Grafana monitoring
87+
│ ├── README.md # Full monitoring documentation
88+
│ ├── scripts/
89+
│ │ └── start-monitoring.sh
90+
│ ├── config/
91+
│ │ └── prometheus.yml
92+
│ ├── data/ # Prometheus data (gitignored)
93+
│ └── docs/
94+
│ └── METRICS.md # Available metrics
95+
96+
└── profiling/ # ghc-debug profiling
97+
├── README.md # Full profiling documentation
98+
├── scripts/
99+
│ ├── start-profiling.sh
100+
│ └── analyze-memory.sh
101+
├── snapshots/ # Heap snapshots (gitignored)
102+
├── logs/ # Memory logs (gitignored)
103+
└── reports/ # Analysis reports (commit these)
104+
```
105+
106+
## Documentation
107+
108+
- [Monitoring Setup Guide](monitoring/README.md)
109+
- [Profiling Setup Guide](profiling/README.md)
110+
- [Available Metrics Reference](monitoring/docs/METRICS.md)

0 commit comments

Comments
 (0)