nodetool tablehistograms
Displays latency and size histograms for a specific table.
Synopsis
Section titled “Synopsis”nodetool [connection_options] tablehistograms <keyspace> <table>See connection options for connection options.
Description
Section titled “Description”nodetool tablehistograms provides detailed latency percentile distributions and size statistics for a specific table. This is more detailed than tablestats and shows how read/write latencies are distributed.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
keyspace | The keyspace containing the table |
table | The table to analyze |
Output Sections
Section titled “Output Sections”Read Latency Histogram
Section titled “Read Latency Histogram”my_keyspace/my_table histogramsPercentile Read Latency Write Latency SSTables Partition Size Cell Count (micros) (micros) (bytes)50% 158.49 120.00 1.00 310 175% 219.34 158.49 1.00 535 295% 545.79 315.85 2.00 1597 598% 943.13 545.79 2.00 2759 899% 1258.93 776.05 3.00 4768 14Min 61 52 1.00 104 1Max 25109 15209 7.00 1213897 29173Output Fields
Section titled “Output Fields”| Field | Description |
|---|---|
Read Latency | Local read latency in microseconds |
Write Latency | Local write latency in microseconds |
SSTables | Number of SSTables read per query |
Partition Size | Size of partitions in bytes |
Cell Count | Number of cells per partition |
Understanding Percentiles
Section titled “Understanding Percentiles”| Percentile | Meaning |
|---|---|
| 50% (P50) | Median - half of operations are faster |
| 75% (P75) | 75% of operations are faster |
| 95% (P95) | Common SLA target |
| 98% (P98) | Near-worst case |
| 99% (P99) | Tail latency |
| Min | Fastest observed |
| Max | Slowest observed |
Examples
Section titled “Examples”View Table Histograms
Section titled “View Table Histograms”nodetool tablehistograms my_keyspace my_tableCompare Multiple Tables
Section titled “Compare Multiple Tables”for table in users orders products; do echo "=== $table ===" nodetool tablehistograms my_keyspace $table | head -10doneInterpreting Results
Section titled “Interpreting Results”Healthy Read Latency
Section titled “Healthy Read Latency”50%: 100-500 µs (excellent)95%: 1-5 ms (good)99%: 5-20 ms (acceptable)Max: < 100 ms (no major outliers)Problematic Indicators
Section titled “Problematic Indicators”| Symptom | Possible Cause |
|---|---|
| High P50 | Slow disks, large partitions |
| P99 >> P95 | GC pauses, disk contention |
| High Max | Occasional extreme latency |
| High SSTable count | Compaction backlog |
| Large partition size | Data model issue |
SSTables Per Read
Section titled “SSTables Per Read”The SSTables column shows how many SSTables are read per query:
SSTables 1.00 # Ideal - data in one SSTable 2.00 # Good - minor merging needed 5.00+ # Problem - compaction neededHigh SSTable Count
If P95+ shows many SSTables per read:
- Check compaction is running
- Consider different compaction strategy
- May indicate writes outpacing compaction
Partition Size Analysis
Section titled “Partition Size Analysis”Partition Size (bytes)50%: 310 # Small partitions (good)99%: 4768 # Larger partitionsMax: 1213897 # ~1.2 MB largest partition| Size | Assessment |
|---|---|
| < 10 KB | Excellent |
| 10-100 KB | Good |
| 100 KB - 1 MB | Monitor |
| > 1 MB | Potential problem |
| > 100 MB | Serious issue |
Cell Count
Section titled “Cell Count”Number of cells (column values) per partition:
Cell Count50%: 1 # Minimal cells99%: 14 # ModerateMax: 29173 # Wide partitionHigh cell counts indicate wide partitions that may cause:
- Slow reads
- Memory pressure
- GC issues
Use Cases
Section titled “Use Cases”Performance Baseline
Section titled “Performance Baseline”# Capture baseline for comparisonnodetool tablehistograms my_keyspace my_table > baseline_$(date +%Y%m%d).txtTroubleshoot Slow Queries
Section titled “Troubleshoot Slow Queries”# Check if table has latency issuesnodetool tablehistograms my_keyspace slow_tableLook for:
- High P95/P99 latencies
- High SSTable counts
- Large partitions
Capacity Planning
Section titled “Capacity Planning”# Understand data distributionnodetool tablehistograms my_keyspace my_table | grep -A10 "Partition Size"Comparison with Other Commands
Section titled “Comparison with Other Commands”| Command | Scope | Detail Level |
|---|---|---|
tablehistograms | Single table | Detailed percentiles |
tablestats | All tables | Summary statistics |
proxyhistograms | Coordinator level | Network + local latency |
Local vs Coordinator Latency
Section titled “Local vs Coordinator Latency”tablehistograms: Local read/write on this node onlyproxyhistograms: Full request (includes network to replicas)
If proxyhistograms >> tablehistograms, the issue is network/remote nodes.
Scripting Examples
Section titled “Scripting Examples”Extract P99 Read Latency
Section titled “Extract P99 Read Latency”nodetool tablehistograms my_keyspace my_table | grep "99%" | awk '{print $2}'Alert on High Latency
Section titled “Alert on High Latency”#!/bin/bashP99=$(nodetool tablehistograms my_keyspace my_table | grep "99%" | awk '{print $2}')THRESHOLD=5000 # 5ms in microseconds
if (( $(echo "$P99 > $THRESHOLD" | bc -l) )); then echo "ALERT: P99 read latency is ${P99}µs (threshold: ${THRESHOLD}µs)"fiMonitor Multiple Tables
Section titled “Monitor Multiple Tables”#!/bin/bashecho "Table,P50_Read,P95_Read,P99_Read,Max_Read"for table in users orders products; do stats=$(nodetool tablehistograms my_keyspace $table) p50=$(echo "$stats" | grep "50%" | awk '{print $2}') p95=$(echo "$stats" | grep "95%" | awk '{print $2}') p99=$(echo "$stats" | grep "99%" | awk '{print $2}') max=$(echo "$stats" | grep "Max" | awk '{print $2}') echo "$table,$p50,$p95,$p99,$max"doneRelated Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| tablestats | Summary statistics for tables |
| proxyhistograms | Coordinator-level latencies |
| compactionstats | Check compaction backlog |
| tpstats | Thread pool statistics |