Skip to content

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

nodetool toppartitions

Samples and displays the most active partitions.

Relationship to profileload

Since Cassandra 4.0, toppartitions is a wrapper around profileload (TopPartitions extends ProfileLoad). Both commands remain available and accept the same options. The profileload command offers the same functionality with a broader profiling scope.


Terminal window
nodetool [connection_options] toppartitions [options] [keyspace] [table] [duration]

See connection options for connection options.

nodetool toppartitions samples partition access over a specified duration and reports the most frequently accessed partitions. This helps identify hot partitions that may be causing performance issues.

Since Cassandra 4.0, this command is a wrapper around profileload (source).


All arguments are optional. When omitted, defaults are used.

ArgumentDescriptionDefault
keyspaceThe keyspace to sampleAll keyspaces
tableThe table to sampleAll tables
durationSampling duration in milliseconds10000 (10 seconds)

OptionDescription
-s, --capacity <count>Capacity of the sampler reservoir (default: 256)
-k, --top-count <count>Number of top partitions to return (default: 10)
-a, --samplers <samplers>Comma-separated sampler types: READS, WRITES, CAS_CONTENTIONS, LOCAL_READ_TIME, WRITE_SIZE (default: all)
-i, --interval <ms>Sampling interval in milliseconds
-t, --stopStop ongoing sampling
-l, --listList active sampling sessions

WRITES Sampler:
Cardinality: ~1000
Top 10 partitions:
Partition Count +/-
user_12345 150 10
user_67890 120 8
user_11111 95 7
...
READS Sampler:
Cardinality: ~800
Top 10 partitions:
Partition Count +/-
product_abc 200 15
product_xyz 180 12
...

Terminal window
nodetool toppartitions my_keyspace my_table 10000
Terminal window
nodetool toppartitions -k 20 my_keyspace my_table 30000
Terminal window
nodetool toppartitions -a READS my_keyspace my_table 10000
Terminal window
nodetool toppartitions -a WRITES my_keyspace my_table 10000
Terminal window
nodetool toppartitions -a CAS_CONTENTIONS my_keyspace my_table 10000
Terminal window
nodetool toppartitions -l
Terminal window
nodetool toppartitions -t

Cardinality: ~1000

Estimated number of unique partitions accessed during sampling.

user_12345 150 10
  • 150: Number of times this partition was accessed
  • 10: Statistical margin of error
MetricWarning Sign
Single partition >> othersPotential hot partition
High count + high errorVariable access pattern
Low cardinality + high countFew partitions handling all traffic

Terminal window
# Sample during peak traffic
nodetool toppartitions my_keyspace my_table 60000

Hot partitions may indicate:

  • Data model issues (poor partition key choice)
  • Application bugs (always accessing same key)
  • Natural access patterns (celebrity problem)
Terminal window
# When seeing high latency
nodetool toppartitions -s 20 my_keyspace slow_table 30000

If one partition dominates, investigate that partition.

Terminal window
# Understand access distribution
nodetool toppartitions -s 50 my_keyspace my_table 300000

Even distribution = good Skewed distribution = potential scaling issue


Terminal window
# 10 second sample
nodetool toppartitions my_keyspace my_table 10000

Good for: Quick identification of obvious hot spots

Terminal window
# 1 minute sample
nodetool toppartitions my_keyspace my_table 60000

Good for: Normal troubleshooting

Terminal window
# 5 minute sample
nodetool toppartitions my_keyspace my_table 300000

Good for: Capturing intermittent patterns

Terminal window
nodetool toppartitions -k 50 my_keyspace my_table 300000

Partition Count
part_1 100
part_2 95
part_3 92
part_4 88
...

Traffic distributed relatively evenly.

Partition Count
hot_key 5000
part_2 50
part_3 45
...

One partition receiving 100x more traffic than others.

WRITES:
hot_key 1000
other 10
READS:
hot_key 50
other 45

Partition is write-heavy—may need data model review.


  1. Add randomization to partition key

    -- Instead of
    CREATE TABLE events (date DATE, event_id UUID, ...);
    -- Use bucketing
    CREATE TABLE events (date DATE, bucket INT, event_id UUID, ...);
  2. Composite partition key

    PRIMARY KEY ((user_id, bucket), timestamp)
  1. Client-side caching - Reduce read frequency
  2. Write batching - Reduce write frequency
  3. Load spreading - Distribute across multiple keys

monitor_hot_partitions.sh
#!/bin/bash
KEYSPACE=$1
TABLE=$2
DURATION=60000 # 1 minute
THRESHOLD=100 # Alert if count > 100
result=$(nodetool toppartitions -k 5 $KEYSPACE $TABLE $DURATION 2>/dev/null)
# Parse top partition count
top_count=$(echo "$result" | grep -A2 "Top" | tail -1 | awk '{print $2}')
if [ -n "$top_count" ] && [ "$top_count" -gt "$THRESHOLD" ]; then
echo "ALERT: Hot partition detected in $KEYSPACE.$TABLE"
echo "$result"
fi

Sampling Limitations

  • Results are statistical samples, not exact counts
  • Short samples may miss intermittent patterns
  • High-traffic tables need longer sampling
  • Sampling adds minimal overhead

CommandRelationship
profileloadPrimary command (toppartitions is an alias)
tablestatsOverall table statistics
tablehistogramsLatency distributions
proxyhistogramsCoordinator latencies
tpstatsThread pool statistics