RocksDB state backend

When you use RocksDB as the state backend, you can tune how much memory RocksDB uses as a cache to speed up lookups. You can also select a set of predefined RocksDB options for your storage type.

Memory for the cache

Set the managed memory fraction of the TaskManagers. The default is 0.4. If your job needs a larger cache, increase the fraction together with the total memory of the TaskManagers. For example:

SET 'taskmanager.memory.managed.fraction' = '0.4';

For more information, see Set up TaskManager memory and Flink state backends in the Apache Flink documentation.

Predefined options

Table 1. Predefined RocksDB options
Option Description
DEFAULT The default option, applicable for all settings
SPINNING_DISK_OPTIMIZED Tuned for regular spinning disks
SPINNING_DISK_OPTIMIZED_HIGH_MEM Tuned for regular spinning disks, with higher memory use
FLASH_SSD_OPTIMIZED Tuned for flash SSDs

To set an option for a job, in session mode or in application mode, use a SET statement:

SET 'state.backend.rocksdb.predefined-options' = 'SPINNING_DISK_OPTIMIZED';