39 lines
1.4 KiB
Markdown
39 lines
1.4 KiB
Markdown
# Analyze Bottlenecks
|
|
|
|
Analyze performance bottlenecks in the following area: $ARGUMENTS
|
|
|
|
## Analysis Steps:
|
|
1. **CPU Profiling**: Identify CPU-intensive functions and hot paths
|
|
2. **Memory Profiling**: Check for memory leaks and high allocation patterns
|
|
3. **Goroutine Analysis**: Look for goroutine leaks and blocking operations
|
|
4. **I/O Performance**: Analyze network and disk I/O patterns
|
|
5. **Concurrency Issues**: Check for race conditions and lock contention
|
|
|
|
## Profiling Commands:
|
|
```bash
|
|
# CPU profile with detailed analysis
|
|
go tool pprof -top -cum http://localhost:9090/debug/pprof/profile?seconds=60
|
|
|
|
# Memory profile with allocation details
|
|
go tool pprof -alloc_space http://localhost:9090/debug/pprof/heap
|
|
|
|
# Goroutine blocking profile
|
|
go tool pprof http://localhost:9090/debug/pprof/block
|
|
|
|
# Mutex contention profile
|
|
go tool pprof http://localhost:9090/debug/pprof/mutex
|
|
```
|
|
|
|
## Analysis Focus Areas:
|
|
- Worker pool efficiency in `pkg/market/pipeline.go`
|
|
- Event parsing performance in `pkg/events/`
|
|
- Uniswap math calculations in `pkg/uniswap/`
|
|
- Memory usage in large transaction processing
|
|
- Rate limiting effectiveness in `internal/ratelimit/`
|
|
|
|
## Output Requirements:
|
|
- Detailed bottleneck analysis with percentages
|
|
- Flame graphs and performance visualizations
|
|
- Root cause identification for top bottlenecks
|
|
- Optimization recommendations with expected impact
|
|
- Priority ranking of issues |