Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

sstablesplit

Splits large SSTables into smaller files of a specified size.


Terminal window
sstablesplit [options] <sstable_files>

sstablesplit divides oversized SSTable files into multiple smaller SSTables. This is useful when:

  • Large SSTables cause compaction issues - Compaction takes too long or fails
  • Memory pressure from large files - Reading large SSTables causes heap problems
  • Level imbalance in LCS - Large SSTables distort level distribution
  • Recovery operations - Need to process data in smaller chunks
  • Backup and restore - Smaller files are easier to manage

The tool preserves all data while creating multiple smaller output files.

Cassandra Must Be Stopped

Cassandra must be completely stopped before running sstablesplit. Running this tool while Cassandra is active will cause data corruption.


sstablesplit Processsstablesplit ProcessBefore SplitAfter SplitLarge SSTable500 MBSSTable 1100 MBSSTable 2100 MBSSTable 3100 MBSSTable 4100 MBSSTable 5100 MBsstablesplit--size 100Original SSTable removedafter successful splitEach new SSTable containsa portion of the original data(partition boundaries preserved)
  • Partition preservation - Partitions are never split across SSTables
  • Size is approximate - Actual size depends on partition boundaries
  • Original deleted - Source SSTable removed after successful split (unless -n)
  • All components - All SSTable component files are regenerated

ArgumentDescription
sstable_filesOne or more paths to SSTable Data.db files to split

OptionDescription
-s, --size <MB>Target size for output SSTables in MB (default: 50)
-n, --no-snapshotSkip creating a pre-split snapshot (original SSTable is still removed after split)
-h, --helpDisplay help information
--debugEnable debug output

Terminal window
# Stop Cassandra first
sudo systemctl stop cassandra
# Split SSTable into 50 MB chunks (default)
sstablesplit /var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db
# Start Cassandra
sudo systemctl start cassandra
Terminal window
# Split into 100 MB chunks
sstablesplit --size 100 /path/to/sstable-Data.db
# Split into 200 MB chunks
sstablesplit -s 200 /path/to/sstable-Data.db
Terminal window
# Split without creating a snapshot first
# Note: The original SSTable is still removed after successful split
sstablesplit --no-snapshot /path/to/sstable-Data.db
Terminal window
# Split all SSTables larger than 1GB
for sstable in /var/lib/cassandra/data/my_keyspace/my_table-*/*-Data.db; do
size=$(stat -c%s "$sstable")
if [ "$size" -gt 1073741824 ]; then
echo "Splitting $sstable ($size bytes)"
sstablesplit --size 100 "$sstable"
fi
done
split_large_sstables.sh
#!/bin/bash
KEYSPACE="$1"
MAX_SIZE_MB="${2:-500}" # Default: split SSTables larger than 500MB
TARGET_SIZE="${3:-100}" # Default: 100MB target
MAX_SIZE_BYTES=$((MAX_SIZE_MB * 1024 * 1024))
echo "Splitting SSTables larger than ${MAX_SIZE_MB}MB into ${TARGET_SIZE}MB chunks"
for sstable in /var/lib/cassandra/data/${KEYSPACE}/*/*-Data.db; do
size=$(stat -c%s "$sstable" 2>/dev/null)
if [ "$size" -gt "$MAX_SIZE_BYTES" ]; then
size_mb=$((size / 1024 / 1024))
echo "Splitting: $sstable (${size_mb}MB)"
sstablesplit --size "$TARGET_SIZE" "$sstable"
fi
done

Terminal window
# Symptoms:
# - Compaction times out or fails
# - "Compaction taking too long" warnings
# - OOM errors during compaction
# Find large SSTables
find /var/lib/cassandra/data/my_keyspace/my_table-*/ -name "*-Data.db" \
-size +1G -exec ls -lh {} \;
# Stop Cassandra
sudo systemctl stop cassandra
# Split large SSTables
sstablesplit --size 100 /path/to/large-sstable-Data.db
# Start Cassandra
sudo systemctl start cassandra
Terminal window
# Large SSTables can disrupt LCS level distribution
# Split to allow proper leveling
sudo systemctl stop cassandra
# Split the oversized SSTables
sstablesplit --size 160 /var/lib/cassandra/data/my_keyspace/my_table-*/*-Data.db
# Optionally relevel after splitting
sstableofflinerelevel my_keyspace my_table
sudo systemctl start cassandra
Terminal window
# Large SSTables cause GC pressure when read
# Split to reduce per-read memory footprint
sudo systemctl stop cassandra
# Split into smaller chunks
for large_sstable in $(find /var/lib/cassandra/data/ -name "*-Data.db" -size +500M); do
echo "Splitting: $large_sstable"
sstablesplit --size 100 "$large_sstable"
done
sudo systemctl start cassandra
Terminal window
# Smaller SSTables stream faster and more reliably
sudo systemctl stop cassandra
# Split SSTables for problematic table
sstablesplit --size 100 /var/lib/cassandra/data/my_keyspace/my_table-*/*-Data.db
sudo systemctl start cassandra
# Now repair
nodetool repair my_keyspace my_table

Scenario 5: Dealing with Tombstone Blockers

Section titled “Scenario 5: Dealing with Tombstone Blockers”
Terminal window
# Large SSTables may be blocking tombstone removal
# Split to allow more granular compaction
# Check for blockers first
sstableexpiredblockers my_keyspace my_table
# If large SSTables are blockers, split them
sudo systemctl stop cassandra
sstablesplit --size 100 /path/to/blocker-sstable-Data.db
sudo systemctl start cassandra
# Compaction should now be able to remove tombstones

Use CaseTarget SizeRationale
General purpose100-200 MBGood balance
LCS tables160 MBMatches default LCS target
Memory-constrained50 MBReduces heap pressure
Fast streaming100 MBQuick repair/rebuild
STCS tables200-500 MBReduces SSTable count
FactorSmaller SplitsLarger Splits
SSTable countMore filesFewer files
Compaction frequencyMore frequentLess frequent
Memory per readLowerHigher
Disk overheadHigherLower
Streaming speedFaster per fileSlower per file

Pre-split sstables snapshotted to snapshot 'pre-split-1705401600'
Splitting /var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db
Key count: 50000
Total size: 524288000
Completed split of /var/lib/cassandra/data/my_keyspace/my_table-abc123/nb-1-big-Data.db
Split into 6 sstables
Terminal window
# List new SSTables after split
ls -lh /var/lib/cassandra/data/my_keyspace/my_table-*/*-Data.db
# Check total data size (should be similar to original)
du -sh /var/lib/cassandra/data/my_keyspace/my_table-*/
# Verify with sstableutil
sstableutil my_keyspace my_table | grep "Data.db" | wc -l

SSTable Split ComponentsSSTable Split ComponentsOriginal SSTableSplit ResultSSTable 1SSTable 2nb-1-big-Data.dbnb-1-big-Index.dbnb-1-big-Filter.dbnb-1-big-Statistics.dbnb-1-big-Summary.dbnb-1-big-TOC.txtnb-2-big-Data.dbnb-2-big-Index.db...nb-3-big-Data.dbnb-3-big-Index.db...Each output SSTable hasall required component filesSplit creates newgeneration numbers
  • Partitions are never split across SSTables
  • Target size is approximate - actual depends on partition sizes
  • Large partitions cannot be made smaller (they stay in one SSTable)

Terminal window
# Run as cassandra user
sudo -u cassandra sstablesplit --size 100 /var/lib/cassandra/data/.../nb-1-big-Data.db
# Or fix ownership after
sudo chown -R cassandra:cassandra /var/lib/cassandra/data/
Terminal window
# Must stop Cassandra first
nodetool drain
sudo systemctl stop cassandra
# Verify stopped
pgrep -f CassandraDaemon # Should return nothing
# Now safe to split
sstablesplit --size 100 /path/to/sstable-Data.db
Terminal window
# Split creates new files before removing original
# Need approximately 2x the SSTable size
# Check available space
df -h /var/lib/cassandra/
# Options:
# 1. Free space first
# 2. Split with --no-snapshot and manually manage
sstablesplit --no-snapshot /path/to/sstable-Data.db
# Verify new files, then remove original
Warning: Partition 'user123' is larger than target size (500MB > 100MB)
This partition cannot be split further.

This is expected - partitions cannot be split. The partition will remain in one output SSTable.

If the SSTable is smaller than the target size, no split occurs:

Terminal window
# Check SSTable size first
ls -lh /path/to/sstable-Data.db
# If smaller than target, no split needed

sstablesplit Guidelines

  1. Check size first - Only split if SSTable exceeds target
  2. Match target to strategy - LCS: 160MB, STCS: varies
  3. Disk space - Ensure 2x SSTable size available
  4. Backup first - Snapshot before splitting critical data
  5. Split one at a time - Monitor disk space
  6. Verify after - Check data integrity post-split
  7. Large partitions - Cannot be split smaller

Cautions

  • Original SSTable deleted by default
  • Large partitions cannot be split
  • Disk space needed for operation
  • May trigger compaction after restart

CommandRelationship
sstablemetadataCheck SSTable sizes
sstablepartitionsFind large partitions
sstableofflinerelevelReorganize after split
sstableexpiredblockersCheck for blockers
nodetool compactMay follow split