|
| 1 | +# Redis Test App - Docker Setup |
| 2 | + |
| 3 | +Simple Docker-based setup for running the Redis testing application with full monitoring capabilities. |
| 4 | + |
| 5 | +## 🚀 Quick Start |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | +- Docker and Docker Compose installed |
| 9 | +- At least 4GB RAM available |
| 10 | + |
| 11 | +### Run Everything |
| 12 | +```bash |
| 13 | +./setup.sh |
| 14 | +``` |
| 15 | + |
| 16 | +That's it! The script will: |
| 17 | +- Build the Redis test application |
| 18 | +- Start Redis database |
| 19 | +- Start monitoring services (Prometheus, Grafana, Jaeger) |
| 20 | +- Run the test workload |
| 21 | + |
| 22 | +## 📊 Access Points |
| 23 | + |
| 24 | +After running `./setup.sh`, you can access: |
| 25 | + |
| 26 | +- **Application Metrics**: http://localhost:8000/metrics |
| 27 | +- **Grafana Dashboards**: http://localhost:3000 (admin/admin) |
| 28 | +- **Prometheus**: http://localhost:9090 |
| 29 | +- **Jaeger Tracing**: http://localhost:16686 |
| 30 | +- **Redis Database**: localhost:6379 |
| 31 | + |
| 32 | +## 🔧 Customization |
| 33 | + |
| 34 | +### Change Test Workload |
| 35 | +Edit `docker-compose.yml` and modify the command section: |
| 36 | + |
| 37 | +```yaml |
| 38 | +command: > |
| 39 | + python main.py |
| 40 | + --workload-profile basic_rw # Change workload type |
| 41 | + --duration 1800 # Change duration (seconds) |
| 42 | + --target-ops-per-second 500 # Change target throughput |
| 43 | +``` |
| 44 | +
|
| 45 | +Available workload profiles: |
| 46 | +- `basic_rw` - Basic read/write operations |
| 47 | +- `high_throughput` - High-performance testing |
| 48 | +- `list_operations` - List-based operations |
| 49 | +- `pubsub_test` - Pub/Sub testing |
| 50 | +- `transaction_test` - Transaction testing |
| 51 | + |
| 52 | +### Restart with New Configuration |
| 53 | +```bash |
| 54 | +docker-compose restart redis-test-app |
| 55 | +``` |
| 56 | + |
| 57 | +## 📝 Management Commands |
| 58 | + |
| 59 | +### View Logs |
| 60 | +```bash |
| 61 | +# All services |
| 62 | +docker-compose logs -f |
| 63 | +
|
| 64 | +# Just the test app |
| 65 | +docker-compose logs -f redis-test-app |
| 66 | +
|
| 67 | +# Just Redis |
| 68 | +docker-compose logs -f redis |
| 69 | +``` |
| 70 | + |
| 71 | +### Check Status |
| 72 | +```bash |
| 73 | +docker-compose ps |
| 74 | +``` |
| 75 | + |
| 76 | +### Stop Services |
| 77 | +```bash |
| 78 | +docker-compose down |
| 79 | +``` |
| 80 | + |
| 81 | +### Complete Cleanup |
| 82 | +```bash |
| 83 | +# Stop services only |
| 84 | +./cleanup.sh |
| 85 | +
|
| 86 | +# Stop and remove data |
| 87 | +./cleanup.sh --remove-data |
| 88 | +
|
| 89 | +# Stop, remove data and images |
| 90 | +./cleanup.sh --remove-data --remove-images |
| 91 | +``` |
| 92 | + |
| 93 | +## 🎯 Use Cases |
| 94 | + |
| 95 | +### Local Development |
| 96 | +- Test Redis performance |
| 97 | +- Debug connection issues |
| 98 | +- Monitor application metrics |
| 99 | +- Analyze traces |
| 100 | + |
| 101 | +### Performance Testing |
| 102 | +- Run long-duration tests |
| 103 | +- Monitor memory usage |
| 104 | +- Track performance over time |
| 105 | +- Detect memory leaks |
| 106 | + |
| 107 | +### Cloud Deployment |
| 108 | +The same Docker setup can be deployed to: |
| 109 | +- AWS ECS/EKS |
| 110 | +- Google Cloud Run/GKE |
| 111 | +- Azure Container Instances/AKS |
| 112 | +- Any Docker-compatible platform |
| 113 | + |
| 114 | +## 🔍 Monitoring |
| 115 | + |
| 116 | +### Key Metrics Available |
| 117 | +- **Operations per second** by operation type |
| 118 | +- **Latency percentiles** (50th, 95th, 99th) |
| 119 | +- **Error rates** and error types |
| 120 | +- **Connection health** and reconnections |
| 121 | +- **Memory and CPU usage** |
| 122 | + |
| 123 | +### Grafana Dashboards |
| 124 | +Pre-configured dashboards show: |
| 125 | +- Redis operation performance |
| 126 | +- Application health |
| 127 | +- Error tracking |
| 128 | +- Resource utilization |
| 129 | + |
| 130 | +### Distributed Tracing |
| 131 | +Jaeger provides detailed traces for: |
| 132 | +- Individual Redis operations |
| 133 | +- Connection management |
| 134 | +- Error propagation |
| 135 | +- Performance bottlenecks |
| 136 | + |
| 137 | +## 🛠️ Troubleshooting |
| 138 | + |
| 139 | +### Services Won't Start |
| 140 | +```bash |
| 141 | +# Check Docker is running |
| 142 | +docker info |
| 143 | +
|
| 144 | +# Check logs for errors |
| 145 | +docker-compose logs |
| 146 | +
|
| 147 | +# Restart everything |
| 148 | +./cleanup.sh && ./setup.sh |
| 149 | +``` |
| 150 | + |
| 151 | +### High Resource Usage |
| 152 | +- Reduce test duration or throughput |
| 153 | +- Adjust metrics retention in Prometheus |
| 154 | +- Scale down monitoring services if needed |
| 155 | + |
| 156 | +### Port Conflicts |
| 157 | +If ports are already in use, modify `docker-compose.yml`: |
| 158 | +- Change `8000:8000` to `8001:8000` for metrics |
| 159 | +- Change `3000:3000` to `3001:3000` for Grafana |
| 160 | +- etc. |
| 161 | + |
| 162 | +## 📚 Next Steps |
| 163 | + |
| 164 | +1. **Run the setup**: `./setup.sh` |
| 165 | +2. **Open Grafana**: http://localhost:3000 |
| 166 | +3. **Monitor your tests**: Watch the dashboards |
| 167 | +4. **Customize workloads**: Edit docker-compose.yml |
| 168 | +5. **Deploy to cloud**: Use the same configuration |
| 169 | + |
| 170 | +The application is designed for both short-term testing and long-term monitoring to detect performance degradations and memory leaks across different Redis versions. |
0 commit comments