Skip to content

onizmx/go-redis-memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-redis Memory Leak Detection Tool

Tool to detect and compare memory leaks across any go-redis versions.

Related to: go-redis#3465

🚀 Quick Start

# Setup
git clone https://github.com/yourusername/go-redis-memory-test.git
cd go-redis-memory-test
make setup

# Test versions (required - specify which versions to test)
make test v9.11.0 v9.12.0 v9.12.1    # Recommended: test the leak
make test v9.11.0                    # Test single version

📊 Key Findings

Testing shows significant memory issues in v9.12.0 and v9.12.1:

Version Memory Usage GC Activity Leak Status
v9.11.0 ~3 MB avg Normal (21 GCs/min) ✅ No leak
v9.12.0 ~52 MB avg Poor (5 GCs/min) ❌ Severe leak
v9.12.1 ~28 MB avg Poor (7 GCs/min) ⚠️ Moderate leak

Note: v9.12.0+ has larger buffer sizes (ReadBufferSize/WriteBufferSize) which increase initial allocation, but the continuous memory growth indicates actual memory leaks.

📈 How It Works

  1. Starts a 6-node Redis cluster using Docker
  2. Tests each specified version for 5 minutes
  3. Runs intensive operations (SET, GET, pipelines, pub/sub)
  4. Analyzes memory GROWTH RATE after warmup period
  5. Generates comparison charts (when testing 2+ versions)

🔬 Memory Leak Detection

The tool focuses on memory growth rate (not initial allocation) after a warmup period:

  • Severe Leak: >10 MB/minute growth
  • ⚠️ Moderate Leak: 5-10 MB/minute growth
  • 🟡 Possible Leak: 1-5 MB/minute growth
  • 🔵 Minor Leak: 0.5-1 MB/minute growth
  • No Leak: <0.5 MB/minute growth

Important: The analysis ignores initial memory allocation differences (which can be due to buffer size changes) and focuses purely on continuous growth patterns that indicate actual memory leaks.

📁 Output

Results are saved to output/comparison_YYYYMMDD_HHMMSS/:

  • memory_stats_vX.Y.Z.csv - Raw data per version
  • test_vX.Y.Z.log - Test logs per version
  • comparison.png - Visual comparison (2+ versions)
  • comparison_report.txt - Detailed analysis (2+ versions)

🛠️ More Examples

# Test latest versions
make test v9.12.0 v9.12.1 v9.13.0

# Test patch versions
make test v9.11.0 v9.11.1 v9.11.2

# Test major version differences  
make test v8.11.5 v9.0.0 v9.12.0

📋 Requirements

  • Docker & Docker Compose
  • Go 1.19+
  • Python 3.8+ (matplotlib, pandas, numpy)
  • ~2GB RAM
  • ~500MB disk space

🐛 Troubleshooting

Port conflicts

make clean
# Wait a few seconds
make test v9.11.0 v9.12.0 v9.12.1

Invalid version

Versions must be in format vX.Y.Z (e.g., v9.11.0)

Docker issues

docker-compose -f docker/docker-compose.yml down -v
docker system prune -f

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published