Cache Monitoring
This guide covers the monitoring dashboard for managed Redis, Valkey and Dragonfly caches, followed by Redis command-line examples for investigating individual nodes.
Overview
The cache monitoring dashboard includes:
- Real-time Metrics: CPU, memory, connections, operations
- Performance Tracking: Hit rates, latency, throughput
- Historical Charts: Select a window of up to seven days, subject to available samples
- Custom Alerts: Email notifications for critical events
- Slow Query Logging: Identify performance bottlenecks
- API Access: Cache metrics are also available over the public API for your own integrations
Key Metrics
Memory Metrics
Used Memory
The dashboard shows container memory across the observed cache nodes:
- What it shows: Container working-set memory and container memory limits. This differs from the engine's
used_memoryandmaxmemory, which determine cache eviction pressure. - Healthy range: 60-80% of allocated memory
- Alert at: > 90%
Command:
INFO memory | grep used_memory_human
# used_memory_human:2.50G
Hit Rate
Cache hit ratio:
- Formula: hits / (hits + misses) × 100
- Healthy range: > 90%
- Alert at: < 80%
Command:
INFO stats | grep keyspace
# keyspace_hits:1000000
# keyspace_misses:50000
# Hit rate: 95.2%
Evicted Keys
Keys removed due to memory pressure:
- What it shows: Memory eviction activity
- Healthy range: 0-10 keys/sec
- Alert at: > 100 keys/sec
Command:
INFO stats | grep evicted_keys
Performance Metrics
Operations Per Second
Total commands processed:
- What it shows: Workload intensity
- Healthy range: Varies by instance size
- Monitor for: Sudden spikes or drops
Command:
INFO stats | grep instantaneous_ops_per_sec
# instantaneous_ops_per_sec:5432
Latency
Average command execution time reported by Redis and Valkey:
- What it shows: Mean time spent executing commands inside the engine, weighted by command count across observed nodes. It does not include your application's network round trip.
- Healthy range: < 1ms
- Alert at: > 10ms
Client round-trip check (a different measurement from the dashboard's execution-time chart):
redis-cli --latency -h redis-123456.danubedata.ro -a password
# min: 0, max: 1, avg: 0.08 (96 samples)
Slow Queries
Commands exceeding threshold:
- Default threshold: 10ms
- Monitor: Count and patterns
- Alert at: > 10 slow queries/minute
Command:
SLOWLOG GET 10
Connection Metrics
Connected Clients
Active client connections:
- Healthy range: < max_connections
- Alert at: > 80% of max_connections
Command:
INFO clients | grep connected_clients
# connected_clients:245
Rejected Connections
Connections refused due to limits:
- Healthy: 0
- Alert at: > 0
Command:
INFO stats | grep rejected_connections
Replication Metrics
Replication Lag
The highest reported replica lag, in seconds, for supported Redis and Valkey deployments with replicas:
- Healthy: < 1 second
- Alert at: > 5 seconds
Command:
# On primary
INFO replication
# On replica
INFO replication | grep master_last_io_seconds_ago
Dashboard Monitoring
Overview Dashboard
Open your cache instance's Monitoring tab to view:
- Resource Usage: CPU, memory, network
- Performance: Ops/sec, latency, hit rate
- Connections: Active, total, rejected
- Replication: Lag, status, connected replicas
Real-time Graphs
Available graphs cover windows from one hour to seven days:
- Memory Usage: Used vs allocated
- Operations Per Second: Total command throughput
- Hit Rate: Cache effectiveness
- Connected Clients: Connection count
- Network I/O: Bytes in/out
- CPU Usage: CPU cores used across observed cache nodes
Additional charts cover evictions, expirations, total and expiring keys, rejected connections, and supported engine metrics such as fragmentation, persistence and replica lag.
Reading the Figures
- Scope: Connections, operation rates and network traffic are totals across observed nodes. Memory is total container usage; the compact instance overview instead highlights the fullest node. CPU is displayed in cores, so
2.0means two cores in use, not 2% of the allocation. - Keys: The count is the largest observed node dataset, summed across that node's databases. Replica copies are not added together.
- Hit rate: The chart combines hit and miss rates across nodes. The summary combines counters since each observed node's last start. With no reads, no hit rate can be calculated.
- Replication and persistence: Lag and fragmentation show the highest observed value. Unsaved changes show the highest node count. The last-save age uses the oldest reported save, and running time uses the most recently restarted observed node.
- Health: Healthy means the observed monitoring targets answered their checks. It does not guarantee that every replica has a separate monitoring target. Failed checks show Unhealthy; incomplete or unavailable checks show Unknown.
- Missing data: Unavailable samples remain gaps, not zeroes. Supported metrics remain visible while waiting for data. Engine details and replication charts depend on provider capabilities; Dragonfly's compatibility metrics do not provide all Redis/Valkey internals.
- Freshness: The displayed retrieval time describes the response, not the age of every underlying sample. Failed refreshes retain previous figures with a stale-data label.
Customizing View
- Open Monitoring.
- Select the time range and chart period.
- Filter charts by category and use pagination to see more.
- Refresh manually or enable Auto-refresh. Automatic requests pause while the page is hidden.
API Missing Values
The public cache metrics response includes capabilities, alongside summary and health. Summary values are null when unavailable; a genuine zero remains zero. Health exposes status (healthy, unhealthy or unknown), and its boolean fields can be null when the checks are unknown. Integrations should handle these states explicitly.
checked_at and retrieved_at describe when the response was evaluated. Health's observed_at, when present, comes from the monitoring samples; a missing observation time is null. Historical API CPU fields retain their existing core-percent units: a value of 200 means two cores. The console converts them to cores for display.
Command-Line Monitoring
INFO Command
Get comprehensive server information:
# All info
redis-cli INFO
# Specific section
redis-cli INFO memory
redis-cli INFO stats
redis-cli INFO replication
redis-cli INFO cpu
redis-cli INFO clients
Key Statistics
# Database statistics
redis-cli INFO keyspace
# db0:keys=10000,expires=5000,avg_ttl=3600000
# Memory details
redis-cli INFO memory | grep -E 'used_memory_human|used_memory_peak_human|mem_fragmentation_ratio'
# Commands processed
redis-cli INFO stats | grep total_commands_processed
# Hit rate calculation
redis-cli INFO stats | grep -E 'keyspace_hits|keyspace_misses'
Real-time Monitoring
# Monitor all commands in real-time
redis-cli MONITOR
# Continuous stats
redis-cli --stat
------- data ------ --------------------- load -------------------- - child -
keys mem clients blocked requests connections
10000 2.50G 245 0 1000000 (+0) 5000
10000 2.50G 245 0 1000050 (+50) 5000
# Latency monitoring
redis-cli --latency
min: 0, max: 2, avg: 0.15 (1234 samples)
# Big keys analysis
redis-cli --bigkeys
Slow Query Log
Monitor slow commands:
# Get last 10 slow queries
SLOWLOG GET 10
# Get slow query count
SLOWLOG LEN
# Reset slow log
SLOWLOG RESET
# Example output:
1) 1) (integer) 123 # Query ID
2) (integer) 1634567890 # Timestamp
3) (integer) 15000 # Execution time (microseconds)
4) 1) "KEYS" # Command
2) "*"
Performance Analysis
Memory Analysis
# Memory breakdown
redis-cli INFO memory
# Key categories:
# used_memory: Total allocated by Redis
# used_memory_rss: Actual RAM used (OS perspective)
# used_memory_peak: Maximum memory used
# mem_fragmentation_ratio: RSS/used (ideal: 1.0-1.5)
# Sample objects
redis-cli --memkeys --memkeys-samples 10000
Command Statistics
# Command stats
redis-cli INFO commandstats
# Output:
# cmdstat_get:calls=1000000,usec=500000,usec_per_call=0.50
# cmdstat_set:calls=500000,usec=300000,usec_per_call=0.60
# Most frequent commands
redis-cli INFO commandstats | sort -t= -k2 -nr | head -10
Key Space Analysis
# Keys by database
redis-cli INFO keyspace
# Sample keys
redis-cli --scan --pattern 'user:*' | head -20
# Key types distribution
for key in $(redis-cli --scan | head -1000); do
redis-cli TYPE $key
done | sort | uniq -c
Instance Logs
Beyond metrics, every cache instance's logs are searchable from the Logs page under the Observability section in your sidebar — or jump straight in from the instance page:
- Search and filter by level, keyword, or a regex pattern across any of your instances
- Live-tail logs as they happen, with automatic reconnect if your connection drops
- Drag to zoom into any window on the volume chart to jump to the matching log lines
Automatic Health Monitoring
DanubeData continuously watches the health of your running cache instances:
- The moment a problem opens (for example a crash loop or out-of-memory), your whole team is notified by email and in the Notification Center, with the reason included
- A warning banner appears directly on the affected cache instance page
- Alerts clear themselves automatically once the instance recovers
- If you have a webhook configured, health alerts flow through it too
Alerting
Available Alerts
Configure alerts for:
- High Memory Usage: > 90%
- Low Hit Rate: < 80%
- High Eviction Rate: > 100 keys/sec
- Connection Limit: > 80% of max
- Replication Lag: > 5 seconds
- Instance Down: Health check failure
- Persistence Failure: RDB/AOF save failed
You'll also receive a follow-up notification automatically when a metric returns to normal, so you know the moment an issue resolves.
Setting Up Alerts
- Navigate to Redis instance
- Click Settings > Alerts
- Click Add Alert
- Configure:
- Metric: Select metric to monitor
- Condition: Threshold and comparison
- Duration: How long condition must persist
- Notification: Email recipients
- Click Save Alert
Alert Examples
High Memory Alert:
Metric: Memory Usage
Condition: > 90%
Duration: 5 minutes
Action: Email admin@example.com
Low Hit Rate Alert:
Metric: Hit Rate
Condition: < 80%
Duration: 15 minutes
Action: Email team@example.com
Replication Lag Alert:
Metric: Replication Lag
Condition: > 5 seconds
Duration: 2 minutes
Action: Email ops@example.com
Monitoring Scripts
Health Check Script
import redis
import sys
def check_redis_health(host, password):
try:
r = redis.Redis(host=host, password=password, ssl=True)
# Basic connectivity
if not r.ping():
print("ERROR: Cannot ping Redis")
return False
# Memory check
info = r.info('memory')
memory_used_pct = (info['used_memory'] / info['maxmemory']) * 100
if memory_used_pct > 90:
print(f"WARNING: Memory usage at {memory_used_pct:.1f}%")
# Hit rate check
stats = r.info('stats')
hits = stats['keyspace_hits']
misses = stats['keyspace_misses']
hit_rate = (hits / (hits + misses)) * 100 if (hits + misses) > 0 else 0
if hit_rate < 80:
print(f"WARNING: Hit rate at {hit_rate:.1f}%")
# Connection check
clients = r.info('clients')
if clients['connected_clients'] > 8000: # Assuming max 10000
print(f"WARNING: High connection count: {clients['connected_clients']}")
print("HEALTHY: All checks passed")
return True
except Exception as e:
print(f"ERROR: {e}")
return False
if __name__ == '__main__':
result = check_redis_health('redis-123456.danubedata.ro', 'password')
sys.exit(0 if result else 1)
Metrics Collection Script
#!/bin/bash
# collect_redis_metrics.sh
HOST="redis-123456.danubedata.ro"
PASS="your_password"
OUTPUT="/var/log/redis/metrics.log"
while true; do
TIMESTAMP=$(date +%s)
# Get metrics
MEMORY=$(redis-cli -h $HOST -a $PASS --no-auth-warning INFO memory | grep used_memory: | cut -d: -f2)
OPS=$(redis-cli -h $HOST -a $PASS --no-auth-warning INFO stats | grep instantaneous_ops_per_sec | cut -d: -f2)
CLIENTS=$(redis-cli -h $HOST -a $PASS --no-auth-warning INFO clients | grep connected_clients | cut -d: -f2)
# Log metrics
echo "$TIMESTAMP,$MEMORY,$OPS,$CLIENTS" >> $OUTPUT
sleep 60
done
Best Practices
Monitoring Strategy
- Monitor Key Metrics: Focus on memory, hit rate, latency
- Set Appropriate Alerts: Not too sensitive, not too lenient
- Regular Review: Weekly review of trends
- Baseline Performance: Know your normal patterns
- Proactive Monitoring: Catch issues before they impact users
Performance Baselines
Establish baselines for:
- Peak Traffic: Ops/sec during busy periods
- Average Latency: Typical response times
- Memory Growth: Daily/weekly memory increase
- Hit Rate: Expected cache effectiveness
- Connection Patterns: Normal connection count
Troubleshooting Workflow
- Identify Symptom: What is the observed issue?
- Check Dashboard: Review recent metrics
- Run Commands: Use Redis CLI for details
- Review Logs: Check for errors or warnings
- Analyze Patterns: Look for correlations
- Test Fix: Implement and verify solution
- Document: Record issue and resolution
Common Issues and Solutions
High Memory Usage
Detection:
redis-cli INFO memory | grep used_memory_human
Solutions:
- Set expiration on keys
- Review eviction policy
- Implement data cleanup
- Upgrade to larger instance
Low Hit Rate
Detection:
redis-cli INFO stats | grep keyspace
Solutions:
- Review cache key patterns
- Increase TTL for stable data
- Pre-warm cache
- Review application caching logic
High Latency
Detection:
redis-cli --latency
Solutions:
- Check slow query log
- Review command patterns
- Use pipelining
- Upgrade instance
- Check network latency
Connection Exhaustion
Detection:
redis-cli INFO clients | grep connected_clients
Solutions:
- Implement connection pooling
- Fix connection leaks
- Increase max_connections
- Review client configuration