Cache Configuration
Tune your cache for optimal performance and reliability.
Viewing Configuration
- Navigate to your cache instance
- Click the Configuration tab
- View current settings
Scaling
Cluster size (shard count)
The number of shards is fixed at creation and cannot be changed afterwards. Changing the number of shards requires migrating data to a new instance.
Storage class
The storage class (standard or performance) is fixed at creation and cannot be changed afterwards. Create a new instance if you need a different storage class.
Scaling Up
Upgrade to a larger flavor or compute class:
- Go to your cache instance
- Click Edit
- Select a larger instance class
- Click Save
Scaling operations are performed with minimal downtime (< 30 seconds).
Compute Classes and Flavors
| Class | Description | Best For |
|---|---|---|
| Eco | Shared resources | Development and testing |
| Standard | Balanced performance | General production caches |
| Production | Dedicated resources | Critical caches with guaranteed performance |
Within each compute class, select a flavor (Small, Medium, Large, XLarge) that defines the CPU and memory allocation. See Cache Overview for details.
Storage Management
Every Valkey shard uses a persistent volume. Storage remains allocated while the instance is stopped.
Increasing Storage
- Go to your cache instance
- Click Edit
- Increase storage size
- Click Save
Storage increases apply immediately without downtime.
Storage can only be increased, not decreased.
Memory Management
Max Memory Policy
Configure behavior when memory is full:
| Policy | Behavior |
|---|---|
noeviction | Return errors when full |
allkeys-lru | Evict least recently used keys |
volatile-lru | Evict LRU keys with TTL only |
allkeys-random | Evict random keys |
volatile-random | Evict random keys with TTL |
volatile-ttl | Evict keys with shortest TTL |
Recommended: allkeys-lru for caching use cases.
Memory Usage
Check current memory:
redis-cli -h host -a password INFO memory
Key metrics:
used_memory- Total allocated memoryused_memory_peak- Maximum memory usedmaxmemory- Memory limit
Memory Optimization
1. Set TTL on All Keys
// Always set expiration
await redis.set('key', 'value', 'EX', 3600);
// Don't store data forever
await redis.set('key', 'value'); // Bad
2. Use Efficient Data Structures
// Storing user data
// Less efficient - many keys
await redis.set('user:1:name', 'John');
await redis.set('user:1:email', '[email protected]');
// More efficient - single hash
await redis.hset('user:1', {
name: 'John',
email: '[email protected]'
});
3. Compress Large Values
const zlib = require('zlib');
// Store compressed
const compressed = zlib.gzipSync(JSON.stringify(largeData));
await redis.set('key', compressed);
// Retrieve and decompress
const data = zlib.gunzipSync(await redis.getBuffer('key'));
Connection Management
Connection Limits
Connection limits depend on your compute class and resources. More resources support more connections.
| Class | CPU | Approximate Max Connections |
|---|---|---|
| Eco | 0.5-1 vCPU | 100-200 |
| Eco | 2-3 vCPU | 200-500 |
| Standard | 1 vCPU | 500 |
| Standard | 2+ vCPU | 1000 |
| Production | 2-6 vCPU | 1000-2000+ |
Monitoring Connections
redis-cli -h host -a password INFO clients
Key metrics:
connected_clients- Current connectionsblocked_clients- Clients in blocking operationsmaxclients- Maximum allowed
Connection Best Practices
Use Connection Pooling
// Node.js with ioredis (built-in pooling)
const redis = new Redis({
host: 'host',
password: 'password',
lazyConnect: true
});
// Python with connection pool
pool = redis.ConnectionPool(max_connections=20)
r = redis.Redis(connection_pool=pool)
Set Timeouts
const redis = new Redis({
connectTimeout: 5000,
commandTimeout: 5000,
keepAlive: 10000
});
Handle Disconnections
redis.on('error', (err) => {
console.error('Redis connection error:', err);
});
redis.on('close', () => {
console.log('Redis connection closed');
});
redis.on('reconnecting', () => {
console.log('Reconnecting to Redis...');
});
Persistence
Every Valkey shard uses a persistent volume with periodic RDB snapshots. Valkey automatically manages snapshot scheduling — you do not need to configure RDB or AOF settings.
Managed backup scheduling and restore are not available. RDB snapshots on the instance's persistent volume do not replace an external backup.
Performance Tuning
Slow Log
Monitor slow commands:
# Get last 10 slow commands
redis-cli SLOWLOG GET 10
# Configure threshold (microseconds)
CONFIG SET slowlog-log-slower-than 10000
Latency Monitoring
# Continuous latency monitoring
redis-cli --latency
# Latency history
redis-cli --latency-history
Client Output Buffer
For pub/sub and blocking operations:
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
Security
Password Management
Change the password on an existing instance:
- Go to your cache instance
- Click Edit
- Enter the new password
- Click Save
- Update your application configurations to use the new password
Leave the password field blank when editing to keep the current password unchanged.
Authentication
Password authentication is optional for internal connections but required when public access is enabled.
To enable/disable authentication:
- Go to cache settings
- Toggle Authentication
- Save changes
You cannot enable public access without authentication. The system enforces this for security.
Network Access
By default, cache instances are only accessible from:
- Containers in the same project
- Internal project network
Public Access
Enable external access to your cache:
- Go to cache settings
- Enable Public Access
- Configure the IP Allowlist — add each allowed CIDR and an optional note (up to 100 characters) to identify its purpose
When enabled:
- A dedicated gateway is created
- Port 6379 is exposed
- Only allowlisted IPs can connect
- Authentication is required
Always configure the IP allowlist when enabling public access. Never expose your cache without IP restrictions. Public connections are unencrypted — TLS is not available for Valkey.
TLS
TLS is not supported for Valkey instances. Connections use unencrypted TCP. Keep sensitive workloads on private networks.
Command Restrictions
Some dangerous commands are disabled:
FLUSHALL
FLUSHDB
DEBUG
CONFIG (write operations)
SHUTDOWN
Valkey Admin
Need to browse keys, run commands, or watch hot keys from a web UI? See Valkey Admin — an optional add-on enabled from the cache form, at no extra cost.
Monitoring
Built-in Metrics
Access via the Metrics tab:
| Metric | Description |
|---|---|
| Memory Usage | Current vs. max memory |
| Connections | Active connection count |
| Operations/sec | Commands processed |
| Hit Rate | Cache hit percentage |
| Network I/O | Bytes in/out |
Key Metrics to Watch
| Metric | Healthy | Warning |
|---|---|---|
| Memory usage | < 80% | > 90% |
| Hit rate | > 80% | < 50% |
| Connections | < 80% limit | Near limit |
| Latency | < 1ms | > 10ms |
Alerts
Set up alerts for:
- Memory usage > 80%
- Connection count > 80% limit
- High latency (> 10ms)
- Error rate increase
Maintenance
Password Rotation
- Go to your cache instance and click Edit
- Enter the new password and click Save
- Update application configurations with the new password
- Deploy applications
- Verify connections
Flushing Data
FLUSHDB and FLUSHALL are disabled by default in SailOps for safety. If you need to clear cached data, delete and recreate the cache instance, or contact support to enable these commands temporarily.
Key Cleanup
Find and remove old keys:
# Find keys matching pattern
redis-cli -h host -a password KEYS "session:*"
# Scan for large keys
redis-cli -h host -a password --bigkeys
Troubleshooting
High Memory Usage
-
Check for keys without TTL:
redis-cli DEBUG OBJECT key -
Find large keys:
redis-cli --bigkeys -
Review memory policy
-
Consider scaling up
Slow Performance
-
Check slow log:
redis-cli SLOWLOG GET 10 -
Monitor latency:
redis-cli --latency -
Review connection count
-
Check for blocking operations
Connection Errors
- Verify connection details
- Check connection limits
- Review client configuration
- Check for connection leaks
High Eviction Rate
If keys are being evicted too often:
- Scale to larger instance
- Review TTL settings
- Optimize data structures
- Consider data partitioning