---
name: "rocksdb-lsm-tree-compaction-tuning"
description: "Tune RocksDB embedded key-value storage engine for extreme write throughput and SSD endurance."
metadata:
  author: "Meta"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "tune rocksdb compaction"
  - "configure rocksdb block cache"
  - "optimize rocksdb write throughput"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# RocksDB LSM-Tree Write Optimization & Compaction

Tunes RocksDB Log-Structured Merge (LSM) trees: configuring memtable sizes (write_buffer_size), block cache with LRU, Leveled vs Universal compaction, bloom filters, and direct I/O for NVMe storage.

## When to Invoke
Invoke this skill whenever you need to:
- tune rocksdb compaction
- configure rocksdb block cache
- optimize rocksdb write throughput

## Execution SOP & Rules
1. Set options.write_buffer_size = 64 * 1024 * 1024 (64MB) and max_write_buffer_number = 4.
2. Configure BlockBasedTableOptions with NewBloomFilterPolicy(10, false) for fast key existence checks.
3. Allocate shared block cache: table_options.block_cache = NewLRUCache(16 * 1024 * 1024 * 1024ULL).
4. Monitor performance statistics using DB::GetProperty('rocksdb.stats', &stats).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
