Troubleshooting and FAQ
This guide covers common issues, how to diagnose problems, and frequently asked questions.
Symptoms:
- p99 latency spikes
- Slow client responses
- Timeouts
Diagnosis:
Check L2 hit rate (persistent mode):
rate(swytch_redis_l2_hits_total[5m])High L2 hits mean the working set exceeds memory. Solution: increase
--maxmemory.Check eviction rate:
rate(swytch_redis_evictions_total[5m])High evictions cause cache churn. Solution: increase
--maxmemory.Check disk I/O (persistent mode):
iostat -x 1High
%utilorawaitindicates disk bottleneck. Solution: use faster storage (NVMe).Check for slow commands:
swytch redis --debug # Logs all commandsLook for
KEYS *, largeLRANGE, or expensive Lua scripts.Check GC pressure:
rate(go_gc_duration_seconds_sum[5m])High GC time indicates memory pressure or allocation-heavy workload.
Symptoms:
- Memory usage higher than expected
- OOM kills
- Evictions despite a low key count
Diagnosis:
Check actual memory vs keys:
redis-cli INFO memory redis-cli DBSIZECalculate expected:
keys × (avg_key_size + avg_value_size + 90)Check for large values:
redis-cli --bigkeysCheck for memory fragmentation: Go’s allocator may hold onto freed memory. This is normal and not a leak.
Check connection count:
redis-cli INFO clientsEach connection uses ~1KB. 10,000 connections = 10MB overhead.
Symptoms:
Connection refusederrors- Can’t connect to Swytch
Diagnosis:
Is Swytch running?
ps aux | grep swytch systemctl status swytchIs it listening on the right address?
netstat -tlnp | grep 6379 ss -tlnp | grep 6379Check
--bindsetting.127.0.0.1only accepts local connections.Firewall blocking?
iptables -L -n | grep 6379At connection limit? Check logs for “max clients reached” messages.
Symptoms:
database is locked by another process
Cause: Another Swytch instance is using the same database file.
Solution:
- Find and stop the other instance:
lsof /path/to/redis.db - If the previous instance crashed, the lock is automatically released.
- Never run multiple instances against the same
--db-path.
Symptoms:
- Data lost after restart
- Keys disappearing
Diagnosis:
Is persistent mode enabled? Check the startup logs for:
using persistent TieredCache storage: /path/to/redis.dbIf you see
using in-memory CloxCache storageinstead, add--persistent --db-path.Check for crash vs graceful shutdown:
- Graceful shutdown (SIGTERM): All data saved
- Process crash: No data loss (OS page cache)
- Power loss: Up to 10ms of writes lost
Check disk space:
df -h /path/to/dbIf disk is full, writes fail silently.
Using ghost mode? Ghost mode (
--ghost) only persists on eviction or shutdown. Crash loses unflushed L1 data.
Symptoms:
- CPU at 100%
- Slow responses
Diagnosis:
Enable pprof:
swytch redis --pprof 6060Capture CPU profile:
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30Common causes:
- Expensive Lua scripts
- Large
KEYS *orSCANoperations - High connection churn
- Serialization overhead with large values
Symptoms:
- Swytch exits immediately
- Error messages on startup
Common errors:
| Error | Cause | Solution |
|---|---|---|
failed to open log file: permission denied | Wrong file permissions | chown swytch:swytch /path/to/db |
database is locked by another process | Another instance running | Stop other instance |
address already in use | Port conflict | Change --port or stop other service |
cannot allocate memory | System out of memory | Reduce --maxmemory or add RAM |
corrupted log entry | Database corruption | Restore from backup |
# All sections
redis-cli INFO
# Specific section
redis-cli INFO memory
redis-cli INFO stats
redis-cli INFO clients
redis-cli INFO persistence
# Memory stats
redis-cli MEMORY STATS
# Find big keys
redis-cli --bigkeys
# Sample random keys
redis-cli RANDOMKEY
# List connected clients
redis-cli CLIENT LIST
# Kill problematic client
redis-cli CLIENT KILL ADDR 192.168.1.100:45678
# Monitor all commands (use briefly, high overhead)
redis-cli MONITOR
using persistent TieredCache storage: /data/redis.db # Persistent mode enabled
using in-memory CloxCache storage # In-memory mode (no persistence)
redis server listening on 127.0.0.1:6379 # Ready to accept connections
Shutting down... # SIGTERM received
| Symptom | Adjustment |
|---|---|
| High eviction rate | Increase --maxmemory |
| Memory usage too low | Decrease --maxmemory |
| OOM kills | Increase container limit, not just maxmemory |
| Symptom | Adjustment |
|---|---|
| Write latency spikes | Use NVMe, not SATA |
| High L2 hit rate | Increase --maxmemory for bigger L1 |
| Disk filling up | add storage, delete old data, or use TTLs |
| Symptom | Adjustment |
|---|---|
| Connection refused | Increase --maxclients |
| Too many connections | Use connection pooling in clients |
| Idle connection timeout | Set --timeout |
Building infrastructure software that enterprises can depend on requires a sustainable business. We’ve chosen a commercial model that lets us focus on quality, support, and long-term development rather than chasing donations or fighting cloud providers over licensing.
Swytch speaks standard Redis and memcached protocols—your data and integrations aren’t locked in. If you need source access for compliance or security review, contact us about our Enterprise license.
Yes. Swytch is designed for production use. Key production features:
- Comprehensive test suite including race detection
- Graceful shutdown with data persistence
- Prometheus metrics for monitoring
- File locking to prevent corruption
| Aspect | Redis | Swytch |
|---|---|---|
| Persistence | AOF/RDB (seconds-minutes of loss) | Tiered (10ms max loss) |
| Eviction | Configurable LRU/LFU | Self-tuning frequency-based |
| Clustering | Yes | No (vertical scaling) |
| Replication | Yes | No |
| Memory efficiency | Good | Similar |
| License | RSALv2/SSPL | Proprietary |
Choose Swytch if you need better persistence guarantees and don’t need clustering. Choose Redis if you need horizontal scaling or prefer open source.
No, Swytch is designed for vertical scaling on a single node. For horizontal scaling, use application-level sharding (hash your keys across multiple Swytch instances) or a proxy like Twemproxy.
Writes fail silently—data stays in L1 memory but is not persisted to disk. Swytch does not automatically evict data to free disk space—disk usage is unbounded unlike memory. Monitor disk usage and add storage or delete old data before it fills.
Yes, any Redis client that supports the RESP protocol works. Swytch implements the Redis 8.x protocol. Check the Redis compatibility page for supported commands.
In persistent mode, simply copy the database file:
cp /data/redis.db /backup/redis-$(date +%Y%m%d).db
You can do this while Swytch is running. See Tiered Storage for details.
Yes, with some limitations. EVAL, EVALSHA, and FUNCTION commands work, but cjson and cmsgpack libraries are
not available. See Redis compatibility.
The cache needs time to warm up. After migrating from another cache:
- Lazy loading: Cache populates as requests come in
- Working set stabilisation: Frequency-based eviction learns your access patterns
Hit rate typically stabilises after 1-2x your average TTL duration.
File an issue at github.com/bottledcode/swytch-/issues with:
- Swytch version (
swytch --version) - Operating system and version
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs
For security issues, email security@getswytch.com instead.