Skip to main content

Cache Configuration

Tune your cache for optimal performance and reliability.

Viewing Configuration​

  1. Navigate to your cache instance
  2. Click the Configuration tab
  3. 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:

  1. Go to your cache instance
  2. Click Edit
  3. Select a larger instance class
  4. Click Save
Zero Downtime

Scaling operations are performed with minimal downtime (< 30 seconds).

Compute Classes and Flavors​

ClassDescriptionBest For
EcoShared resourcesDevelopment and testing
StandardBalanced performanceGeneral production caches
ProductionDedicated resourcesCritical 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​

  1. Go to your cache instance
  2. Click Edit
  3. Increase storage size
  4. Click Save

Storage increases apply immediately without downtime.

Storage

Storage can only be increased, not decreased.

Memory Management​

Max Memory Policy​

Configure behavior when memory is full:

PolicyBehavior
noevictionReturn errors when full
allkeys-lruEvict least recently used keys
volatile-lruEvict LRU keys with TTL only
allkeys-randomEvict random keys
volatile-randomEvict random keys with TTL
volatile-ttlEvict 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 memory
  • used_memory_peak - Maximum memory used
  • maxmemory - 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.

ClassCPUApproximate Max Connections
Eco0.5-1 vCPU100-200
Eco2-3 vCPU200-500
Standard1 vCPU500
Standard2+ vCPU1000
Production2-6 vCPU1000-2000+

Monitoring Connections​

redis-cli -h host -a password INFO clients

Key metrics:

  • connected_clients - Current connections
  • blocked_clients - Clients in blocking operations
  • maxclients - 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.

Backups

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:

  1. Go to your cache instance
  2. Click Edit
  3. Enter the new password
  4. Click Save
  5. Update your application configurations to use the new password
tip

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:

  1. Go to cache settings
  2. Toggle Authentication
  3. Save changes
Authentication Requirement

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:

  1. Go to cache settings
  2. Enable Public Access
  3. 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
Security Best Practice

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:

MetricDescription
Memory UsageCurrent vs. max memory
ConnectionsActive connection count
Operations/secCommands processed
Hit RateCache hit percentage
Network I/OBytes in/out

Key Metrics to Watch​

MetricHealthyWarning
Memory usage< 80%> 90%
Hit rate> 80%< 50%
Connections< 80% limitNear 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​

  1. Go to your cache instance and click Edit
  2. Enter the new password and click Save
  3. Update application configurations with the new password
  4. Deploy applications
  5. Verify connections

Flushing Data​

Restricted Commands

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​

  1. Check for keys without TTL:

    redis-cli DEBUG OBJECT key
  2. Find large keys:

    redis-cli --bigkeys
  3. Review memory policy

  4. Consider scaling up

Slow Performance​

  1. Check slow log:

    redis-cli SLOWLOG GET 10
  2. Monitor latency:

    redis-cli --latency
  3. Review connection count

  4. Check for blocking operations

Connection Errors​

  1. Verify connection details
  2. Check connection limits
  3. Review client configuration
  4. Check for connection leaks

High Eviction Rate​

If keys are being evicted too often:

  1. Scale to larger instance
  2. Review TTL settings
  3. Optimize data structures
  4. Consider data partitioning