diff --git a/content/operate/kubernetes/flex/_index.md b/content/operate/kubernetes/flex/_index.md new file mode 100644 index 0000000000..5a9aa37b1b --- /dev/null +++ b/content/operate/kubernetes/flex/_index.md @@ -0,0 +1,114 @@ +--- +title: Flex on Kubernetes +alwaysopen: false +categories: +- docs +- operate +- kubernetes +description: Extend Redis databases with flash storage for large-scale, cost-efficient deployments on Kubernetes. +hideListLinks: true +linkTitle: Flex +weight: 41 +--- + +Flex extends your database capacity by combining RAM and flash (SSD) storage. This tiered architecture keeps frequently accessed (hot) data in RAM for sub-millisecond latency while storing less active (warm) data on flash to reduce costs and increase capacity. + +Flex databases work with your existing Redis applications and the Redis API without modification. + +## How Flex works + +### Automatic data tiering + +Flex moves data between RAM and flash based on access patterns: + +- Frequently accessed data stays in high-speed RAM. +- Less active data moves to cost-efficient flash storage. +- Data accessed from flash promotes back to RAM automatically. + +Redis uses an [LRU (least recently used)]({{< relref "/develop/reference/eviction#apx-lru" >}}) eviction policy to manage data placement. When memory pressure increases, Flex identifies cold objects, transfers them to flash, and frees RAM for new or frequently accessed keys. + +This process requires no application changes. Your existing Redis commands work across both storage tiers. + +### Utilization-aware RAM population + +Flex uses a hybrid memory model that balances performance with predictable behavior as the dataset grows. The goal is to maximize hot data in RAM while maintaining stable performance across all utilization levels. + +Flex considers both the configured RAM percentage and current dataset utilization: + +- When database utilization is below 50%, Flex uses up to 50% of configured RAM for hot data. +- Above 50% utilization, Flex uses both RAM and flash proportionally, following the configured RAM-to-flash ratio. + +This ensures: + +- A stable performance curve across all utilization levels +- No sudden drop-off in RAM hit-rate as the database fills +- Predictable throughput and latency, especially for large deployments + +### Storage engine + +Flex uses [Speedb](https://docs.speedb.io), a high-performance key-value storage engine optimized for flash drives: + +- Redis handles all data operations in memory. +- Speedb manages the flash storage layer. + +This design delivers predictable latency and throughput as datasets grow beyond RAM limits. + +## Compatibility + +Flex is compatible with the Redis API and supports all Redis data types, including JSON and probabilistic data structures (Bloom filters, Count-Min Sketch, Top-K). + +The following features are not yet supported with Flex: + +- Redis Query Engine (RQE) +- Time series +- Active-Active + +## When to use Flex + +Use Flex when you need to: + +- Run Redis at terabyte scale while maintaining high throughput and sub-10 ms latency +- Power real-time feature stores for machine learning applications +- Operate large distributed caches with elastic scaling and consistent performance under heavy load +- Reduce infrastructure costs by combining high-speed RAM with cost-efficient flash storage + +{{}}Flex does not replace long-term data persistence. For workloads that require durability and recovery across restarts or failures, use Redis persistence features like [AOF (Append-Only File)]({{< relref "/operate/oss_and_stack/management/persistence#append-only-file" >}}), [RDB snapshots]({{< relref "/operate/oss_and_stack/management/persistence#snapshotting" >}}), or both. For more information, see [Database persistence]({{< relref "/operate/rs/databases/configure/database-persistence" >}}).{{}} + +## Flex and Auto Tiering + +Flex replaces [Auto Tiering]({{< relref "/operate/kubernetes/7.22/re-clusters/auto-tiering" >}}) (formerly known as Redis on Flash). Redis Enterprise selects the implementation based on your database version: + +| Redis database version | Operator version | Redis Flex | Auto Tiering | +|------------------------|------------------|------------|--------------| +| 8.0 and later | 8.0.2-2 and later | | | +| 7.4 | 7.8.2-6 and later | | | +| 7.2 and earlier | 7.22.2-22 and earlier | | | + +For Redis Enterprise for Kubernetes version 7.22.2-22 or earlier, see [Auto Tiering]({{< relref "/operate/kubernetes/7.22/re-clusters/auto-tiering" >}}). + +### Differences between Flex and Auto Tiering + +- Key and value offloading + - Auto Tiering offloads only values to flash while keys remain in RAM. + - Flex offloads both keys and values, which increases dataset density per node and reduces RAM consumption. +- RAM requirements + - Auto Tiering requires enough RAM to hold all keys. + - Flex has no requirement to keep keys in RAM. Minimum RAM is based on performance goals, not key count. The minimum RAM-to-flash ratio is 10%, which enables high flash utilization without compromising architecture. +- RAM population strategy + - Auto Tiering fills all available RAM before offloading data to flash. This maximizes hot-data performance but can cause non-linear performance changes at high utilization. + - Flex uses utilization-aware RAM population. +- Storage engine + - Auto Tiering uses either RocksDB or Speedb as the storage engine. + - Flex uses Speedb only. +- Hot data caching and dataset size + - Auto Tiering is limited by key memory overhead, which restricts maximum dataset size. + - Flex is more efficient because RAM holds hot keys and values, supporting larger datasets. +- Performance consistency + - Auto Tiering depends on RAM pressure and key count. + - Flex provides higher RAM hit-rate and more stable latency. + +## Next steps + +- [Plan your deployment]({{< relref "/operate/kubernetes/flex/plan" >}}): Review hardware requirements, sizing guidelines, and limitations. +- [Get started]({{< relref "/operate/kubernetes/flex/get-started" >}}): Configure Flex on your cluster. +- [Scale your deployment]({{< relref "/operate/kubernetes/flex/scale" >}}): Learn scaling strategies and best practices. diff --git a/content/operate/kubernetes/flex/get-started.md b/content/operate/kubernetes/flex/get-started.md new file mode 100644 index 0000000000..1c7b52c0bf --- /dev/null +++ b/content/operate/kubernetes/flex/get-started.md @@ -0,0 +1,116 @@ +--- +title: Get started with Redis Flex on Kubernetes +alwaysopen: false +categories: +- docs +- operate +- kubernetes +description: Configure Redis Flex on your Redis Enterprise cluster for Kubernetes. +hideListLinks: true +linkTitle: Get started +weight: 20 +--- + +This guide shows you how to configure Redis Flex on your Redis Enterprise cluster for Kubernetes. + +## Prerequisites + +Before you begin, verify that you have: + +- Redis Enterprise for Kubernetes version 8.0.2-2 or later installed +- A running `RedisEnterpriseCluster` (REC) resource +- Locally attached NVMe SSDs on your worker nodes +- A StorageClass configured for Flash storage + +For hardware requirements and sizing guidelines, see [Plan your deployment]({{< relref "/operate/kubernetes/flex/plan" >}}). + +## Configure the cluster for Redis Flex + +To enable Redis Flex, configure your `RedisEnterpriseCluster` (REC) resource with Flash storage settings. + +### Step 1: Create a StorageClass for Flash storage + +Create a StorageClass that references your locally attached SSDs. + +Key fields in the StorageClass: + +| Field | Description | +|---------------------|-----------------------------------------------------------| +| `provisioner` | Set to `kubernetes.io/no-provisioner` for local storage. | +| `volumeBindingMode` | Set to `WaitForFirstConsumer` for local volumes. | + +### Step 2: Configure Flash storage in the REC + +Add the `redisOnFlashSpec` section to your REC specification. + +Key fields in `redisOnFlashSpec`: + +| Field | Description | +|-------------------------|--------------------------------------------------| +| `enabled` | Set to `true` to enable Redis Flex. | +| `flashStorageClassName` | Name of the StorageClass for Flash storage. | +| `flashDiskSize` | Size of the Flash storage per node. | +| `storageEngine` | Storage engine. Set to `speedb` for Redis Flex. | + +### Step 3: Apply the configuration + +1. Apply the updated REC configuration: + + ```sh + kubectl apply -f rec.yaml + ``` + +2. Verify that the cluster is ready: + + ```sh + kubectl get rec + ``` + +## Create a Redis Flex database + +After you configure the cluster, create a `RedisEnterpriseDatabase` (REDB) resource with Redis Flex enabled. + +### Configure the REDB + +Create a database specification with `isRof` set to `true`. + +Key fields in the REDB: + +| Field | Description | +|--------------|--------------------------------------------------------| +| `memorySize` | Total database size (RAM + Flash). | +| `isRof` | Set to `true` to enable Redis Flex for this database. | +| `rofRamSize` | Amount of RAM allocated to the database. | + +### Apply the database configuration + +1. Apply the REDB: + + ```sh + kubectl apply -f redb.yaml + ``` + +2. Verify the database status: + + ```sh + kubectl get redb + ``` + +## Verify Redis Flex is active + +To confirm that Redis Flex is working: + +1. Check the database status: + + ```sh + kubectl get redb -o yaml + ``` + +2. Look for `isRof: true` in the status section. + +3. Connect to the database and verify that data operations work correctly. + +## Next steps + +- [Scale your deployment]({{< relref "/operate/kubernetes/flex/scale" >}}): Learn how to scale volume, throughput, and infrastructure. +- [Plan your deployment]({{< relref "/operate/kubernetes/flex/plan" >}}): Review sizing guidelines and best practices. diff --git a/content/operate/kubernetes/flex/plan.md b/content/operate/kubernetes/flex/plan.md new file mode 100644 index 0000000000..f4b63daca0 --- /dev/null +++ b/content/operate/kubernetes/flex/plan.md @@ -0,0 +1,169 @@ +--- +title: Plan a Redis Flex deployment on Kubernetes +alwaysopen: false +categories: +- docs +- operate +- kubernetes +description: Hardware requirements, sizing guidelines, and limitations for Redis Flex on Kubernetes. +hideListLinks: true +linkTitle: Plan +weight: 10 +--- + +Review the hardware requirements, sizing guidelines, and known limitations before you deploy Redis Flex. + +## Version requirements + +Redis Flex requires: + +- Redis Enterprise for Kubernetes version 8.0.2-2 or later +- Redis version 8.0 or later + +{{}} +Redis 7.4 preview uses Auto Tiering regardless of cluster policy. Upgrade to Redis 8.0 or later to use Redis Flex. +{{}} + +## Hardware requirements + +### Flash storage requirements + +Your SSDs must meet these requirements: + +- **Locally attached** to worker nodes in your Kubernetes cluster. Network-attached storage (NAS), storage area networks (SAN), and cloud block storage (like AWS EBS) are not supported. +- **Dedicated** to Redis Flex. Don't share Flash storage with other database components like durability, binaries, or persistence. +- **Formatted and mounted** on the nodes that run Redis Enterprise pods. +- **Provisioned as local persistent volumes**. You can use a [local volume provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) for dynamic provisioning. +- **Configured with a StorageClass** resource with a unique name. + +For more information about storage configuration, see [Kubernetes local volumes](https://kubernetes.io/docs/concepts/storage/volumes/#local). + +### Flash capacity sizing + +Provision Flash capacity that exceeds your total database size. The extra space accounts for: + +- Write buffers +- Space amplification +- Operational overhead + +### Recommended SSD types + +For best performance, use NVMe SSDs: + +| SSD type | Recommendation | +|-----------------------|--------------------------------| +| NVMe Gen 5 or Gen 4 | Recommended | +| NVMe Gen 3 | Supported (lower performance) | + +## Sizing guidelines + +### Shard fundamentals + +Redis Flex databases consist of shards—independent data partitions that handle a portion of the dataset and request load. Each shard runs as a self-contained Redis process with dedicated memory, CPU, and Flash resources. + +### Recommended shard size + +Use these standard building blocks for capacity planning: + +- **50 GB per shard**: Standard capacity unit +- **1 vCPU per shard**: Baseline compute allocation + +For example, a 1 TB dataset requires 20 shards (20 × 50 GB). + +### RAM percentage impact on performance + +The RAM-to-Flash ratio directly affects throughput and latency: + +- More RAM: Higher throughput and lower latency +- Less RAM: Lower throughput, higher latency, and lower cost + +The following table shows expected performance per 50 GB shard with 1 vCPU: + +| RAM % | Throughput | Latency (p99) | +|-------|--------------|---------------| +| 10% | 5K ops/sec | ~10 ms | +| 20% | 10K ops/sec | ~6-8 ms | +| 30% | 15K ops/sec | ~5 ms | +| 40% | 20K ops/sec | ~3-4 ms | +| 50% | 25K ops/sec | <3 ms | + +{{}} +These figures assume uniform key distribution and a mixed read/write workload. Actual performance varies based on your data model, command mix, and network latency. +{{}} + +### Example: 1 TB deployment + +The following table shows aggregate throughput for a 1 TB dataset (20 shards) at different RAM percentages: + +| RAM % | Shards | vCPU total | Approx. throughput | +|-------|--------|------------|-------------------| +| 10% | 20 | 20 | 100K ops/sec | +| 20% | 20 | 20 | 200K ops/sec | +| 30% | 20 | 20 | 300K ops/sec | +| 40% | 20 | 20 | 400K ops/sec | +| 50% | 20 | 20 | 500K ops/sec | + +## Module compatibility + +### Supported + +Redis Flex supports: + +- All standard Redis data types +- Redis JSON +- Redis probabilistic data structures (Bloom filters, Count-Min Sketch, Top-K) + +### Not supported + +Redis Flex doesn't support: + +- Redis Query Engine (RQE) +- RedisTimeSeries +- Active-Active databases + +## Best practices + +### Key and value sizes + +- Store small keys and values when possible. Avoid objects larger than 10 KB. +- Large objects reduce performance because the entire value moves between RAM and Flash. +- Keys or values larger than 4 GB can't be stored in Flash and remain in RAM only. + +If you attempt to store oversized objects, warnings appear in the Redis logs: + +```text +WARNING: key too big for disk driver, size: 4703717276, key: subactinfo:htable +``` + +### Replication configuration + +Enable replication before populating the database with data. If you enable replication after the database is created, recovery can fail because required persistence files might be missing. + +### RAM population strategy (Redis 8.2+) + +Starting with Redis 8.2, Redis Flex uses utilization-aware RAM population: + +- Below 50% utilization: Uses up to 50% of configured RAM for hot data +- Above 50% utilization: Uses RAM and Flash proportionally based on the configured ratio + +This strategy delivers a stable performance curve across all utilization levels. + +## Known limitations + +{{}} +Redis Flex doesn't support Active-Active databases. +{{}} + +- **PVC expansion**: Not supported with `redisOnFlashSpec`. Don't enable `enablePersistentVolumeResize` in the REC `persistentSpec`. +- **Redis 7.4 preview**: Uses Auto Tiering regardless of cluster policy. +- **Maximum object size**: Keys or values larger than 4 GB remain in RAM only. +- **Flash storage**: Must be locally attached. Network storage isn't supported. + +### Deprecated fields + +The `flashStorageEngine` field is deprecated. Use `bigStoreDriver` instead. + +## Next steps + +- [Get started]({{< relref "/operate/kubernetes/flex/get-started" >}}): Configure Redis Flex on your cluster. +- [Scale your deployment]({{< relref "/operate/kubernetes/flex/scale" >}}): Learn scaling strategies. diff --git a/content/operate/kubernetes/flex/scale.md b/content/operate/kubernetes/flex/scale.md new file mode 100644 index 0000000000..715dc2e7bc --- /dev/null +++ b/content/operate/kubernetes/flex/scale.md @@ -0,0 +1,97 @@ +--- +title: Scale Redis Flex on Kubernetes +alwaysopen: false +categories: +- docs +- operate +- kubernetes +description: Scaling strategies and methods for Redis Flex deployments on Kubernetes. +hideListLinks: true +linkTitle: Scale +weight: 30 +--- + +This guide shows you how to scale Redis Flex databases on Kubernetes to meet changing workload demands. + +## Scaling dimensions + +Redis Flex supports three scaling dimensions: + +| Dimension | What it addresses | How to scale | +|----------------|-----------------------|-------------------------------------| +| Volume | Data size | Increase `memorySize` | +| Throughput | Operations per second | Adjust RAM percentage or add shards | +| Infrastructure | Node capacity | Add nodes to the cluster | + +## Before you scale + +Before you scale a Redis Flex deployment: + +1. Verify that your cluster has sufficient resources (CPU, memory, Flash storage). +2. For volume scaling, confirm that enough Flash capacity exists across nodes. +3. For infrastructure scaling, provision and add new nodes before you increase database size. + +## Scale volume (data size) + +To store more data, increase the database `memorySize` in your REDB specification. + +When you scale volume: + +- Adjust `rofRamSize` proportionally to maintain the same RAM percentage. +- Volume scaling can trigger shard redistribution. Monitor the database during this operation. + +## Scale throughput (operations per second) + +To increase throughput, use one of these options: + +### Option 1: Increase RAM percentage + +Allocate more RAM relative to total size by increasing `rofRamSize`. A higher RAM percentage keeps more data in fast memory, which improves throughput. + +See [Plan your deployment]({{< relref "/operate/kubernetes/flex/plan" >}}) for details on how RAM percentage affects performance. + +### Option 2: Add shards + +Increase the number of shards by setting the `shardCount` field to distribute load. Each shard handles a portion of requests in parallel. + +## Scale infrastructure (cluster capacity) + +To add capacity to the underlying cluster: + +1. Update your `RedisEnterpriseCluster` resource to increase the `nodes` count. +2. Apply the configuration: + + ```sh + kubectl apply -f rec.yaml + ``` + +3. Wait for all new pods to reach `Running` status before you scale databases. + +## Scaling decision table + +Use this table to determine the best scaling approach: + +| Goal | Recommended action | +|----------------------|--------------------------------------| +| Store more data | Increase `memorySize` | +| Improve latency | Increase `rofRamSize` (higher RAM %) | +| Handle more ops/sec | Add shards or increase RAM % | +| Add cluster capacity | Add nodes to the REC | + +## Scaling best practices + +- **Scale incrementally**: Make gradual changes and monitor performance. +- **Pre-provision infrastructure**: Add cluster nodes before you scale databases. +- **Monitor during scaling**: Watch for increased latency or errors during operations. +- **Test scaling procedures**: Verify scaling in a non-production environment first. + +## Known limitations + +- **PVC expansion**: Not supported with `redisOnFlashSpec`. Plan Flash storage capacity upfront. +- **Scaling down**: Reduce database size gradually to avoid data loss. +- **Active-Active**: Redis Flex doesn't support Active-Active databases. + +## Next steps + +- [Plan your deployment]({{< relref "/operate/kubernetes/flex/plan" >}}): Review sizing guidelines for capacity planning. +- [Redis Flex overview]({{< relref "/operate/kubernetes/flex" >}}): Learn how Redis Flex manages data across RAM and Flash.