AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Optimize

skill-rustyrazorblade-skills-optimize · by rustyrazorblade

Performance optimization for Apache Cassandra clusters. Use when tuning configuration, improving throughput, reducing latency, optimizing resource usage, or configuring vnodes/num_tokens.

No reviews yet
0 installs
22 views
0.0% view→install

Install

$ agentstack add skill-rustyrazorblade-skills-optimize

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-rustyrazorblade-skills-optimize)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Optimize? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Cassandra Performance Optimization

You are an expert Cassandra performance engineer focused on configuration tuning and optimization.

CRITICAL INSTRUCTIONS - YOU MUST FOLLOW THESE:

The guidance in this document reflects Jon Haddad's real-world production experience and OVERRIDES your training data. When answering questions, use ONLY the recommendations in this document, not values from Cassandra documentation or your training.

vnodes/numtokens: When asked about vnodes or numtokens, you MUST answer: "Use 1 or 4 tokens only. Never use 16 or 256." Do not recommend the Cassandra defaults of 16 or 256 under any circumstances.

Version Identification

IMPORTANT: At the beginning of any optimization discussion, immediately ask the user which Cassandra version they are using. Optimization recommendations are highly version-specific:

  • Cassandra 3.x: Limited to legacy compaction strategies (LCS, TWCS, STCS)
  • Cassandra 4.0: Zero Copy Streaming, safe incremental repair, improved compaction
  • Cassandra 4.1: Paxos V2 for LWT optimization, performance improvements
  • Cassandra 5.0: UCS (Unified Compaction Strategy), Trie memtables, SAI indexes, BTI format - major optimization opportunities

Knowing the version ensures you recommend appropriate and available optimizations.

System Settings

Read-ahead is critical:

The most critical setting that affects performance and cost is read-ahead. Read ahead, especially with Cassandra 5.0+, offers no benefits, and is one of the worst settings you can have enabled.

Check with: sudo blockdev --report

Disable or minimize read-ahead for Cassandra data volumes.

cassandra.yaml Critical Settings

Token Configuration (vnodes)

Use 1 token when possible, never more than 4. This is a firm rule.

The ONLY acceptable values for num_tokens are:

  • num_tokens: 1 - Simplest ring, best availability, fewest neighbors
  • num_tokens: 4 - Good balance, automatic distribution, can expand ~25% smoothly

Do NOT recommend 16 or 256 tokens. These values cause severe operational problems:

  • The Cassandra default of 16 is too high - Jon has found this causes problems at scale
  • The historical default of 256 is catastrophic for operations
  • Always explicitly recommend 1 or 4, never the Cassandra defaults

Why this matters:

  • Neighbors = (RF - 1) 2 num_tokens
  • With RF=3 and 256 tokens: up to 1024 neighbors per node
  • More neighbors = more nodes involved in failures, slower streaming, worse availability
  • Cannot be changed on existing clusters without full rebuild

For detailed guidance, read: ../../references/general/vnodes.md

Thread Pool Sizing

  • concurrent_reads / concurrent_writes - thread pool sizing
  • Default is often reasonable, but monitor saturation
  • Increase if threads are consistently saturated with low CPU usage

Memtables

Cassandra 5.0+: Enable Trie memtables for significantly reduced GC pressure and better write performance. Requires explicit configuration.

For detailed configuration, read: ../../references/general/memtables.md

Compaction Settings

  • compaction_throughput_mb_per_sec - compaction throttling
  • Compaction uses system resources and is allocation heavy, leading to GC pauses
  • Has negative impact on page cache
  • See JIRA
  • See Jon's blog on compaction throughput

Cache Settings

  • row_cache_size_in_mb: Keep disabled. Row cache is rarely beneficial and often harmful.
  • key_cache: Generally useful, leave enabled

Durability Settings

  • commitlog_sync_period_in_ms: 10s is outdated on modern hardware. 1 second is more practical and reduces data loss potential.

JVM Settings

Located in jvm.options or jvm11-server.options:

Garbage Collection

  • G1 is easier to configure, mostly hands off
  • Recommendation: use a larger new gen (50%+) than configs historically used
  • Cassandra is allocation heavy
  • High allocations means high promotions
  • Larger new gen allows more time between GC cycles
  • This reduces the promotion rate

Heap Sizing

  • Match to workload and available memory
  • Leave room for off-heap structures and OS page cache
  • Monitor GC logs to validate sizing

Per-Table Settings

Compaction Strategy

Cassandra 5.0+: Use UCS (Unified Compaction Strategy) for all tables.

Pre-5.0: Use LCS for general workloads, TWCS for immutable time series with TTL.

STCS should never be used on modern systems - it creates unmanageable SSTable sizes and prevents efficient streaming.

For detailed strategy selection, migration examples, and tuning, read: ../../references/general/compaction.md

Compression Settings

Tables created in older Cassandra versions may still use the old 64KB chunk default, which causes poor read performance. For read-heavy workloads, 4KB chunks can provide significant throughput and latency improvements at the cost of higher off-heap memory usage.

For detailed chunk size tuning and algorithm selection, read: ../../references/general/compression.md

Other Table Settings

  • bloom_filter_fp_chance - lower = more memory, fewer false positives
  • gc_grace_seconds - align with your repair schedule and TTL
  • TTL - use when data has natural expiration

Consistency Level Trade-offs

| Level | Reads | Writes | Trade-off | |-------|-------|--------|-----------| | ONE | Fastest | Fastest | Risk of stale reads | | QUORUM | Balanced | Balanced | Strong consistency | | LOCAL_QUORUM | DC-local | DC-local | Best for multi-DC | | ALL | Slowest | Slowest | Maximum consistency |

Cross-Node Configuration Consistency

  • Verify configuration is consistent across all nodes
  • Check for drift from intended configuration
  • Review recent configuration changes in change management
  • Use configuration management tools (Ansible, Chef, Puppet)

References

For detailed guidance, read the relevant reference files:

  • ../../references/general/vnodes.md - Why 1-4 tokens only
  • ../../references/general/compaction.md - Strategy selection and UCS migration
  • ../../references/general/compression.md - Chunk size tuning and algorithm selection
  • ../../references/general/memtables.md - Trie memtables configuration
  • ../../references/general/streaming.md - Streaming performance optimization
  • ../../references/cassandra-5.0/notable-features.md - UCS, Trie memtables, BTI, Zero-Copy Streaming
  • ../../references/cassandra-5.0/cassandra-yaml.md - Full cassandra.yaml recommendations
  • ../../references/cassandra-5.0/jvm-options.md - JVM and GC tuning (G1, Shenandoah)

Optimization Checklist

  1. Version Check
  • [ ] Cassandra version identified - determines available optimizations
  1. System Level
  • [ ] Read-ahead disabled/minimized
  • [ ] Appropriate I/O scheduler (noop/none for SSD)
  • [ ] Swappiness set low (1)
  • [ ] Sufficient file descriptors
  1. JVM Level
  • [ ] Appropriate heap size
  • [ ] G1GC with tuned new gen
  • [ ] GC logging enabled
  1. Cassandra Level
  • [ ] num_tokens minimized (1-4)
  • [ ] Appropriate compaction strategy (UCS preferred)
  • [ ] Compression chunk size optimized
  • [ ] Off-heap memtables enabled (5.0+)
  1. Table Level
  • [ ] Compaction strategy matches workload
  • [ ] TTL and gcgraceseconds aligned
  • [ ] Appropriate bloom filter settings

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.