Skip to content

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

Thread Pools

The thread_pools virtual table shows the current state of all Cassandra thread pools, providing visibility into request processing capacity and backpressure.


Cassandra uses staged event-driven architecture (SEDA) with separate thread pools for different operation types. Monitoring these pools reveals bottlenecks and capacity issues.

SELECT name, active_tasks, pending_tasks, blocked_tasks, completed_tasks
FROM system_views.thread_pools;

Equivalent nodetool command: nodetool tpstats


VIRTUAL TABLE system_views.thread_pools (
name text PRIMARY KEY,
active_tasks int,
active_tasks_limit int,
blocked_tasks bigint,
blocked_tasks_all_time bigint,
completed_tasks bigint,
core_pool_size int,
max_pool_size int,
max_tasks_queued int,
pending_tasks int
)
ColumnTypeDescription
nametextThread pool name
active_tasksintCurrently executing tasks
active_tasks_limitintMaximum concurrent tasks (pool size)
core_pool_sizeintCore thread pool size
max_pool_sizeintMaximum thread pool size
max_tasks_queuedintMaximum tasks that can be queued
pending_tasksintTasks queued waiting for execution
blocked_tasksbigintTasks currently blocked due to backpressure
blocked_tasks_all_timebigintTotal blocked tasks since node startup
completed_tasksbigintTotal completed tasks since startup

Pool NamePurposeWarning Signs
Native-Transport-RequestsCQL client requestspending > 1000 indicates client backpressure
RequestResponseStageInter-node request/responseblocked > 0 indicates network issues
Pool NamePurposeWarning Signs
ReadStageLocal read operationspending > 100 indicates disk bottleneck
MutationStageLocal write operationspending > 0, blocked > 0 critical
CounterMutationStageCounter write operationsSame as MutationStage
ViewMutationStageMaterialized view updatespending > 0 indicates MV lag
Pool NamePurposeWarning Signs
MemtableFlushWriterMemtable to SSTable flushpending > 0 indicates flush backpressure
MemtablePostFlushPost-flush cleanupShould stay near zero
CompactionExecutorCompaction taskspending > 100 indicates compaction falling behind
ValidationExecutorRepair validationHigh during repair operations
Pool NamePurposeWarning Signs
GossipStageGossip protocolpending > 0 indicates network issues
AntiEntropyStageRepair coordinationActive during repairs
MigrationStageSchema changesUsually idle
HintsDispatcherHint deliveryActive when catching up offline nodes
Pool NamePurposeWarning Signs
SecondaryIndexManagementIndex maintenanceShould be low
CacheCleanupExecutorCache evictionUsually idle
InternalResponseStageInternal coordinationShould be low
SamplerQuery samplingAlways low

-- Find pools with problems
SELECT name, active_tasks, pending_tasks, blocked_tasks
FROM system_views.thread_pools
WHERE pending_tasks > 0 OR blocked_tasks > 0;
-- Check pool capacity usage
SELECT
name,
active_tasks,
active_tasks_limit,
CAST(active_tasks AS double) / active_tasks_limit * 100 AS utilization_pct,
pending_tasks
FROM system_views.thread_pools
WHERE active_tasks_limit > 0;
-- Pools that have experienced blocking
SELECT name, blocked_tasks_all_time, completed_tasks,
CAST(blocked_tasks_all_time AS double) / completed_tasks * 100 AS block_rate_pct
FROM system_views.thread_pools
WHERE blocked_tasks_all_time > 0;
-- Monitor critical request path pools
SELECT name, active_tasks, pending_tasks, blocked_tasks
FROM system_views.thread_pools
WHERE name IN (
'Native-Transport-Requests',
'ReadStage',
'MutationStage',
'RequestResponseStage',
'MemtableFlushWriter',
'CompactionExecutor'
);

name | active_tasks | pending_tasks | blocked_tasks
----------------------------+--------------+---------------+---------------
Native-Transport-Requests | 45 | 0 | 0
ReadStage | 12 | 0 | 0
MutationStage | 8 | 0 | 0
CompactionExecutor | 2 | 3 | 0
MemtableFlushWriter | 0 | 0 | 0
name | active_tasks | pending_tasks | blocked_tasks
----------------------------+--------------+---------------+---------------
Native-Transport-Requests | 128 | 500 | 0 ← Client backpressure
ReadStage | 32 | 150 | 0 ← Disk bottleneck
MutationStage | 32 | 0 | 0
CompactionExecutor | 4 | 200 | 0 ← Compaction behind
MemtableFlushWriter | 2 | 5 | 0 ← Flush pressure
name | active_tasks | pending_tasks | blocked_tasks
----------------------------+--------------+---------------+---------------
Native-Transport-Requests | 128 | 5000 | 50 ← CRITICAL
MutationStage | 32 | 100 | 10 ← CRITICAL
MemtableFlushWriter | 2 | 20 | 5 ← CRITICAL

-- Any blocked tasks is critical
SELECT name, blocked_tasks, blocked_tasks_all_time
FROM system_views.thread_pools
WHERE blocked_tasks > 0;

Action: Immediate investigation required. Blocked tasks indicate the system cannot keep up with load.

-- Sustained pending tasks
SELECT name, pending_tasks
FROM system_views.thread_pools
WHERE (name = 'MutationStage' AND pending_tasks > 10)
OR (name = 'ReadStage' AND pending_tasks > 100)
OR (name = 'CompactionExecutor' AND pending_tasks > 50)
OR (name = 'MemtableFlushWriter' AND pending_tasks > 2);
-- Memtable flush falling behind
SELECT name, pending_tasks
FROM system_views.thread_pools
WHERE name LIKE 'Memtable%' AND pending_tasks > 0;

Action: Check disk I/O, consider increasing memtable_flush_writers.


Symptoms:

  • MutationStage shows blocked_tasks > 0
  • Write latency spikes

Common Causes:

  1. Memtable flush backpressure (check MemtableFlushWriter)
  2. Commit log sync bottleneck
  3. Disk I/O saturation

Resolution:

  • Check disk utilization: iostat -x 1
  • Verify commit log on fast disk
  • Consider increasing concurrent_writes

Symptoms:

  • ReadStage shows high pending_tasks
  • Read latency increases

Common Causes:

  1. Disk I/O bottleneck
  2. Large partitions causing slow reads
  3. Tombstone scanning
  4. Cold cache causing excessive disk reads

Resolution:

  • Check tombstones_per_read for tombstone issues
  • Review partition sizes
  • Verify key cache hit ratio
  • Consider adding read capacity

Symptoms:

  • CompactionExecutor shows pending_tasks > 100
  • Disk usage growing
  • Read latency increasing

Common Causes:

  1. Write rate exceeding compaction throughput
  2. Large SSTables taking long to compact
  3. Insufficient compaction threads

Resolution:

  • Check nodetool compactionstats for details
  • Consider increasing concurrent_compactors
  • Review compaction strategy settings
  • Verify disk throughput capacity

Thread pool sizes can be adjusted in cassandra.yaml:

# Read/write stages
concurrent_reads: 32 # ReadStage size
concurrent_writes: 32 # MutationStage size
concurrent_counter_writes: 32
# Compaction
concurrent_compactors: 4
# Memtable flush
memtable_flush_writers: 2
# Native transport
native_transport_max_threads: 128

Tuning Considerations

Increasing thread pool sizes:

  • Consumes more memory per thread
  • May increase contention under load
  • Should be tested before production deployment

Default values are appropriate for most workloads.