163 Cassandra Interview Questions and Answers (2026)

Cassandra runs the data layer behind some of the biggest systems on the planet, and interviewers know it. As scale becomes the norm, they've stopped accepting vague answers about "eventual consistency" and started probing whether you can actually model data, tune consistency, and reason about the read and write paths. Walk in shaky and it shows fast.
This is 163 questions with concise, interview-ready answers, plus code and CQL where it clarifies. They're ordered Junior to Mid to Senior, so you build from the fundamentals up to cluster topology, compaction, tombstones, and repair. Work through them and you'll speak about Cassandra like someone who's run it, not just read about it.
Q1.What is a node in Cassandra?
Cassandra?A node is a single Cassandra instance (one running server process) that stores a portion of the cluster's data and participates in the peer-to-peer ring.
Basic unit of storage: Owns a range of token values and holds the data that hashes into those ranges.
Peer-to-peer, not master-slave:
Every node is equal: any node can accept reads and writes and act as coordinator for a request.
Nodes exchange state via the gossip protocol to know each other's status.
Grouping: Nodes form a rack, racks form a datacenter, and datacenters form a cluster.
Redundancy: Data is replicated to multiple nodes (per the replication factor) so losing one node does not lose data.
Q2.What is Apache Cassandra and what problem does it solve?
Apache Cassandra and what problem does it solve?Apache Cassandra is an open-source, distributed, wide-column NoSQL database built to store massive amounts of data across many commodity servers with no single point of failure. It solves the problem of high write throughput and continuous availability at scale that traditional relational databases struggle with.
Problems it addresses:
Horizontal scale: add commodity nodes to grow capacity linearly instead of scaling one big server up.
Availability: peer-to-peer design with replication means the cluster keeps serving even when nodes fail.
Write-heavy workloads: its log-structured storage makes writes extremely fast.
Key characteristics:
Distributed and decentralized: no master, all nodes are equal.
Tunable consistency: choose consistency vs. availability per query.
Multi-datacenter replication for geographic distribution and disaster recovery.
Typical uses: time-series data, IoT, messaging, activity feeds, and any app needing always-on writes.
Q3.What is nodetool and what are its key capabilities for managing and monitoring Cassandra nodes?
nodetool and what are its key capabilities for managing and monitoring Cassandra nodes?nodetool is Cassandra's command-line administration utility that connects to a node over JMX to inspect and control cluster state. It is the primary tool for day-to-day operations, monitoring, and maintenance.
Cluster and topology inspection:
nodetool status shows nodes, their state (up/down), and data ownership.
nodetool ring and nodetool info show token ranges and per-node details.
Maintenance operations:
nodetool repair reconciles replicas to fix inconsistency.
nodetool cleanup, nodetool compact, and nodetool flush manage SSTables and memtables.
Monitoring and diagnostics:
nodetool tpstats shows thread pool activity and dropped messages.
nodetool cfstats/tablestats report per-table read/write latency and storage metrics.
Node lifecycle: nodetool decommission, drain, and removenode manage adding or safely removing nodes.
Q4.What is Apache Cassandra, and what are its core design principles?
Apache Cassandra, and what are its core design principles?Apache Cassandra is a distributed wide-column NoSQL database designed for scalability and high availability. Its core design principles come from combining Amazon Dynamo's distribution model with Google Bigtable's storage model.
Decentralized / peer-to-peer: No master node, so there is no single point of failure; every node is identical and uses gossip to share state.
Elastic and linear scalability: Add nodes to increase throughput and capacity proportionally, with data spread via consistent hashing.
High availability and fault tolerance: Data is replicated across nodes and datacenters; the cluster tolerates node loss without downtime.
Tunable consistency: Per-request consistency levels (e.g. ONE, QUORUM, ALL) let you trade consistency for latency/availability, reflecting AP in the CAP theorem.
Optimized for writes: Log-structured storage (commit log, memtable, SSTables) makes writes fast and append-only.
Q5.Can you explain why Cassandra is called a NoSQL database?
NoSQL database?Cassandra is called a NoSQL database because it does not follow the traditional relational model: it stores data in a flexible wide-column structure, does not use rigid table joins or full SQL, and is built to scale horizontally across many servers.
Non-relational data model:
Data is organized as a wide-column store (rows keyed by a partition key, with flexible columns) rather than normalized relational tables.
No joins or foreign keys; you denormalize and model tables around queries.
Distributed by design: Built to scale out on commodity hardware, unlike typical single-node relational databases.
Different consistency guarantees: Favors availability and partition tolerance with tunable, eventual consistency instead of strict ACID transactions.
Note on CQL: CQL looks SQL-like for familiarity, but it is a deliberately limited query language, not full relational SQL.
Q6.What is the role of the CQL (Cassandra Query Language) in Cassandra?
CQL (Cassandra Query Language) in Cassandra?CQL (Cassandra Query Language) is the primary interface for interacting with Cassandra. It provides a familiar, SQL-like syntax for defining schema and reading/writing data, while hiding the underlying storage details.
What it does: Defines keyspaces, tables, and types (DDL) and manipulates rows with SELECT, INSERT, UPDATE, DELETE (DML).
SQL-like but not SQL:
No joins, no subqueries, and limited aggregation: queries must be served efficiently by the partition/clustering key design.
You generally must specify the partition key in the WHERE clause to avoid expensive full-cluster scans.
Query-first modeling: CQL enforces designing tables around access patterns rather than normalization.
Access: Used via the cqlsh shell and by client drivers in most languages.
Q7.What is Cassandra and when should you use it?
Cassandra is a distributed NoSQL database built for massive scale, high write throughput, and always-on availability. Use it when you need to handle huge volumes of data across many nodes with no single point of failure and predictable performance, and when you can model your data around known query patterns.
Good fit when:
Write-heavy workloads: logging, metrics, IoT, time-series, event streams.
You need continuous uptime and multi-datacenter/geographic replication.
Data volume and traffic grow and you want to scale horizontally on commodity hardware.
Access patterns are known in advance so tables can be modeled per query.
Poor fit when:
You need joins, ad-hoc queries, or complex transactions across many entities.
You need strong ACID guarantees or unpredictable, exploratory querying.
Data volume is small enough for a single relational database.
Q8.Why was Apache Cassandra developed?
Apache Cassandra developed?Cassandra was developed at Facebook to solve the inbox search problem: storing and searching huge volumes of message data across many servers with high write throughput and no downtime. It was created because existing relational databases could not scale to that size while staying continuously available.
Origins:
Built at Facebook (around 2008) for inbox search, then open-sourced and later became an Apache project.
Combines Amazon Dynamo's distribution/replication model with Google Bigtable's column-family storage model.
Motivating needs:
Scale beyond a single machine, handling terabytes across many nodes.
High availability with no single point of failure for a global user base.
Very high write throughput that relational databases and sharding could not sustain cheaply.
Result: A decentralized, fault-tolerant database favoring availability and partition tolerance over strict consistency.
Q9.What is CQLSH and why is it used?
CQLSH and why is it used?CQLSH is the cqlsh command-line shell for Cassandra: a Python-based interactive client that lets you run CQL statements against a cluster to query, define schema, and administer data.
What it is: A REPL that connects over the native protocol and executes CQL (CREATE, INSERT, SELECT, etc.).
Why it's used:
Quick, driver-free way to test queries, create keyspaces/tables, and inspect data.
Administrative helpers: DESCRIBE schema, COPY to import/export CSV, and CONSISTENCY to set read/write consistency for the session.
Scripting: run .cql files with SOURCE or cqlsh -f for repeatable setup.
Handy for debugging: TRACING ON shows how a query is routed and executed across nodes.
Q10.How does Cassandra differ from traditional relational databases?
Cassandra is a distributed, masterless, column-family store built for horizontal scale and high availability, whereas a traditional RDBMS is typically a single-master relational system optimized for normalized data and ACID transactions.
Architecture:
Cassandra: peer-to-peer ring, scales by adding nodes, no single point of failure.
RDBMS: usually vertical scaling with a primary node and read replicas.
Data modeling:
RDBMS: normalize first, join at query time; queries are flexible.
Cassandra: query-first, denormalize into one table per access pattern; no joins, no subqueries.
Consistency and transactions:
RDBMS: strong ACID transactions.
Cassandra: tunable per-query consistency, eventual by default, limited lightweight transactions only.
Access constraints: Every Cassandra query must target the partition key; you cannot filter arbitrarily and efficiently the way SQL allows.
Q11.How does CQL resemble and differ from SQL?
CQL resemble and differ from SQL?CQL (Cassandra Query Language) borrows SQL's familiar syntax (SELECT, INSERT, tables, rows, columns) to lower the learning curve, but it is not relational: it enforces a query-first model with no joins and access driven by the partition key.
How it resembles SQL:
Same statement keywords and table/row/column vocabulary.
DDL (CREATE TABLE), DML (INSERT, UPDATE, DELETE), and WHERE clauses look familiar.
How it differs:
No joins, no subqueries, no arbitrary aggregations across partitions.
Queries must include the partition key; filtering other columns needs a clustering key, index, or the risky ALLOW FILTERING.
Primary key is composite: partition key (data placement) plus clustering columns (on-disk order).
Writes are upserts: INSERT and UPDATE both just write cells; no read-before-write unless using lightweight transactions.
No referential integrity, no foreign keys; denormalization is expected.
Q12.Where does Cassandra fit, and what are its ideal use cases?
Cassandra fit, and what are its ideal use cases?Cassandra fits write-intensive, always-on applications that need linear horizontal scale and geographic distribution, where you can model around known query patterns and tolerate eventual consistency.
Core sweet spots:
Massive write throughput: log-structured storage makes writes cheap and fast.
High availability: masterless design means no single point of failure and continuous uptime.
Multi-datacenter/geo replication: built-in cross-DC replication for global apps and low-latency local reads.
Ideal use cases:
Time-series and IoT sensor data.
Event logging, metrics, and clickstream/activity feeds.
Messaging, personalization, and product catalogs at scale.
Fraud detection and any workload with predictable, key-based access.
The unifying condition: Access is by partition key with known query shapes, and scale/availability matter more than joins or strong transactions.
Q13.What are the advantages and disadvantages of using Cassandra?
Cassandra's strengths center on scale and availability, while its weaknesses come from the same design choices that enable them: no joins, weaker consistency, and modeling rigidity.
Advantages:
Linear horizontal scalability and high write throughput.
No single point of failure; continuous availability even during node/DC loss.
Native multi-datacenter replication and tunable consistency per query.
Runs on commodity hardware with predictable, low-latency writes.
Disadvantages:
No joins, no ad-hoc queries: you must model tables per query pattern and denormalize.
No full ACID transactions; only limited lightweight transactions.
Eventual consistency can surface stale reads if misconfigured.
Operational overhead: compaction, repair, tombstone management, and careful data modeling.
Q14.What is a coordinator node and what does it do in a request?
The coordinator is whichever node receives a client's request; it acts as the request's proxy, routing it to the replica nodes that own the data and enforcing the requested consistency level.
Any node can be a coordinator: There is no dedicated master; the client's driver typically picks one, often the closest replica.
What it does per request:
Computes the partition's token to find which replicas own the data (via the partitioner and ring).
Forwards the read/write to the replicas and waits for enough acknowledgments to satisfy the consistency level (e.g. QUORUM).
On reads, may issue a read repair to reconcile stale replicas; on writes, stores hints for down replicas (hinted handoff).
Returns the result to the client once the consistency requirement is met.
Q15.Explain the concept of a Cassandra cluster, nodes, and datacenters.
These are Cassandra's units of topology: a node is a single running instance, a datacenter is a group of related nodes, and a cluster is the full set of datacenters that share and replicate the same data.
Node:
A single Cassandra instance storing a portion of the data (a range of tokens) and participating in gossip.
Nodes are grouped into racks, which reflect physical or logical fault domains for replica placement.
Datacenter:
A logical grouping of nodes (often mapping to a physical DC or cloud region) used for replication and locality.
Enables LOCAL_QUORUM reads/writes served within one DC for low latency, and cross-DC replication for resilience.
Cluster:
The complete deployment: one or more datacenters that together form the token ring and replicate keyspaces.
Replication is configured per keyspace, specifying how many replicas live in each datacenter.
Q16.What is a data center in Cassandra?
A data center in Cassandra is a logical grouping of nodes, typically corresponding to a physical location or availability zone, used to isolate workloads and control where replicas are placed.
Logical, not just physical: A DC can map to a real data center, a cloud region/AZ, or a workload group (e.g. one DC for transactional traffic, another for analytics).
Controls replication: With NetworkTopologyStrategy you set replica counts per DC, e.g. {'dc1': 3, 'dc2': 3}.
Enables locality and isolation:
Clients can read/write against a local DC (via LOCAL_QUORUM) for low latency while data still replicates across DCs.
Analytics load in one DC won't starve live traffic in another.
Q17.What are seed nodes in Cassandra and what role do they play?
Seed nodes are designated nodes a new or restarting node contacts first to learn about the cluster and bootstrap the gossip process. They are a discovery mechanism only, not masters and not special for data ownership.
Bootstrap gossip: A joining node connects to seeds listed in cassandra.yaml to obtain the current topology and cluster state, then gossips with everyone.
Not a master or coordinator: Seeds store and serve data like any other node; they carry no extra authority.
Best practices:
Use multiple seeds (commonly 2-3 per DC) for resilience.
Keep the seed list consistent across nodes.
Seed nodes do not auto-bootstrap when first added, so don't make a brand-new node a seed while expanding the cluster.
Q18.Explain Cassandra's data model: Keyspaces, Tables (Column Families), Rows, Partition Keys, and Clustering Columns.
Cassandra's data model is a hierarchy: a keyspace holds tables, tables hold rows keyed by a primary key, and that primary key splits into a partition key (which node owns the data) and clustering columns (how rows are sorted within the partition).
Keyspace: Top-level namespace, analogous to a database; defines the replication strategy and factor for all its tables.
Table (Column Family): A collection of rows with a defined schema; the older term is column family.
Row: A set of columns uniquely identified by its primary key.
Partition key: The first part of the primary key; hashed to a token to decide which node(s) store the data. All rows sharing it live together in one partition.
Clustering columns: Remaining primary-key columns that sort rows within a partition, enabling efficient range scans and ordering.
Q19.What is the significance of the Primary Key in Cassandra, and how is it composed?
Primary Key in Cassandra, and how is it composed?The primary key in Cassandra determines both where data lives (which node) and how it is sorted on disk. It is composed of a partition key plus optional clustering columns, and it also enforces row uniqueness.
Two roles:
Distribution: the partition key is hashed to place data on nodes across the ring.
Uniqueness and ordering: the full primary key uniquely identifies a row, and clustering columns sort rows within a partition.
Composition:
First element = partition key (single column, or a composite in parentheses).
Remaining elements = clustering columns that order rows inside the partition.
Why it matters: your primary key must be chosen to match your queries, since it dictates what you can efficiently filter and sort on.
Q20.What is a keyspace in Cassandra and what does it define (replication strategy, replication factor, durable writes)?
keyspace in Cassandra and what does it define (replication strategy, replication factor, durable writes)?A keyspace is the top-level namespace that groups tables and defines how data in those tables is replicated across the cluster. It sets the replication strategy, replication factor, and whether writes are durably logged.
Replication strategy: SimpleStrategy (single datacenter, testing only) vs NetworkTopologyStrategy (production, per-DC replica counts).
Replication factor (RF): How many copies of each row exist; RF 3 is common so the cluster tolerates node loss.
Durable writes: When durable_writes = true (default), writes hit the commit log first; setting it false risks data loss on crash.
Scope: Analogous to a database/schema in an RDBMS; all tables inside inherit its replication settings.
Q21.What is a table (column family) in Cassandra?
A table (historically called a column family) is a collection of rows within a keyspace, defined by a schema whose primary key controls how rows are partitioned and sorted. It is the unit against which you run CQL queries.
Lives inside a keyspace: It inherits the keyspace's replication settings.
Defined by a primary key: Partition key (distribution) plus optional clustering columns (in-partition order).
Query-first design: Unlike relational tables, you design one table per query pattern and denormalize; joins don't exist.
"Column family" is legacy naming: From the Thrift/pre-CQL era; modern CQL just calls it a table.
Q22.What is a partition key in Cassandra and why is it important?
The partition key is the part of the primary key that Cassandra hashes to decide which node(s) store a row. It is important because it drives data distribution, and because efficient reads require querying by it.
Determines placement: The partitioner hashes it into a token that maps to a position on the ring, choosing the replica nodes.
Governs read efficiency: A query with the full partition key hits one set of replicas; queries without it require a slow cluster-wide scan.
Drives even distribution: A high-cardinality, evenly-accessed key avoids hotspots and "wide" partitions.
First component of the primary key: In PRIMARY KEY ((k), c), k is the partition key; it can be composite.
Q23.What is a clustering key in Cassandra and what is its role?
A clustering key is the set of primary-key columns after the partition key that determine the sort order of rows within a single partition. Its role is to make rows physically ordered on disk so range queries and ordered retrieval are fast.
Orders rows inside a partition: Data is stored sorted by clustering columns, so ranges and ORDER BY come for free.
Ensures uniqueness: Partition key + clustering key together uniquely identify a row.
Configurable direction: CLUSTERING ORDER BY (ts DESC) stores newest first, ideal for time-series.
Query rules: You can filter/range on clustering columns only in order (left to right), after fixing the partition key.
Q24.What is the purpose of TTL (Time to Live) in Cassandra?
TTL (Time to Live) in Cassandra?TTL lets you set an expiration time (in seconds) on data so Cassandra automatically deletes it after that period, without an explicit delete. It's ideal for transient data that should self-expire, such as sessions, caches, or time-limited records.
How it's applied:
Set per write with USING TTL <seconds>, or as a table default via default_time_to_live.
TTL is per cell (per column value), not per row, unless every cell is written together.
What happens at expiry: The cell becomes a tombstone and the value is no longer returned; it's physically removed during compaction after gc_grace_seconds.
Caveats:
Heavy TTL use generates many tombstones, which can hurt read performance if not managed (e.g. with TWCS for time-series).
Check remaining TTL with the TTL(column) function.
Q25.What collection types and UDTs does Cassandra support?
UDTs does Cassandra support?Cassandra supports three collection types (set, list, map) plus user-defined types (UDTs) that let you group related fields into a single named type.
Collections:
set: unordered, unique values, stored sorted.
list: ordered, allows duplicates, indexed by position.
map: key-value pairs with unique keys.
Meant for small amounts of data; not a replacement for a table (default limit ~64KB per collection, 65535 elements).
User-Defined Types (UDTs):
Created with CREATE TYPE to bundle multiple typed fields under one name (e.g. an address with street, city, zip).
Can be nested and used inside collections.
Tuples: A fixed-length, ordered group of typed fields (tuple<int, text>), always frozen.
Q26.What data types does CQL support, and are there any Cassandra-specific types you should know?
CQL support, and are there any Cassandra-specific types you should know?CQL offers the usual scalar types (numeric, text, boolean, dates) plus several Cassandra-specific types built for distributed, wide-column storage such as timeuuid, counter, and blob.
Numeric: int, bigint, smallint, tinyint, varint, float, double, decimal.
Text and binary: text/varchar (UTF-8), ascii, blob (raw bytes).
Date and time: timestamp, date, time, duration.
Cassandra-specific types to know:
uuid and timeuuid: globally unique IDs; timeuuid embeds time and sorts chronologically.
counter: a special distributed counter column with restricted operations.
inet: IPv4/IPv6 addresses.
Complex: Collections (set, list, map), tuples, and UDTs.
Q27.What is indexing in Cassandra?
Indexing in Cassandra is any mechanism that lets you look up rows by a column other than the partition key. Because Cassandra's core lookup is always by partition key, indexes are add-ons with specific tradeoffs, and the primary/clustering key remains the most important "index."
Primary key (the natural index):
Partition key determines placement and enables O(1) node routing.
Clustering columns sort data within a partition, enabling ranges and ordering.
Secondary indexes: Local per-node index on a non-key column; efficient only when combined with a partition key restriction.
SASI and SAI: SASI added text/range search; SAI is the modern successor, more efficient and multi-column.
Key idea: prefer modeling data around queries; indexes complement good schema design, they don't replace it.
Q28.What is a consistency level in Cassandra? Give an example.
A consistency level is the per-operation setting that dictates how many replicas must acknowledge a read or write before Cassandra considers it successful. It is the knob behind Cassandra's tunable consistency, chosen individually on each query.
Set per request: The client or driver chooses it; the same table can be queried at different levels by different operations.
Controls the latency vs. consistency trade-off: Fewer replicas required means faster and more available; more replicas means stronger consistency.
Example: Writing at QUORUM waits for a majority of replicas to ack before returning success.
Q29.What is the Replication Factor, and how does it relate to data availability and durability?
The Replication Factor (RF) is the number of copies of each piece of data Cassandra stores across the cluster, configured per keyspace. A higher RF means more redundancy, improving availability and durability at the cost of storage and write overhead.
Definition: RF=3 means every partition is stored on 3 distinct nodes (or 3 per DC with NetworkTopologyStrategy).
Availability: With RF=3 the cluster can lose replicas and still serve requests; at QUORUM it tolerates one replica down per partition.
Durability: Multiple physical copies mean a single node or disk failure does not lose data.
Interaction with consistency level: Consistency guarantees come from the relationship of read and write CLs to RF: when R + W > RF reads see the latest write (strong consistency).
Trade-offs: Higher RF increases storage cost and write amplification; RF should not exceed the number of nodes in a DC.
Q30.What is data replication in Cassandra and why is it important?
Replication is storing multiple copies of each row on different nodes, controlled by the keyspace's replication factor. It is the foundation of Cassandra's fault tolerance and availability: without it, any node failure would lose data.
Replication factor (RF): Set per keyspace: RF=3 means three copies of every row on three distinct nodes.
Replica placement: The partitioner picks the first replica by token; the replication strategy places the rest on the next nodes around the ring.
Replication strategies: SimpleStrategy for a single datacenter; NetworkTopologyStrategy (recommended) is rack- and DC-aware and spreads replicas across racks.
Why it matters:
Availability: reads/writes survive node loss.
Durability: no single node holds the only copy.
Locality/latency: enables serving from a nearby datacenter.
Q31.What states can a node show in nodetool status (e.g. UN, DN, UJ), and what do they mean?
nodetool status (e.g. UN, DN, UJ), and what do they mean?In nodetool status each node shows a two-character state: the first character is liveness (U=up, D=down) and the second is operational state (N=normal, L=leaving, J=joining, M=moving).
UN: Up and Normal: healthy node serving reads and writes.
DN: Down and Normal: node is a normal ring member but currently unreachable.
UJ: Up and Joining: node is bootstrapping and streaming data before it fully joins.
UL: Up and Leaving: node is decommissioning and streaming its data away.
UM: Up and Moving: node is changing its token position on the ring.
Q32.What is the difference between a memtable and an SSTable?
memtable and an SSTable?A memtable is a mutable, in-memory write buffer; an SSTable is its immutable, on-disk successor. Writes hit the memtable first, then get flushed to an SSTable.
Memtable (in memory):
Mutable: updates to the same key overwrite/merge in place while resident.
One per table (per column family) and volatile: lost on crash if not for the commit log.
Flushed to disk when it hits a size/time threshold.
SSTable (on disk):
Immutable: never edited after being written.
Persistent and durable; many can exist per table and are merged by compaction.
Durability link: Both are backed by the commit log so a crash before flush can be recovered by replaying the log.
Q33.What is the purpose of the Commit Log?
Commit Log?The commit log is Cassandra's crash-recovery mechanism: every write is appended to it on disk before (or as) it goes into the in-memory memtable, so no acknowledged write is lost if the node crashes before the data is flushed to an SSTable.
Durability guarantee:
A write is appended to the commit log and applied to the memtable; only then is it acknowledged.
If the node dies before the memtable is flushed, the commit log is replayed on restart to rebuild the lost memtable state.
Sequential, append-only writes: Appends are fast because they avoid random disk seeks, which is a key reason Cassandra writes are cheap.
Segments and cleanup: The log is split into segments; once all data in a segment has been flushed to SSTables, that segment can be discarded/recycled.
Sync modes: periodic (default): fsync on an interval, faster but a tiny window of risk; batch/group: fsync before acking, safer but slower.
Q34.What are the origins of Cassandra and how did Dynamo and Bigtable influence its design?
Cassandra was created at Facebook (around 2008) to power inbox search, then open-sourced and moved to Apache. Its design deliberately fuses two influential Google/Amazon papers: Amazon's Dynamo for distribution and availability, and Google's Bigtable for the data/storage model.
Origins: Built by Avinash Lakshman (a Dynamo author) and Prashant Malik at Facebook; open-sourced in 2008 and became an Apache top-level project.
From Dynamo (distribution and availability):
Peer-to-peer, masterless ring: no single point of failure.
Consistent hashing for data placement, replication, and gossip for membership.
Tunable consistency, hinted handoff, and read repair for high availability.
From Bigtable (data and storage model):
Column-family / wide-row storage model organized by partition and clustering.
Log-structured storage engine: writes go to a commit log and memtable, then flush to immutable SSTables with compaction.
The net result: Bigtable's storage/data model running on Dynamo's always-available distributed architecture.
Q35.Explain the concept of eventual consistency in Cassandra.
Eventual consistency means that once writes stop, all replicas will converge to the same value, but immediately after a write different replicas may briefly hold different values. Cassandra offers this by default for availability, then uses background mechanisms to reconcile replicas.
Why it exists: Replicas can accept writes independently to stay available during partitions or node failures.
How convergence happens:
Read repair: mismatched replicas are fixed during reads.
Hinted handoff: writes for a down node are stored and replayed when it returns.
Anti-entropy repair: nodetool repair reconciles replicas using Merkle trees.
Conflict resolution: Last-write-wins by cell timestamp; the highest timestamp wins.
It's tunable, not fixed: Choosing consistency levels so that reads and writes overlap (R + W > RF) gives you effectively strong consistency when needed.
Q36.Explain the CAP theorem and where Cassandra typically fits (AP with tunable consistency).
CAP theorem and where Cassandra typically fits (AP with tunable consistency).The CAP theorem states that during a network partition a distributed system can guarantee at most two of Consistency, Availability, and Partition tolerance. Since partitions are unavoidable, real systems choose between C and A; Cassandra is an AP system that stays available and uses tunable consistency to trade toward C when required.
The three properties:
Consistency: every read sees the latest write.
Availability: every request gets a (non-error) response.
Partition tolerance: the system keeps working despite dropped network messages.
Why Cassandra is AP: Masterless replicas keep serving reads/writes even when some nodes are unreachable, favoring availability over immediate consistency.
Tunable consistency:
Per-query consistency levels (ONE, QUORUM, ALL, LOCAL_QUORUM) shift the C/A balance.
When R + W > RF (e.g. QUORUM reads and writes), you get strong consistency at the cost of availability during partitions.
Nuance: CAP is only about partition-time behavior; in normal operation Cassandra also trades latency vs consistency (see PACELC).
Q37.How does Cassandra differ from MongoDB?
Both are NoSQL, but they differ in architecture and data model: Cassandra is a masterless, wide-column store optimized for write-heavy scale and multi-datacenter availability, while MongoDB is a document store with a primary-based replica set optimized for flexible JSON-like documents and richer queries.
Data model:
Cassandra: partitioned wide-column tables with a fixed-ish schema and defined primary key.
MongoDB: schema-flexible BSON documents, nested structures, and secondary indexes.
Topology and writes:
Cassandra: peer-to-peer, any node accepts writes, excellent for high write throughput.
MongoDB: single primary per replica set handles writes; secondaries replicate.
Consistency:
Cassandra: tunable, AP-leaning consistency per query.
MongoDB: CP-leaning with read/write concerns and stronger single-document consistency.
Querying: MongoDB offers richer ad hoc queries and aggregation pipelines; Cassandra requires query-first modeling around partition keys.
Fit: Cassandra shines for always-on, geographically distributed, write-intensive workloads; MongoDB for flexible documents and varied query patterns.
Q38.Describe the tradeoffs between eventual consistency and strong consistency in Cassandra.
In Cassandra the choice between eventual and strong consistency is set per query via consistency levels, and it is fundamentally a trade of correctness guarantees against availability and latency. Eventual gives speed and uptime; strong gives up-to-date reads at higher cost.
Eventual consistency (e.g. ONE):
Pros: lowest latency, highest availability, tolerates node/partition failures well.
Cons: reads may return stale data until read repair or anti-entropy reconciles replicas.
Strong consistency (via quorum overlap):
Achieved when R + W > RF, e.g. QUORUM reads and writes.
Pros: reads reflect the latest acknowledged write.
Cons: higher latency (more replicas must respond) and reduced availability (fails if a quorum is unreachable).
Practical guidance:
Use LOCAL_QUORUM in multi-DC setups for strong local consistency without cross-DC latency.
Match the level to the data: financial/critical reads lean strong, analytics/logging lean eventual.
For true read-modify-write correctness, use lightweight transactions (IF / Paxos), accepting significant overhead.
Q39.How does Cassandra compare with HBase in terms of architecture and data model?
Cassandra compare with HBase in terms of architecture and data model?Both are wide-column stores inspired by Google's Bigtable/Dynamo lineage, but Cassandra is masterless and AP, while HBase is master-based and CP with heavy dependencies on the Hadoop ecosystem.
Architecture:
Cassandra: peer-to-peer ring, every node equal, no single point of failure.
HBase: master/region-server model, relies on HDFS for storage and ZooKeeper for coordination.
CAP posture: Cassandra favors availability (AP); HBase favors consistency (CP) and may become unavailable if a region server or master fails.
Data model:
Both use rows keyed by a row/partition key with column families.
Cassandra exposes CQL with defined schema and clustering; HBase is schema-light with dynamic columns and byte-oriented cells.
Operations and fit:
Cassandra is simpler to run standalone and great for real-time, high-availability apps.
HBase shines when tightly integrated with Hadoop/MapReduce/Spark batch analytics.
Q40.When would you not use Cassandra?
Cassandra?Avoid Cassandra when your workload needs strong transactional guarantees, complex ad-hoc querying, or joins, or when your data volume simply doesn't justify a distributed system: its strengths become liabilities there.
You need ACID transactions: No multi-partition transactions; lightweight transactions (IF NOT EXISTS via Paxos) are limited and slow.
Ad-hoc or analytical queries:
No joins, no arbitrary WHERE clauses; you must know your query patterns up front.
Aggregations and reporting are better served by a relational or OLAP system.
Small or low-scale datasets: Operational complexity (multi-node, repairs, compaction tuning) isn't worth it below the scale a single RDBMS handles fine.
Heavy update/delete or read-before-write patterns: Tombstone accumulation and lack of efficient in-place updates hurt these workloads.
Strong immediate consistency everywhere: If every read must reflect the latest write without tuning CL trade-offs, a CP system fits better.
Q41.What are Cassandra's core design goals and key strengths, such as linear scalability, no single point of failure, high write throughput, multi-datacenter distribution, and tunable consistency?
Cassandra is a distributed NoSQL database built for massive scale, continuous availability, and geographic distribution, trading strict relational features for partition tolerance and predictable write performance.
Linear scalability: Adding nodes increases throughput and capacity proportionally with near-zero operational disruption because data is spread by consistent hashing.
No single point of failure: Every node is equal (masterless peer-to-peer), so any node can serve requests and losing one node does not take the cluster down.
High write throughput: Writes are append-only to a commit log plus an in-memory memtable, avoiding read-before-write and random disk seeks (LSM-tree design).
Multi-datacenter distribution: Native replication across datacenters/regions supports geographic locality and disaster recovery via NetworkTopologyStrategy.
Tunable consistency: Per-query consistency levels (ONE, QUORUM, ALL, LOCAL_QUORUM) let you trade latency against strength of consistency (AP-leaning under CAP).
Q42.What are Cassandra's ideal use cases and when should you NOT use Cassandra?
Cassandra shines for write-heavy, always-on workloads with known query patterns at large scale, and is a poor fit where you need ad-hoc queries, strong transactions, or joins.
Ideal use cases:
Time-series and IoT/sensor data, event logging, and metrics with high ingest rates.
Messaging, activity feeds, and user activity tracking where availability matters most.
Globally distributed apps needing multi-datacenter, low-latency local reads/writes.
Workloads with predictable, well-defined access patterns you can model tables around.
When NOT to use it:
Need ACID transactions across many rows/tables (banking ledgers, complex ordering).
Ad-hoc querying, joins, or aggregations across arbitrary columns.
Small datasets that fit comfortably in one relational instance: the operational overhead isn't worth it.
Read-heavy workloads where query needs change frequently and can't be modeled up front.
Q43.When would you choose Cassandra over a traditional relational database, and what are the key trade-offs?
Choose Cassandra over an RDBMS when scale, write throughput, and continuous availability across datacenters outweigh the need for joins, flexible queries, and strong transactional guarantees.
Choose Cassandra when:
Data volume/velocity exceeds what a single relational node (or its replicas) can handle.
You need horizontal scale-out on commodity hardware instead of vertical scaling.
Uptime and multi-region writes are critical, and eventual consistency is acceptable.
Key trade-offs you accept:
Query-first data modeling: you denormalize and duplicate data per query pattern, no joins.
No cross-partition ACID transactions (only lightweight transactions via Paxos, which are costly).
Eventual consistency by default: you tune consistency levels rather than get it for free.
Operational complexity: repairs, compaction, and cluster management to maintain.
Q44.How does Cassandra achieve high availability and no single point of failure?
Cassandra achieves high availability by replicating each piece of data to multiple nodes across the ring (and datacenters) and by having no special node whose loss halts the cluster, so requests keep succeeding as long as enough replicas are reachable.
Replication:
Each partition is stored on N nodes set by the replication factor; any replica can serve the request.
Rack- and DC-aware placement (NetworkTopologyStrategy) survives whole-rack or datacenter outages.
Masterless design: No leader to fail over; any node coordinates, so there is no single point of failure.
Tunable availability vs consistency: Lower consistency levels (ONE, LOCAL_QUORUM) let writes/reads succeed even when some replicas are down.
Failure handling mechanisms: Hinted handoff stores writes for temporarily down nodes; read repair and anti-entropy repair reconcile divergence when they return.
Q45.How does the ring architecture work in Cassandra?
Cassandra arranges nodes in a logical ring where the entire token range is divided among nodes, and a partition key is hashed to a token that determines which node owns that data. There is no master: every node is a peer.
Token-based ownership: The partition key is hashed (default Murmur3Partitioner) into a token; the node responsible for that token range owns the primary replica.
Virtual nodes (vnodes): Each node owns many small token ranges instead of one large one, giving smoother data distribution and faster rebalancing when nodes join or leave.
Replication around the ring: Additional replicas are placed on the next nodes clockwise (respecting rack/DC awareness), set by the replication factor.
Peer-to-peer, no single point of failure:
Any node can accept a request and act as coordinator, routing it to the correct replicas.
Nodes share state via the gossip protocol.
Q46.How does Cassandra use datacenters and racks in its topology?
Cassandra is topology-aware: it groups nodes into datacenters and racks so that replicas are spread across failure domains, giving both fault tolerance and locality.
Racks = failure domains: With NetworkTopologyStrategy, replicas are placed on distinct racks within a DC so a rack failure (power, switch) doesn't take out all copies.
Datacenters = regions/workloads: Replication is configured per DC, enabling geo-distribution and workload isolation.
Snitch determines topology: A snitch (e.g. GossipingPropertyFileSnitch) tells Cassandra which DC and rack each node belongs to and informs replica placement and routing.
Practical rule: Use the same number of racks as your replication factor so replicas land on separate racks evenly.
Q47.Why does Cassandra not support JOINs or referential integrity, and what are the implications for data modeling?
JOINs or referential integrity, and what are the implications for data modeling?Cassandra omits JOINs and referential integrity because they require cross-node coordination and locking that would destroy its horizontal scalability and availability. Instead you model data to match your queries, accepting denormalization and redundancy.
Why they're absent:
JOINs would need to gather rows from many nodes at query time, which is slow and unpredictable in a distributed ring.
Foreign-key enforcement would require distributed transactions/locks, conflicting with high availability and partition tolerance.
Modeling implications:
Query-first design: build tables to serve specific queries, one table per access pattern.
Denormalize: duplicate data across tables rather than joining.
App owns integrity: your application (or BATCH writes) keeps duplicated copies in sync.
Trade write/storage cost for fast, single-partition reads.
Q48.Explain the concept of query-driven data modeling in Cassandra. Why is it crucial, and how does it differ from relational modeling?
Query-driven modeling means you design tables around the exact queries your application will run, not around normalized entities. In Cassandra there are no joins and no ad-hoc queries, so the read path must be satisfied by a single partition read: you model to serve reads.
Start from queries, not entities:
List the app's read patterns first, then create one table per query pattern.
The primary key is derived from the WHERE and ORDER BY the query needs.
Why it's crucial:
Cassandra can only efficiently fetch by partition key; unsupported queries either fail or require expensive ALLOW FILTERING scans.
A good model keeps each read to one partition on one replica set.
How it differs from relational:
Relational: normalize once, join at query time, optimize with indexes later.
Cassandra: denormalize and duplicate data across many tables, accept write amplification to make reads fast.
Q49.Differentiate between a Partition Key and Clustering Columns. How do they influence data storage and retrieval?
Partition Key and Clustering Columns. How do they influence data storage and retrieval?The partition key decides which node stores the data and groups rows together; clustering columns decide the sort order of rows within that partition. Together they form the primary key, but they play very different roles in storage and retrieval.
Partition key:
Hashed (via the partitioner) to determine node placement across the cluster.
Queries must supply the full partition key for an efficient lookup (equality only).
All rows sharing a partition key live together on the same replicas.
Clustering columns:
Physically sort rows on disk within the partition (ascending/descending as declared).
Enable range scans and ORDER BY within a partition without extra cost.
Must be filtered in order (left to right) to remain efficient.
Impact: partition key = distribution and locating data; clustering columns = ordering and efficient in-partition retrieval.
Q50.Explain the concept of data denormalization in Cassandra.
Denormalization in Cassandra means intentionally duplicating data across multiple tables so that each query reads from a single, purpose-built table. Because there are no joins, you trade storage and write overhead for fast, single-partition reads.
Why it's the norm here:
No joins or subqueries: a read must find everything it needs in one place.
Writes are cheap in Cassandra, so duplicating on write is an acceptable cost.
How it looks in practice:
One table per query pattern, each holding copies of the fields that query returns.
Same logical entity may live in several tables keyed differently.
Trade-offs:
Application (or batch) must keep duplicates in sync, since there's no cascading update.
More storage used, but reads stay fast and predictable.
Q51.Explain the concept of Primary Keys in Cassandra and why Cassandra does not support Foreign Keys or referential integrity.
Primary Keys in Cassandra and why Cassandra does not support Foreign Keys or referential integrity.A primary key in Cassandra locates and uniquely identifies a row within the distributed cluster. Cassandra deliberately omits foreign keys and referential integrity because enforcing them would require cross-node coordination that breaks its scalability and availability model.
Primary key recap: Partition key (placement) + clustering columns (ordering), together enforcing uniqueness.
Why no foreign keys:
Data is partitioned across many nodes; a foreign key check would need a synchronous lookup on another partition/node, defeating linear scalability.
Cassandra prioritizes availability and partition tolerance; global constraints require coordination that can't be guaranteed.
Consequence for modeling:
Relationships are handled by denormalization and duplication, not references.
The application is responsible for consistency between related data.
Q52.What are the challenges in Cassandra data modeling?
The main challenges in Cassandra data modeling come from its distributed, denormalized nature: you must anticipate queries up front, manage duplicated data, and control partition size and distribution, all without joins or strong consistency to fall back on.
Query-first rigidity: New query patterns often mean new tables; you can't easily run ad-hoc queries later.
Partition sizing: Too-large partitions hurt performance; too many tiny ones waste efficiency. Bucketing is often needed.
Hotspots and skew: Poor partition key choice concentrates load on a few nodes.
Data duplication and consistency: Denormalized copies must be kept in sync by the application; there's no cascade or join.
Handling deletes and updates: Deletes create tombstones that can degrade reads if not managed.
Q53.Explain how Cassandra handles schema changes and what are the best practices.
Cassandra supports online schema changes (adding tables, columns, etc.) that propagate through the cluster via a schema version gossip mechanism. Changes are relatively cheap because Cassandra is schema-flexible per row, but they must be coordinated to avoid schema disagreement across nodes.
How changes propagate:
DDL like ALTER TABLE updates a schema version that gossips to all nodes; they converge to agreement.
Adding/dropping a column is a metadata change; existing SSTables aren't rewritten.
What you can and can't do:
Allowed: add columns, add tables, change some table properties.
Not allowed: change a column's type in most cases, or alter primary key columns.
Best practices:
Make one schema change at a time and let it fully propagate (check nodetool describecluster for schema agreement) before the next.
Never run concurrent DDL from multiple clients: it can cause schema disagreement.
Prefer additive changes; avoid dropping and recreating columns with the same name quickly.
Version schema in migration scripts so it's repeatable across environments.
Q54.How does Cassandra's wide-column store architecture make it suitable for time-series data?
A wide-column (partitioned row) store keeps all rows of a partition physically together, sorted by clustering columns, so appending timestamped readings and range-scanning a time window map directly onto how Cassandra stores and reads data.
Rows within a partition are stored contiguously and sorted: A time range query is a single sequential read along the clustering order, no scatter across nodes.
Partitions can be very wide: One partition holds many timestamped columns/rows, ideal for a stream of readings per entity.
Write-optimized LSM engine: Writes go to a commit log and memtable then flush to immutable SSTables, so high-velocity ingest is cheap.
Sparse columns cost nothing: Different rows can have different columns, so irregular or optional metrics don't waste space.
Q55.What is a composite/compound partition key and when would you use one?
A composite (compound) partition key uses two or more columns to determine the partition, so the combined value is hashed to place data. You use it to spread data more evenly or to keep partitions from growing too large.
Syntax uses extra parentheses: PRIMARY KEY ((col_a, col_b), clustering_col): the inner parentheses group the partition key.
When to use it:
Bucketing to bound partition size (e.g. adding a day bucket to a sensor id).
Distributing data more evenly when a single column would create hotspots.
Query constraint: You must supply all partition-key columns in the WHERE clause to read, since together they identify the partition.
Distinct from clustering keys: Partition key = placement/distribution; clustering key = ordering within a partition.
Q56.Why are all writes in Cassandra considered upserts, and what does that mean for INSERT versus UPDATE?
INSERT versus UPDATE?Cassandra never reads before writing on the normal write path, so it cannot know whether a row already exists: it simply writes the new data with a timestamp. Both INSERT and UPDATE become the same operation (an upsert): create the row/cell if absent, or overwrite it if the timestamp is newer.
No read-before-write:
A write is just an append of timestamped cells to the memtable/commit log, so the server never checks for prior existence.
This is what makes writes so fast and why they scale linearly.
INSERT does not fail on duplicates: Inserting an existing primary key silently overwrites the affected columns instead of raising an error.
UPDATE creates missing rows: Updating a primary key that doesn't exist creates the row, rather than being a no-op.
Conflict resolution is last-write-wins by timestamp: Each cell carries a timestamp; on read/compaction the highest timestamp wins, so ordering, not statement type, decides the result.
Real differences remain: INSERT can set a row-level marker (a primary-key liveness), and only INSERT supports IF NOT EXISTS; UPDATE supports IF EXISTS and counter/collection operations. Those LWT forms do read first via Paxos.
Q57.What is a cell in Cassandra, and how do cell-level timestamps work?
A cell is the smallest unit of storage in Cassandra: the value at the intersection of a row (identified by primary key) and a non-key column. Every cell stores not just a value but also a timestamp (and optionally a TTL), and that timestamp is how Cassandra resolves conflicts independently for each column.
What a cell holds:
The column value, a write timestamp (microseconds since epoch), and optional TTL/expiration metadata.
A deletion is a special empty cell called a tombstone, also timestamped.
Per-cell timestamps enable last-write-wins:
On read, replicas are reconciled cell by cell: the value with the highest timestamp wins.
Because it's per cell, two clients updating different columns of the same row don't conflict; both survive.
Where the timestamp comes from: Normally assigned by the coordinator at write time; you can override it with USING TIMESTAMP, and inspect it with WRITETIME(column).
Implication: Clock skew across clients/nodes can cause a stale write to appear newer, so consistent time sources matter.
Q58.How do you control the on-disk sort order of rows within a partition using CLUSTERING ORDER BY?
CLUSTERING ORDER BY?CLUSTERING ORDER BY is set at table creation to define the default physical sort direction of rows within each partition, based on the clustering columns. Because rows are stored pre-sorted on disk in this order, it determines both efficient range scans and the default order of query results.
Defined per clustering column: You specify ASC or DESC for each clustering column, in the order they appear in the primary key.
It controls on-disk layout: Rows are physically stored sorted this way inside the partition, so reading in that direction is sequential and cheap.
Query-time ORDER BY:
At read time you can only reverse the full defined order (Cassandra reads forward or backward), not sort by arbitrary columns.
Reversing costs slightly more, so choosing the common query direction as the default is a good optimization.
Common use case: Time-series where you want newest-first: cluster by a timestamp DESC.
Q59.What is a Static Column, and what is its primary use case?
A static column is a column whose value is shared by (and stored once for) all rows in a partition, rather than varying per clustering row. Its primary use is to attach partition-level metadata to a table that otherwise holds many clustered rows, without duplicating that value in every row.
Scope is the partition:
One value per partition key; updating it changes it for every row in that partition.
Only meaningful in tables that have clustering columns (partitions with multiple rows).
Declared with the STATIC keyword: A static column cannot itself be part of the primary key.
Primary use case:
Store per-partition attributes alongside per-row data, e.g. a user's account tier next to each of their individual events.
Lets you read partition-wide metadata and row data in a single query.
Q60.What are the different types of counters in Cassandra, and when would you use each type?
Cassandra effectively has one counter mechanism: the special counter column type, a distributed 64-bit integer you increment or decrement rather than set. "Types" of counting really break down into native counter columns for approximate high-throughput counting versus using regular columns with lightweight transactions when you need exactness.
Counter columns:
Declared as type counter; updated only via UPDATE ... SET c = c + n, never by INSERT.
A counter table can contain only primary-key columns and counter columns (no mixing with normal columns).
Best for high-volume, additive metrics: likes, views, hit counts.
Trade-off: not idempotent, so a retried/failed write can over- or under-count; treat them as approximate.
Exact counting alternative: When precision matters, model counts with normal columns and use lightweight transactions (IF / Paxos) or aggregate rows, accepting lower throughput.
Q61.What is a TimeUUID in Cassandra, and when would you use it instead of a regular UUID?
TimeUUID in Cassandra, and when would you use it instead of a regular UUID?A timeuuid is a version-1 UUID that encodes a timestamp, so values are both globally unique and sortable by time. You use it instead of a plain uuid when you need unique IDs that also order chronologically, typically as a clustering column.
What it is:
Combines a 100-nanosecond timestamp, a clock sequence, and a node identifier into one unique value.
Ordering compares the embedded time, so newer rows sort after older ones.
Regular uuid (version 4): Random, no time component, no meaningful sort order: use when you just need uniqueness (e.g. surrogate keys).
When to prefer timeuuid:
Time-series or event data where you want unique, time-ordered clustering keys without collisions from duplicate timestamps.
Query with helpers like now(), minTimeuuid(), maxTimeuuid(), and toTimestamp().
Q62.What are frozen versus non-frozen collections in Cassandra, and when do you use each?
A frozen collection is serialized and stored as a single opaque blob that you can only overwrite as a whole, while a non-frozen collection lets you update individual elements in place. Choose frozen when the value is atomic (or must be part of a primary key), non-frozen when you need element-level mutations.
Frozen (frozen<...>):
The whole collection is one cell: any change rewrites the entire value.
Required to use a collection or UDT as part of a primary/clustering key.
Nested collections must be frozen.
Non-frozen (default):
Each element is stored separately, so you can add, remove, or update single elements.
Uses more metadata and can generate tombstones on deletes/overwrites.
Rule of thumb: Use frozen for immutable/atomic values or key components; use non-frozen when you genuinely mutate individual entries.
Q63.Why are counters treated specially in Cassandra, and what limitations do they have?
Counters are special because they support distributed increment/decrement operations rather than plain writes, which requires a read-before-write and specialized replication path. That design gives atomic counting across nodes but imposes several restrictions.
Why they're special:
Regular writes in Cassandra are blind (last-write-wins by timestamp), but counters must combine concurrent increments, so they use a distinct read-modify-write mechanism.
Updated with UPDATE ... SET c = c + 1, not INSERT.
Key limitations:
A counter table can contain only counter columns plus the primary key: no mixing with other data types.
Counter columns cannot be part of the primary key.
You cannot set an arbitrary value or reset easily; only increment/decrement.
Not idempotent: a retried increment after an ambiguous failure can double-count.
No TTL support, and they're heavier due to read-before-write.
Q64.What are Materialized Views in Cassandra, and how do they work?
A Materialized View is a table automatically maintained by Cassandra that holds the same data as a base table but reorganized around a different primary key, letting you query the data by a different access pattern without managing a second table yourself.
How they work:
You define a view with CREATE MATERIALIZED VIEW over a base table, choosing a new primary key.
When the base table is written, Cassandra automatically updates the view (server-side denormalization).
The view's primary key must include all base-table primary key columns, plus at most one extra non-key column.
Caveats:
Writes to the base table incur extra work (read-before-write on the base) to keep views consistent, adding overhead.
You can only write to the base table, never directly to the view.
They have been considered experimental/have known consistency edge cases: many teams prefer maintaining separate query tables from the application.
Q65.What is ALLOW FILTERING in CQL, and why is its use generally discouraged in production?
ALLOW FILTERING in CQL, and why is its use generally discouraged in production?ALLOW FILTERING is a clause that tells Cassandra to execute a query it would otherwise reject because it cannot be satisfied efficiently from the partition/clustering key structure. It forces the cluster to scan and filter rows, which can be very expensive and unpredictable at scale.
Why Cassandra normally rejects such queries:
Efficient queries hit a known partition and use the key columns; queries on non-key columns or across partitions have no index path.
Cassandra refuses them by default to protect you from unbounded scans.
What ALLOW FILTERING actually does:
Reads more rows than it returns, filtering in memory after retrieval.
Cost scales with data volume, so latency grows unpredictably as the table grows.
Why it's discouraged in production:
Can trigger full-table or multi-partition scans, causing high latency, timeouts, and node pressure.
It masks a data-model problem: the fix is usually a query-specific table, a different primary key, or a secondary/SASI index.
Acceptable only for small, bounded datasets, ad-hoc/admin queries, or when already restricted to a single partition.
Q66.What are Prepared Statements in CQL, and what benefits do they offer?
Prepared Statements in CQL, and what benefits do they offer?A prepared statement is a CQL query parsed and planned once by the cluster, then reused with different bound values. It improves performance and safety by avoiding repeated parsing and by separating query structure from data.
How it works:
The driver sends the query text once; the server returns a statement ID plus metadata.
You then execute by binding parameters (? placeholders) to that ID.
Benefits:
Performance: skips re-parsing/planning on every call.
Token awareness: the driver knows the partition key position and can route directly to a replica.
Safety: values are bound, not concatenated, preventing CQL injection.
Best practice: prepare once (at startup/first use) and reuse the object; do not re-prepare inside a loop.
Q67.How do you handle transactions in Cassandra?
Cassandra does not offer traditional multi-row ACID transactions. It provides atomicity at the partition/batch level, isolation within a single partition, and lightweight transactions (LWT) for conditional, linearizable single-key operations.
Single-partition writes: All mutations to one partition apply atomically and in isolation.
Batches:
Logged batches guarantee all statements eventually apply (atomicity), but not isolation across partitions.
Use them for atomicity, not for performance; multi-partition batches are costly.
Lightweight transactions (LWT):
Compare-and-set semantics via IF / IF NOT EXISTS, using the Paxos protocol for linearizability.
Expensive (multiple round trips); use sparingly for things like unique registration.
No rollback, no cross-partition isolation, no foreign keys: design to avoid needing them.
Q68.When is it appropriate to use an index in Cassandra, and when should it be avoided?
Use an index when a query needs an occasional filter on a non-key column and you can constrain it to a single partition; avoid it for high-throughput queries, high- or very-low-cardinality columns, and anything you can serve with a purpose-built table.
Appropriate to use:
Query also restricts the partition key, so it hits one node.
Moderate-cardinality column, infrequently updated.
Low query volume or analytical/ad-hoc access.
Avoid when:
Query must scan the whole cluster (no partition-key restriction): scatter-gather latency.
Very high cardinality (unique-ish values) or very low cardinality (few distinct values, huge index partitions).
Columns with heavy updates/deletes: tombstone accumulation.
It's a core, high-frequency access pattern: model a dedicated table instead.
Q69.How does paging work in Cassandra, and why is it important for large result sets?
Paging splits a large result set into smaller fetches so the coordinator and client never load everything into memory at once. The driver requests one page, and Cassandra returns a paging state cursor to continue from where it left off.
How it works:
You set a fetch size (default typically 5000 rows); the driver fetches page by page as you iterate.
An opaque paging_state token marks the resume position and can be passed back later.
Why it matters:
Prevents coordinator memory pressure and client OOM on large scans.
Bounds latency: you process results incrementally instead of waiting for the full set.
Notes:
Paging is not a stable snapshot; concurrent writes may or may not appear.
The paging state is driver/version specific and should be treated as opaque, useful for stateless "next page" APIs.
Q70.What is tunable consistency in Cassandra, and why is it a key feature?
Tunable consistency means you choose, per query, how many replicas must acknowledge a read or write before it's considered successful. This lets you trade off consistency, availability, and latency on a request-by-request basis rather than a fixed global setting.
Consistency levels (per operation):
Examples: ONE, QUORUM, LOCAL_QUORUM, ALL.
Higher levels = more replicas confirm = stronger consistency but higher latency and less availability.
Strong consistency rule: If read CL + write CL > replication factor (e.g. QUORUM reads and writes), a read always sees the latest write.
Why it's key:
Directly reflects the CAP/PACELC tradeoff; you pick where each query sits on the consistency-vs-availability spectrum.
Enables multi-DC patterns: LOCAL_QUORUM keeps latency low by staying within one data center.
Lets one cluster serve both critical (strong) and tolerant (fast, eventually consistent) workloads.
Q71.What are the different consistency levels in Cassandra, with examples like ONE, QUORUM, LOCAL_QUORUM, ALL, and SERIAL?
ONE, QUORUM, LOCAL_QUORUM, ALL, and SERIAL?Consistency levels specify how many replicas must acknowledge a read or write before it succeeds, letting you trade latency and availability against strictness on each request.
ONE (also TWO, THREE): Only one replica must respond: lowest latency, highest availability, weakest guarantee.
QUORUM: A majority of all replicas across all DCs ((RF/2)+1): strong consistency but incurs cross-DC latency.
LOCAL_QUORUM: Majority within the coordinator's local DC: strong consistency without cross-DC round trips.
ALL: Every replica must respond: strongest consistency but any single node down fails the operation.
SERIAL / LOCAL_SERIAL: Used for lightweight transactions (Paxos-based compare-and-set) to read the latest committed value including in-flight proposals.
ANY (write only): A hinted handoff counts as success, so even a write with no live replica may be acknowledged: maximum availability, minimum guarantee.
Q72.Explain the benefits and trade-offs of using tunable consistency levels in Cassandra.
Tunable consistency lets each operation pick where it sits on the consistency-versus-availability spectrum, so a single cluster can serve both strict and highly available workloads. The trade-off is that correctness now depends on developers choosing levels correctly.
Benefits:
Per-query flexibility: critical writes can use QUORUM while analytics reads use ONE.
Availability: lower levels keep serving during node or DC failures.
Latency control: local levels avoid cross-DC round trips.
Trade-offs:
Complexity: you must reason about R + W > N to guarantee strong consistency.
Stale reads: low levels can return outdated data before repair or read-repair catches up.
No global transactions: strong consistency is per-partition, not linearizable unless using LWT.
Misuse risk: inconsistent level choices between reads and writes silently break guarantees.
Q73.What is tunable consistency in Cassandra and what consistency levels are available?
Tunable consistency means Cassandra does not force a single global consistency model: instead, each read and write chooses how many replicas must respond, so you can balance consistency, latency, and availability per operation.
How it works:
Data is replicated N times; the consistency level sets how many of those N must acknowledge.
Combine read and write levels to satisfy R + W > N for strong consistency.
Available levels:
ONE, TWO, THREE: fixed number of replicas.
QUORUM: majority across all DCs.
LOCAL_QUORUM, EACH_QUORUM: DC-aware majorities.
LOCAL_ONE: one replica in the local DC.
ALL: every replica.
ANY (write only): hint counts as success.
SERIAL, LOCAL_SERIAL: linearizable reads for lightweight transactions.
Q74.How does Cassandra resolve conflicts between concurrent writes, and what is the last-write-wins model?
Cassandra resolves concurrent writes with last-write-wins (LWW): every column value carries a timestamp, and on conflict the value with the highest timestamp is kept. There is no locking or merging: the latest timestamp simply overwrites older ones.
Timestamps drive resolution:
Each cell is stored with a write timestamp (microseconds), usually assigned by the coordinator or client.
During reads, compaction, and read-repair, Cassandra keeps the cell with the greatest timestamp.
Cell-level granularity: Resolution happens per column, not per row, so concurrent updates to different columns can both survive.
Risks of LWW:
Clock skew: an out-of-sync client clock can make an older write silently win; use NTP.
Ties are broken deterministically by comparing values, but data can still be lost.
When LWW isn't enough: Use lightweight transactions (IF conditions, Paxos) for compare-and-set semantics that avoid blind overwrites.
Q75.What happens when a query's requested consistency level cannot be satisfied, and what is an UnavailableException?
UnavailableException?When Cassandra determines that not enough replicas are available to meet the requested consistency level, it fails the request immediately with an UnavailableException: the coordinator rejects the query before attempting it rather than returning partial results.
Precondition check happens up front: The coordinator counts live replicas for the partition. If fewer than the consistency level requires (e.g. QUORUM needs 2 of RF=3 but only 1 is up), it throws before writing or reading.
UnavailableException: Signals a cluster-state problem: the required number of replica nodes are down or unreachable, so the operation was never attempted.
Distinct from a timeout: A WriteTimeoutException or ReadTimeoutException means enough replicas existed and the operation was tried but didn't respond in time. UnavailableException means it was never even started.
How to mitigate: Lower the consistency level, increase RF, spread replicas across racks/DCs, or retry once a replica recovers.
Q76.What is the difference between ONE and LOCAL_ONE consistency levels?
ONE and LOCAL_ONE consistency levels?Both require a response from a single replica, but ONE accepts any replica across the whole cluster while LOCAL_ONE restricts that replica to the coordinator's local datacenter.
ONE: One replica in any DC may satisfy the request, so a response could come from a remote datacenter over the WAN.
LOCAL_ONE: Guarantees the responding replica lives in the local DC, avoiding cross-DC latency and keeping traffic contained.
Why it matters in multi-DC deployments:
LOCAL_ONE prevents accidental cross-region reads/writes that add latency and bandwidth cost, and keeps a DC serving requests independently.
In a single-DC cluster the two behave effectively the same.
Trade-off: Both give lowest latency and highest availability but weakest consistency; a read may return stale data if the queried replica hasn't received the latest write.
Q77.How does data get distributed across nodes in a Cassandra cluster, and what role do partitioners and token ranges play?
Cassandra distributes data by hashing each row's partition key into a token, then assigning that token to the node (or nodes) that own the surrounding range of the token space. The partitioner defines the hash function, and token ranges define which node owns which slice of the ring.
The partitioner:
A function that maps a partition key to a token; the default Murmur3Partitioner produces a uniformly distributed 64-bit value.
Uniform hashing spreads data evenly and avoids hotspots (assuming reasonable key cardinality).
The token ring: The full token space is a ring; each node is assigned one or more token ranges and owns the keys whose tokens fall in those ranges.
Placement and replication: The primary replica is the node owning the token; additional replicas are placed on the next nodes around the ring per the replication strategy and RF.
Consequences: Any node can act as coordinator and route a request to the correct owners, and adding/removing nodes just reassigns token ranges, so scaling is incremental.
Q78.Explain the difference between SimpleStrategy and NetworkTopologyStrategy replication strategies. When would you use each?
SimpleStrategy and NetworkTopologyStrategy replication strategies. When would you use each?Both decide where replicas are placed, but SimpleStrategy is topology-unaware and just walks the ring, while NetworkTopologyStrategy is datacenter- and rack-aware, placing replicas to survive rack and DC failures. Use the former only for single-DC dev/test and the latter for any production or multi-DC cluster.
SimpleStrategy:
Places the first replica per the partitioner, then the next replicas on the following nodes clockwise, ignoring racks and datacenters.
Simple but risky: replicas can end up on the same rack, and it cannot express per-DC RF.
NetworkTopologyStrategy:
Lets you set an independent RF per datacenter, e.g. {'dc1': 3, 'dc2': 3}.
Within a DC it places replicas on distinct racks where possible, so a rack outage doesn't take out all copies.
When to use each:
SimpleStrategy: local development or a single-DC learning cluster only.
NetworkTopologyStrategy: always in production, and mandatory for multi-DC deployments and geo-distributed replication.
Q79.What are Virtual Nodes (vnodes), and what benefits do they provide?
Virtual nodes (vnodes) let each physical node own many small, non-contiguous token ranges instead of a single large one. Rather than one token per node, a node is assigned many (e.g. 16 or 256), which greatly simplifies cluster management and evens out data distribution.
Before vnodes: Each node had one token range; adding a node required manually recalculating tokens and rebalancing was coarse and painful.
With vnodes: The ring is split into many small ranges automatically, controlled by num_tokens.
Benefits:
Even distribution: many small ranges balance data and load across nodes of varying capacity.
Faster rebuild/recovery: a failed node's ranges are streamed from many peers in parallel rather than from a few.
Easier scaling: new nodes automatically claim a share of ranges without manual token assignment.
Caveat: Very high num_tokens can hurt repair and availability; modern deployments often use a smaller value (e.g. 16) for a better balance.
Q80.How does Cassandra ensure data availability and fault tolerance?
Cassandra is a masterless, distributed database: every node is equal, data is replicated across multiple nodes, and there is no single point of failure, so the cluster keeps serving reads and writes even when nodes go down.
Peer-to-peer architecture: No master node; any node can accept any request and act as coordinator, so losing one node never stops the cluster.
Replication: Each row is stored on RF (replication factor) nodes, so copies survive individual failures.
Tunable consistency: You choose a consistency level per query (ONE, QUORUM, LOCAL_QUORUM) to balance availability against strong consistency.
Gossip protocol: Nodes continuously exchange state so the cluster detects failures and routes requests to live replicas.
Self-healing mechanisms: Hinted handoff, read repair, and anti-entropy repair reconcile data after outages.
Q81.How does Cassandra handle node failures?
When a node fails, its replicas on other nodes still serve the data, and Cassandra uses gossip to mark the node down and hinted handoff plus repair to catch it up when it returns.
Failure detection: The gossip protocol and a phi-accrual failure detector flag a node as unreachable; the coordinator routes to other replicas.
Requests continue: As long as enough replicas are alive to satisfy the consistency level, reads and writes succeed.
Hinted handoff: Writes destined for the down node are stored as hints by the coordinator and replayed when it comes back (within max_hint_window_in_ms).
Read repair: During reads, mismatched replicas are detected and updated with the newest data.
Anti-entropy repair: For longer outages beyond the hint window, run nodetool repair to fully resync replicas; if a node is dead permanently, replace it and stream data from peers.
Q82.How does multi-datacenter replication work and why use LOCAL_QUORUM?
LOCAL_QUORUM?With NetworkTopologyStrategy, Cassandra keeps a configurable number of replicas in each datacenter and streams writes to all of them. LOCAL_QUORUM gives strong consistency using only replicas in the local DC, avoiding cross-datacenter latency.
How multi-DC replication works:
You set an RF per datacenter (e.g. 'dc1': 3, 'dc2': 3); a write to one DC is asynchronously forwarded to the other DCs.
Each DC holds a full set of replicas, so an entire datacenter can fail without data loss.
Why LOCAL_QUORUM:
It requires a quorum of replicas only within the coordinator's local DC, so latency stays low (no WAN round trips).
Still gives strong consistency locally: with LOCAL_QUORUM writes and reads in the same DC, reads see the latest write.
Contrast with QUORUM: Plain QUORUM counts replicas across all DCs, adding cross-DC latency and failing if a remote DC is down.
Typical use: Serve each region from its nearest DC with LOCAL_QUORUM, while replication provides geographic redundancy.
Q83.How does consistent hashing map data to nodes in Cassandra?
Cassandra hashes each row's partition key into a token, and the ring of tokens is divided among nodes; the row lives on the node that owns that token range (plus the next nodes for replicas). This consistent hashing means adding or removing a node only reshuffles a small slice of data.
Hashing the key: The partitioner (default Murmur3Partitioner) hashes the partition key to a 64-bit token in a fixed range.
The ring: Tokens form a logical circle; each node owns the range of tokens up to its position, so a token maps to exactly one primary node.
Replica placement: Additional replicas are placed on the next nodes clockwise around the ring, per the replication strategy.
Minimal reshuffling: Consistent hashing means topology changes move only neighboring ranges, not the whole dataset.
Virtual nodes (vnodes): Each node owns many small token ranges, which evens out data distribution and speeds rebalancing.
Q84.How does Cassandra ensure data durability and fault tolerance through replication?
Durability comes from two layers: on a single node the commit log persists every write before it is acknowledged, and across the cluster replication keeps multiple copies so no single node's failure loses data.
Local durability (per node):
Every write is appended to the append-only commitlog on disk and also stored in the in-memory memtable.
Memtables flush to immutable SSTables; after a crash the commit log is replayed to recover unflushed writes.
Cluster durability (replication): Each write goes to all RF replicas, so a copy survives even if a node's disk is lost.
Tuning the tradeoff: Write consistency level decides how many replicas must ack before success (e.g. QUORUM for stronger durability guarantees).
Fault tolerance: Hinted handoff, read repair, and nodetool repair reconcile replicas after failures so copies stay consistent.
Q85.What are partitions and tokens in Cassandra?
A partition is the unit of data grouped and stored together, identified by the partition key; a token is the hash of that partition key that determines which node owns the partition. Together they decide where data lives and how it is retrieved.
Partition:
All rows sharing the same partition key are stored contiguously on the same node(s).
Reads within one partition are fast; queries are designed around the partition key.
Token: The partitioner hashes the partition key to a token; the node owning that token range on the ring stores the partition.
Partition key vs clustering key: The partition key (first part of the primary key) sets placement; clustering columns order rows within the partition.
Design implications: Choose keys that spread data evenly to avoid hot spots, and keep partitions bounded in size to avoid large-partition problems.
Q86.What are the different types of partitioners in Cassandra?
A partitioner decides how row keys map to tokens on the ring, and Cassandra ships with three: Murmur3, RandomPartitioner, and ByteOrderedPartitioner.
Murmur3Partitioner (default): Uses the MurmurHash3 function producing 64-bit tokens in range -2^63 to 2^63-1; fast and gives even distribution.
RandomPartitioner: Legacy default; uses an MD5 hash producing tokens 0 to 2^127-1. Even distribution but slower than Murmur3.
ByteOrderedPartitioner: Orders rows by the raw bytes of the key, enabling range scans over keys but causing hotspots and uneven load; discouraged.
Key rule: the partitioner is cluster-wide and cannot be changed after data is loaded.
Q87.What is a partitioner in Cassandra and what does Murmur3Partitioner do?
Murmur3Partitioner do?A partitioner is the function that hashes a row's partition key into a token, determining which node(s) own that data on the ring. Murmur3Partitioner applies MurmurHash3 to produce a 64-bit token, giving fast, uniform distribution across nodes.
Purpose of a partitioner: Consistently maps each partition key to a token so any node can compute where data lives without a lookup service.
What Murmur3 provides:
Non-cryptographic hash: much faster than the MD5 used by RandomPartitioner.
Uniform spread of tokens minimizes hotspots and balances load.
Constraint: It must be identical across the whole cluster and fixed for the life of the data.
Q88.How are replicas chosen around the ring in Cassandra?
Cassandra hashes the partition key to a token, finds the first node owning that token range (the primary replica), then walks clockwise around the ring to place additional replicas according to the replication factor and the replication strategy.
SimpleStrategy: Places the primary at the token owner, then the next RF-1 nodes clockwise, ignoring topology. For single-datacenter or testing.
NetworkTopologyStrategy:
Configures RF per datacenter and places replicas clockwise, skipping to distinct racks to survive rack failure.
Recommended for production, even single-DC, because it is topology-aware.
Snitch influence: The snitch informs the strategy which nodes are in which rack/DC so replicas land on separate failure domains.
Q89.What is a snitch and what are the different types of snitches?
A snitch tells Cassandra the network topology (which datacenter and rack each node is in) so the replication strategy can place replicas across failure domains and the coordinator can route reads to the closest replica.
SimpleSnitch: No topology awareness; single-DC only, treats all nodes as one rack.
GossipingPropertyFileSnitch: Recommended for production; each node declares its DC/rack in cassandra-rackdc.properties and gossips it to the cluster.
PropertyFileSnitch: Reads topology for all nodes from cassandra-topology.properties; must be kept in sync manually.
Ec2Snitch / Ec2MultiRegionSnitch: For AWS: infer DC from region and rack from availability zone; multi-region variant handles cross-region public IPs.
GoogleCloudSnitch / RackInferringSnitch: Cloud-provider and octet-based variants that derive topology from the environment or IP structure.
Q90.Explain the Cassandra write path involving the Commit Log, Memtable, and SSTables.
Commit Log, Memtable, and SSTables.A write in Cassandra is durable and fast because it appends to the commit log and updates an in-memory Memtable simultaneously, then later flushes the Memtable to an immutable SSTable on disk. Writes never overwrite data in place, which is what makes them so cheap.
Commit log (durability first):
The mutation is appended sequentially to the on-disk commit log so it survives a crash before being flushed.
On restart, the commit log is replayed to rebuild any Memtable that wasn't flushed.
Memtable (in-memory write buffer): An in-memory, per-table structure sorted by clustering order that accumulates writes; updates to the same cell are merged in memory.
Acknowledge the client: Once the commit log append and Memtable update succeed on enough replicas (per consistency level), the coordinator acknowledges the write.
Flush to SSTable:
When the Memtable fills (size or time threshold), it is flushed as a new immutable SSTable and the corresponding commit log segments can be discarded.
Because SSTables are immutable, updates and deletes (tombstones) accumulate across files and are reconciled at read and compaction time.
Net effect: writes are append-only (sequential I/O, no read-before-write), which is why Cassandra sustains very high write throughput.
Q91.What are SSTables, what are their characteristics, and what components do they typically include?
SSTables, what are their characteristics, and what components do they typically include?An SSTable (Sorted String Table) is the immutable, on-disk file format Cassandra flushes Memtables into. Being immutable and sorted by partition key makes reads and compaction efficient, but means a logical row can be scattered across many SSTables.
Key characteristics:
Immutable: never modified after being written; updates/deletes create new data in newer SSTables.
Sorted: entries stored in partition-token order for efficient lookups and merges.
Merged/removed by compaction, which combines SSTables and purges tombstones and superseded cells.
Component files that make up one SSTable:
Data.db: the actual row data.
Index.db: maps partition keys to offsets in the data file.
Summary.db: an in-memory sampled index of the partition index for fast seeking.
Filter.db: the Bloom filter for quick 'not present' checks.
CompressionInfo.db, Statistics.db, Digest / TOC: compression metadata, min/max timestamps and histograms, and checksums/file manifest.
Q92.How do Bloom Filters work in Cassandra, and what problem do they solve for reads?
Bloom Filters work in Cassandra, and what problem do they solve for reads?A Bloom filter is a compact, probabilistic bitset per SSTable that answers 'might this partition key be in this file?' It lets Cassandra skip SSTables that definitely don't contain the key, avoiding needless disk reads.
How it works:
On write to an SSTable, the key is hashed by several hash functions, setting several bits in the array.
On read, the same hashes are checked: if any bit is 0 the key is definitely absent; if all are 1 it's probably present.
The problem it solves:
Because a row can live in many SSTables, a read would otherwise probe every file; the filter narrows it to only the SSTables that might hold the key.
It lives in memory, so the check is fast and cheap.
Key trade-offs:
False positives are possible (says present when absent), causing a wasted lookup; false negatives are impossible.
Lower false-positive probability (bloom_filter_fp_chance) means more accuracy but more heap memory.
Q93.What is a Memtable, and what happens when it's full?
Memtable, and what happens when it's full?A Memtable is an in-memory, per-table write buffer that stores recently written data sorted by clustering key. When it reaches a threshold it is flushed to disk as an immutable SSTable.
What it is:
An in-memory structure that receives every write (paired with the commit log for durability).
Writes to the same cell are merged in memory, so it holds the current in-memory view of recent mutations.
What triggers a flush: Reaching a memory/size threshold (memtable_cleanup_threshold, heap pressure), a time limit, or an explicit nodetool flush.
What happens on flush:
The Memtable is written out sequentially as a new immutable SSTable.
The associated commit log segments become eligible for recycling since data is now safely on disk.
A fresh empty Memtable takes over incoming writes with no downtime.
Q94.How does Cassandra use SSTables and what is their role in the data lifecycle?
SSTables and what is their role in the data lifecycle?SSTables (Sorted String Tables) are Cassandra's immutable, on-disk data files: once a memtable is flushed, it becomes an SSTable that is never modified, only merged and eventually replaced through compaction.
Immutable on-disk storage:
Data written to a memtable is flushed to an SSTable when the memtable fills up or is triggered; the SSTable is read-only from then on.
Because they never change, no in-place updates or locking are needed, making writes and reads sequential and fast.
Sorted and indexed: Rows are stored sorted by partition token/clustering, enabling efficient range scans and binary-search-style lookups via the partition index.
Multiple SSTables per table: An update or delete goes to a new SSTable, so a single partition's data may be spread across several SSTables and reconciled at read time by timestamp.
Compaction is the lifecycle glue: Periodically merges SSTables, discards obsolete versions and expired tombstones, and writes a new consolidated SSTable, keeping reads efficient.
Companion files: Each SSTable ships with a bloom filter, partition index, summary, and statistics that accelerate the read path.
Q95.What happens when a Cassandra node restarts, and how does commit log replay ensure durability?
On restart, any writes that were in the memtable but not yet flushed to an SSTable are recovered by replaying the commit log, so acknowledged writes are never lost even though memtables are volatile.
The durability contract: Every write is appended to the commit log (on disk) before the write is acknowledged, and also applied to the memtable.
What a crash loses: The memtable lives in RAM, so unflushed data vanishes on restart; the commit log survives on disk.
Commit log replay on startup:
The node replays commit log segments to rebuild the lost memtable state, then resumes normal operation.
Segments are discarded once their data has been safely flushed to SSTables, so only unflushed mutations are replayed.
Other startup work: The node also reloads SSTables and rejoins the cluster via gossip, catching up on missed data through hinted handoff and repair.
Q96.What is the purpose of nodetool repair, and why is it important to run it regularly?
nodetool repair, and why is it important to run it regularly?nodetool repair reconciles data across replicas so every replica for a given key agrees: it uses Merkle trees to detect and stream missing or divergent data. It's essential because Cassandra's eventual consistency lets replicas drift over time.
Purpose: anti-entropy: Builds Merkle trees per replica, compares them, and streams only mismatched ranges to make replicas consistent.
Why run it regularly:
Hinted handoff and read repair are best-effort and can miss updates (e.g. node down longer than the hint window).
Critical for deletes: repair must run within gc_grace_seconds so tombstones propagate before they're purged, otherwise deleted data can resurrect.
Cadence: At least once per gc_grace_seconds (default 10 days) on every node, typically automated via a tool like Reaper.
Q97.What is the difference between full and incremental repair?
Full repair compares and reconciles all data in the token range every time; incremental repair marks already-repaired SSTables so subsequent runs only inspect new, unrepaired data.
Full repair: Builds Merkle trees over the entire dataset each run: thorough but expensive in CPU, disk, and streaming.
Incremental repair:
Separates repaired from unrepaired SSTables using a repairedAt marker, so each run only processes data written since the last repair.
Much faster on large datasets, but historically has had anti-compaction overhead and correctness edge cases.
Practical choice: Incremental for routine efficiency; periodic full repairs (or subrange full repairs via Reaper) to guard against drift and marker issues.
Q98.Why does reading past accumulated tombstones cause performance problems?
Reads must scan and collect tombstones alongside live cells to decide the correct current value, so a query that spans thousands of tombstones does a lot of extra work and holds more memory, even though it may return few or no live rows.
Tombstones are read, not skipped: The coordinator/replica must materialize tombstones to know what's deleted before merging results, consuming CPU and heap.
Range/slice queries suffer most: A partition with many deleted rows (or a queue-like access pattern) forces scanning past long runs of tombstones to find live data.
Symptoms: High read latency, GC pressure, and eventually queries aborted by the tombstone failure threshold.
Anti-patterns: Using Cassandra as a queue, frequently overwriting collections, or inserting nulls (which create tombstones).
Q99.How does compression work in Cassandra, and what are the trade-offs of enabling it on tables?
Cassandra compresses SSTable data on disk in fixed-size chunks, decompressing on read; it trades a small CPU cost for large savings in disk space and I/O, and it is enabled by default on most tables.
How it works:
Data is written in chunks of chunk_length_in_kb (default 16KB in 5.0) and each chunk is compressed independently.
A compression offset map lets reads decompress only the needed chunk rather than the whole file.
Configured per table via the compression option, choosing an algorithm class like LZ4Compressor, SnappyCompressor, ZstdCompressor, or DeflateCompressor.
Benefits:
Less disk usage and fewer bytes read from disk, often improving read throughput on I/O-bound workloads.
LZ4 gives near-free compression: very fast with decent ratios, hence the default.
Tradeoffs:
CPU overhead for compress/decompress; heavier algorithms (Zstd, Deflate) give better ratios but cost more CPU/latency.
Chunk size is a tradeoff: larger chunks compress better but force reading more data per point lookup; smaller chunks favor random reads.
For already-compressed or tiny-value data, compression may add cost with little gain, so it can be disabled.
Q100.How do you scale a Cassandra cluster?
Cassandra scales horizontally: you add more nodes to increase capacity and throughput linearly, and its masterless design plus consistent hashing distributes data and load automatically as the ring grows.
Scale out, not up:
Add commodity nodes rather than buying bigger machines; each node owns a share of the token ring.
With virtual nodes (num_tokens), a new node picks up many small ranges, spreading streaming load evenly.
How adding capacity works:
Bootstrap nodes one at a time; each streams in its portion of data, then run nodetool cleanup on the rest.
Throughput grows roughly linearly since reads/writes spread across more replicas.
Scale across regions/DCs: Use NetworkTopologyStrategy to add data centers for geographic scaling and locality, with per-DC replication factors.
Practical considerations:
Good data modeling (even partition distribution) is prerequisite: hot partitions defeat horizontal scaling.
Plan capacity ahead: bootstrapping is I/O intensive, so scale before you are saturated.
Q101.How do backups and restores work in Cassandra with snapshots and incremental backups?
Backups in Cassandra are file-based: a snapshot creates hard links to current SSTables at a point in time, and incremental backups hard-link each new SSTable as it is flushed; restore means placing those SSTable files back and loading them.
Snapshots:
nodetool snapshot creates hard links to live SSTables under a snapshots/ directory, so they take almost no extra space initially and no data is copied.
They are point-in-time and node-local; a cluster backup means snapshotting every node.
Clear them with nodetool clearsnapshot since retained links prevent old SSTables from being deleted and consume disk over time.
Incremental backups:
Enabled via incremental_backups: true; each newly flushed SSTable is hard-linked into a backups/ directory.
Combine a base snapshot plus subsequent incrementals to reconstruct state without repeated full snapshots.
Restore options:
Copy SSTable files back into the table directory and restart / nodetool refresh to load them.
Or use sstableloader to stream a backup into a cluster with possibly different topology.
Caveat: Backups are per-node and not globally consistent in time; ship the files off-box (they are only hard links locally) and typically pair with a repair after restore.
Q102.What is the purpose of nodetool cleanup, and when should you run it?
nodetool cleanup, and when should you run it?nodetool cleanup removes data a node no longer owns after the token ranges have changed, reclaiming disk space; you run it on existing nodes after adding new nodes (or otherwise changing ownership).
What it does: Rewrites SSTables and drops rows whose tokens now belong to other nodes, since bootstrapping a new node reassigns ranges but old owners keep their copies until cleanup.
When to run it:
After adding nodes or changing num_tokens/topology, run it on the pre-existing nodes to reclaim space.
Not needed on a routine basis and not after decommission/removenode (those already redistribute correctly).
Cautions:
It is I/O intensive (a full SSTable rewrite per table), so run during low traffic and one node at a time.
Never run it before the RF is satisfied elsewhere: only run once new nodes have finished bootstrapping.
Q103.What are some common performance tuning techniques for Cassandra?
Cassandra performance tuning is mostly about designing data around queries, spreading load evenly, and matching consistency and hardware to the workload. Most wins come from data modeling and configuration rather than raw hardware.
Data modeling:
Model one table per query and choose partition keys that spread data evenly to avoid hotspots.
Keep partitions bounded in size to prevent slow reads and GC pressure.
Consistency and replication: Use the lowest consistency level that meets requirements (e.g. LOCAL_QUORUM) to reduce cross-node coordination.
Compaction strategy: Match strategy to workload: STCS for write-heavy, LCS for read-heavy, TWCS for time-series/TTL data.
Caching and Bloom filters: Tune key cache and Bloom filter false-positive rate to cut disk seeks.
JVM and OS:
Size the heap correctly, tune GC (G1), and leave RAM for the OS page cache.
Use fast local SSDs and separate commit log from data if on spinning disks.
Client side: Use prepared statements, token-aware routing, and appropriate batching (only same-partition batches).
Q104.What are the key metrics you monitor in a Cassandra cluster?
Monitor metrics across four areas: latency, throughput, resource utilization, and internal health (compaction, GC, dropped messages). These reveal both user-facing slowness and impending cluster problems.
Latency: Read and write latency percentiles (p50/p95/p99) per table; watch tails, not averages.
Throughput: Read/write request rates and coordinator-level operation counts.
Thread pools and dropped messages: From nodetool tpstats: pending/blocked tasks and dropped mutations signal overload.
Compaction and SSTables: Pending compactions and SSTables-per-read; growth means read latency will rise.
JVM/GC: GC pause frequency and duration; long pauses cause timeouts and flapping.
System resources: CPU, disk I/O and utilization, heap usage, and network.
Cluster state: Hints stored (indicates unavailable replicas) and pending/failed repairs.
Q105.What are the recommended limits on partition size in Cassandra, and what happens if you exceed them?
As a rule of thumb, keep partitions under 100 MB and ideally below 100,000 cells (rows × columns). These aren't hard limits, but exceeding them degrades performance and can eventually cause node instability.
Recommended guidelines:
Target well under 100 MB per partition and roughly 100,000 cells maximum.
Fewer, evenly-sized partitions beat a handful of giant ones.
What goes wrong when exceeded:
Slow reads: the whole partition must be read/merged from SSTables, raising latency.
Heap and GC pressure: large partitions are held in memory during reads and compaction, risking long pauses or OOM.
Hotspots: a huge partition lives on one set of replicas, overloading those nodes and unbalancing the ring.
Compaction strain: compacting large partitions is expensive and can back up.
How to fix:
Add a bucketing component (e.g. date/hash) to the partition key to split large partitions.
Monitor with nodetool tablehistograms to catch growth early.
Q106.How do Guardrails in Cassandra help avoid configuration and usage pitfalls?
Guardrails are configurable limits and toggles that warn on or reject risky configurations and queries, protecting a cluster from patterns known to cause instability.
What they enforce:
Schema and data limits: max columns per table, max collection size, max number of tables/keyspaces.
Query safety: blocking unbounded ALLOW FILTERING, large IN clauses, or reads with no LIMIT.
Feature toggles: disallowing dangerous features like user-defined functions or dropping/truncating tables.
Warn vs fail thresholds: Many guardrails support a soft warning threshold and a hard failure threshold, so operators can observe before enforcing.
Why it matters:
It shifts protection from tribal knowledge to enforced policy, catching anti-patterns (wide partitions, expensive scans) before they cause outages.
Configured centrally in cassandra.yaml and manageable at runtime, so guardrails apply consistently across all clients.
Q107.How does authentication and authorization work in Cassandra, and what are roles?
Cassandra separates authentication (proving who you are), authorization (what you may do), and roles (the entity that holds permissions and can log in). All three are pluggable and configured in cassandra.yaml.
Authentication: Controlled by the authenticator; the default AllowAllAuthenticator is open, while PasswordAuthenticator validates username/password stored in the system_auth keyspace.
Authorization: Controlled by the authorizer; CassandraAuthorizer enforces permissions granted via GRANT/REVOKE on resources (keyspaces, tables).
Roles (RBAC):
A role unifies the old concepts of user and permission set; it can have a password and LOGIN capability, or be a pure permission bundle.
Roles can be granted to other roles, so permissions are inherited hierarchically (e.g. grant analyst to a user).
Important caveat: Set system_auth replication appropriately (e.g. NetworkTopologyStrategy across DCs) or auth data becomes unavailable during node loss.
Q108.How do modern databases like Cassandra address the challenges posed by the CAP theorem?
Cassandra address the challenges posed by the CAP theorem?Cassandra treats CAP as a spectrum rather than a binary choice: it is fundamentally an AP system (available and partition-tolerant) but offers tunable consistency so you can trade toward stronger consistency per query.
CAP forces a choice during a partition: When nodes can't communicate you must pick availability or consistency; partition tolerance is non-negotiable in a distributed system.
Cassandra defaults toward AP: No single master: any replica can serve reads/writes, so the cluster stays available even when some nodes are down.
Tunable consistency per operation:
You set consistency levels like ONE, QUORUM, or ALL independently for reads and writes.
If read CL + write CL > replication factor (e.g. both QUORUM), you get strong consistency for those operations.
Eventual consistency with repair mechanisms: Hinted handoff, read repair, and anti-entropy repair reconcile divergent replicas over time.
PACELC nuance: Even without a partition, Cassandra trades latency for consistency: lower CL means faster responses.
Q109.How does Cassandra compare to a relational database or other NoSQL databases (MongoDB, HBase, DynamoDB) in terms of data model, consistency, and use cases?
Cassandra compare to a relational database or other NoSQL databases (MongoDB, HBase, DynamoDB) in terms of data model, consistency, and use cases?Cassandra is a wide-column, masterless, AP store optimized for write-heavy, high-availability workloads at scale, differing sharply from relational databases (normalized, ACID, joins) and from other NoSQL systems in its peer-to-peer architecture and query-first data modeling.
vs. Relational (PostgreSQL, MySQL):
Data model: relational normalizes and joins; Cassandra denormalizes and models tables per query.
Consistency: RDBMS is strongly ACID; Cassandra is tunable/eventual with no cross-partition transactions.
Use case: RDBMS for complex queries and integrity; Cassandra for massive scale and always-on writes.
vs. MongoDB:
MongoDB is document-based with a single-primary replica set (CP-leaning); Cassandra is wide-column and masterless (AP-leaning).
MongoDB has richer ad-hoc querying and secondary indexes; Cassandra favors predictable partition-key access.
vs. HBase:
Both wide-column; HBase is CP, master-based, and depends on HDFS and ZooKeeper.
Cassandra is easier to operate (no external dependencies) and more available.
vs. DynamoDB: Similar Dynamo-derived design; DynamoDB is fully managed and cloud-locked (AWS), Cassandra is open-source and deployable anywhere.
Q110.Compare Apache Cassandra with Amazon DynamoDB in terms of architecture, data model, consistency models, scalability strategies, use cases, and pros and cons.
Apache Cassandra with Amazon DynamoDB in terms of architecture, data model, consistency models, scalability strategies, use cases, and pros and cons.Both descend from Amazon's Dynamo paper and share a masterless, partitioned, wide-column philosophy, but Cassandra is self-managed open source while DynamoDB is a fully managed AWS service, which drives most of the practical trade-offs.
Architecture:
Cassandra: peer-to-peer ring, consistent hashing, you run and tune the nodes.
DynamoDB: managed, serverless; AWS hides nodes and handles partitioning automatically.
Data model:
Both key-based wide-column with partition + clustering/sort keys; Cassandra uses CQL, DynamoDB uses its own API/PartiQL.
DynamoDB tops out flexibility with GSIs/LSIs; Cassandra uses additional tables/materialized views.
Consistency:
Cassandra: tunable per query (ONE/QUORUM/ALL).
DynamoDB: choose eventual or strongly consistent reads (per-request flag).
Scalability:
Cassandra: add nodes manually; you own capacity planning.
DynamoDB: auto-scaling or on-demand capacity, pay per throughput/storage.
Use cases:
Cassandra: multi-cloud/on-prem, avoiding vendor lock-in, huge write volumes.
DynamoDB: AWS-native apps wanting zero ops.
Pros/cons:
Cassandra pro: portable, no lock-in; con: operational burden.
DynamoDB pro: no ops, deep AWS integration; con: lock-in, cost can spike at scale.
Q111.How does Cassandra relate to ScyllaDB and what makes ScyllaDB Cassandra-compatible?
Cassandra relate to ScyllaDB and what makes ScyllaDB Cassandra-compatible?ScyllaDB is a C++ reimplementation of Cassandra designed as a drop-in replacement: it speaks the same CQL and wire protocol so existing clients work, but rewrites the engine for far higher per-node throughput and lower latency.
What makes it compatible:
Implements the CQL query language and the Cassandra binary protocol, plus SSTable file format and Thrift, so drivers and tools connect unchanged.
Same data model concepts: keyspaces, tables, partition/clustering keys, tunable consistency.
Where it differs under the hood:
Written in C++ on the Seastar framework (shared-nothing, thread-per-core) instead of the JVM, avoiding GC pauses.
Own I/O and memory management targeting the hardware directly, so fewer nodes deliver the same load.
Practical relationship:
Positioned as a performance-focused alternative; migration is often config-level rather than a rewrite.
Caveat: feature parity can lag on the newest Cassandra features, so verify version-specific compatibility.
Q112.What are common failure modes and anti-patterns in Cassandra, such as large partitions, too many tombstones, secondary-index misuse, and SELECT with ALLOW FILTERING?
Cassandra, such as large partitions, too many tombstones, secondary-index misuse, and SELECT with ALLOW FILTERING?Most Cassandra pain comes from modeling against its storage engine incorrectly: unbounded partitions, tombstone buildup from deletes/TTLs, misused secondary indexes, and full-cluster scans triggered by ALLOW FILTERING. These degrade latency and availability at scale.
Large ("hot" or unbounded) partitions:
A partition key that keeps accumulating rows causes huge partitions, slow reads, GC pressure, and uneven load.
Fix: bucket by time or add a synthetic key component to bound partition size.
Too many tombstones:
Deletes and TTL expirations create tombstones that must be scanned until compaction removes them (after gc_grace_seconds).
Queuing patterns and frequent deletes trigger TombstoneOverwhelmingException; avoid delete-heavy models.
Secondary-index misuse:
Native secondary indexes on high-cardinality or low-cardinality columns scale poorly (they fan out across nodes).
Prefer a denormalized query table; consider SASI/SAI only for specific cases.
ALLOW FILTERING:
It lets a query run without hitting the partition key, forcing an expensive, unpredictable scan.
Treat it as a red flag: redesign the table so queries hit the partition key directly.
Other anti-patterns: Using Cassandra as a queue, doing read-before-write, or relying on BATCH across partitions (creates coordinator hotspots).
Q113.Explain the masterless, peer-to-peer architecture of Cassandra. Why is it designed this way?
Cassandra is masterless: every node is functionally identical, holds a share of the data, and communicates as an equal peer, so there is no leader to elect or lose. This is done to eliminate bottlenecks and single points of failure.
How it works:
Nodes form a ring; data is partitioned across them by consistent hashing of the partition key's token.
Nodes exchange state (membership, load, schema) via the gossip protocol, so every node learns the cluster topology.
Any node can accept any read or write and act as coordinator.
Why it's designed this way:
No master means no single point of failure and no failover election delays.
Write and read load spreads evenly, enabling linear scalability.
Symmetry simplifies scaling: add or remove nodes without reconfiguring a special role.
Q114.What is the primary consideration when determining the optimal number of nodes in a Cassandra cluster?
The primary driver is capacity and workload: how much data you must store and how much read/write throughput you need, balanced against per-node limits so no node is overloaded. Availability and replication requirements set the floor.
Data volume per node: Keep density within practical limits (commonly ~1TB per node depending on hardware) so compaction, repair, and rebuild stay manageable.
Throughput needs: More nodes spread read/write load; size for peak, not average.
Replication factor and consistency: You need at least as many nodes as your RF, and enough to satisfy quorum even during a node failure.
Fault tolerance: Enough nodes (and racks/DCs) so losing one doesn't breach your consistency or capacity targets.
Headroom: Plan spare capacity for growth and for compaction/repair overhead rather than running near full.
Q115.What are wide partitions or wide rows in Cassandra? What problems are associated with them, and how can they be mitigated?
A wide partition is one that accumulates a very large number of rows or bytes under a single partition key. Because a partition lives on one set of replicas and is read/compacted as a unit, oversized partitions cause hotspots, latency spikes, and memory pressure.
What causes them: A low-cardinality partition key or unbounded growth (e.g. all events for one sensor under one key forever).
Problems:
Hotspots: one node handles disproportionate load.
Latency and GC pressure reading/compacting huge partitions.
Rough guideline: keep partitions under ~100MB and ~100k rows.
Mitigations:
Bucketing: add a time or hash bucket to the partition key (e.g. sensor_id + day) to bound size.
Choose a higher-cardinality partition key.
Use clustering columns to organize rows within reasonably sized partitions.
Q116.How would you design a data model in Cassandra for a specific use case, considering query patterns and data relationships?
You design a Cassandra model by enumerating queries first, then creating a table per query with a primary key that supports its filtering and ordering, denormalizing data as needed and watching partition size. The relationships matter less than the access paths.
Step 1: list access patterns: e.g. "get latest messages in a chat room", "look up user by email".
Step 2: design one table per pattern:
Choose the partition key so reads hit one partition and load is spread evenly.
Choose clustering columns to match required sort order (e.g. by timestamp descending).
Step 3: validate partitions:
Avoid unbounded partitions: add a bucket (e.g. day) to the partition key if a partition grows without limit.
Avoid hotspots: don't pick low-cardinality or monotonically increasing keys.
Step 4: denormalize and manage duplication in the app or via batch writes.
Q117.How would you model time-series data effectively in Cassandra?
Model time-series data around the query first: partition by an entity plus a time bucket, and cluster by timestamp so recent readings live together on disk and can be range-scanned efficiently.
Partition by entity + time bucket: e.g. (sensor_id, day) so no single partition grows unbounded (prevents "wide partition" hotspots).
Cluster by timestamp descending: Use CLUSTERING ORDER BY (ts DESC) so newest data is first and reads are contiguous.
Write append-only, avoid updates: Each reading is a new row; this plays to Cassandra's fast sequential writes.
Use TTL for expiry: Set a TTL to auto-purge old data instead of manual deletes (which create tombstones).
Q118.Why is clock synchronization (NTP) important in a Cassandra cluster, and what can go wrong if clocks drift?
NTP) important in a Cassandra cluster, and what can go wrong if clocks drift?Cassandra resolves conflicting writes using "last write wins" based on each cell's timestamp, and by default nodes assign those timestamps from their own clocks. If clocks drift, a logically newer write can be discarded because a lagging clock made it look older.
Timestamps drive conflict resolution: For the same cell, the value with the highest timestamp wins, regardless of arrival order.
What drift causes:
Lost updates: a newer write with a smaller timestamp is silently overwritten by stale data.
"Zombie" resurrections: deletes (tombstones) can be out-ordered relative to writes.
Premature TTL expiry or rows that seem to time-travel.
The fix: Run NTP (or chrony) on every node against consistent sources to keep clocks within a few milliseconds.
Note: Clients can supply timestamps with USING TIMESTAMP, but that just moves the clock-accuracy burden to the client.
Q119.What is the durable_writes keyspace option, and what is the effect of disabling it?
durable_writes keyspace option, and what is the effect of disabling it?durable_writes is a per-keyspace boolean (default true) that controls whether writes to tables in that keyspace are logged to the commit log before being acknowledged. Disabling it skips the commit log, making writes slightly faster but risking data loss if a node crashes before the memtable is flushed.
With durable writes on (default): Each write is appended to the commit log (on disk) as well as the memtable, so it can be replayed after a crash.
With durable writes off:
Writes go only to the memtable; data not yet flushed to an SSTable is lost if the node restarts or crashes.
Gains a small amount of write throughput by avoiding commit-log I/O.
When it might be acceptable:
Purely transient or easily regenerated data, and only when replication across many nodes makes single-node loss tolerable.
Almost never recommended for production data you care about.
Q120.Explain the purpose and usage of User-Defined Functions (UDFs) and User-Defined Aggregates (UDAs) in Cassandra.
UDFs and UDAs let you push simple computation to the server side of CQL. A UDF transforms values within a single row (a scalar function), while a UDA combines a UDF across many rows to produce an aggregate result, similar to SUM or AVG.
User-Defined Functions (UDFs):
Operate per row on column values, returning a single value; written in Java or (optionally) JavaScript.
Created with CREATE FUNCTION; can be CALLED ON NULL INPUT or RETURNS NULL ON NULL INPUT.
User-Defined Aggregates (UDAs):
Built from a state UDF applied to each row plus an optional final UDF, with an initial state value (SFUNC, STYPE, FINALFUNC, INITCOND).
Let you compute custom aggregations the built-ins don't cover.
Important caveats:
Aggregation runs on the coordinator over data it gathers, so it's meant for single-partition scopes, not cluster-wide scans.
Disabled by default and gated by config (enable_user_defined_functions) due to security/sandboxing concerns; they run inside the server JVM.
Q121.What are virtual tables in Cassandra, and what kind of information do they expose?
Virtual tables are read-only, in-memory tables (introduced in Cassandra 4.0) that expose node-level metrics and configuration through normal CQL, instead of requiring JMX. They live in special keyspaces and are node-local.
Characteristics:
Read-only: you query them but cannot write to them (a few settings tables allow updates).
Node-local: results reflect the node you're connected to, not the whole cluster.
Not replicated or persisted to disk.
Keyspaces:
system_views: metrics and runtime state.
system_virtual_schema: schema/metadata about the virtual tables themselves.
What they expose: Settings and config, thread pool stats, cache and client connection info, sstable and compaction details, coordinator/local read-write latencies, and more.
Q122.Explain the purpose and limitations of Secondary Indexes in Cassandra. When would you use them, and what are the alternatives?
Secondary Indexes in Cassandra. When would you use them, and what are the alternatives?Q123.What are Storage-Attached Indexes (SAI) in Cassandra, and how do they improve on older secondary indexes?
Storage-Attached Indexes (SAI) in Cassandra, and how do they improve on older secondary indexes?Q124.How does Cassandra handle data consistency in a multi-datacenter environment, particularly with LOCAL_QUORUM and EACH_QUORUM?
LOCAL_QUORUM and EACH_QUORUM?Q125.How does the R + W > N rule provide strong consistency in Cassandra?
R + W > N rule provide strong consistency in Cassandra?Q126.How does Cassandra handle consistency when data is written to multiple nodes, and what trade-offs are involved?
Q127.How does the consistency level ANY relate to hinted handoff, and what are its risks?
ANY relate to hinted handoff, and what are its risks?Q128.What is the difference between SERIAL and LOCAL_SERIAL consistency in lightweight transactions?
SERIAL and LOCAL_SERIAL consistency in lightweight transactions?Q129.How do multi-datacenter operations and disaster recovery work in Cassandra?
Q130.Explain the Gossip protocol in Cassandra. What is its role, and how does it help with failure detection?
Q131.How does failure detection work in Cassandra and what is the phi accrual failure detector?
Q132.What is Hinted Handoff, and how does it contribute to write availability during temporary node failures?
Q133.Explain the Cassandra read path, detailing how data is retrieved from Memtables and SSTables.
Memtables and SSTables.Q134.Explain Read Repair (blocking and background). How does it help maintain data consistency?
Q135.How does Cassandra's LSM-tree storage engine work?
LSM-tree storage engine work?Q136.What are Read Amplification and Write Amplification in the context of Cassandra's storage engine?
Q137.What role do bloom filters, partition index, summary, and key/row cache play in the read path?
Q138.What are digest read requests, and how does the coordinator use them during a read?
Q139.Explain the concept of Tombstones in Cassandra. Why are deletes essentially writes, and how do tombstones impact read performance and disk space?
Q140.What is anti-entropy Repair in Cassandra, and how do Merkle trees and the nodetool repair process work?
nodetool repair process work?Q141.What is gc_grace_seconds, and why is it critical to run repairs within this period, especially concerning tombstones?
gc_grace_seconds, and why is it critical to run repairs within this period, especially concerning tombstones?Q142.Explain delete semantics in Cassandra — why deletes are writes, tombstone accumulation, and gc_grace_seconds.
gc_grace_seconds.Q143.How does tombstone-aware compaction help reclaim space, and what is a single-SSTable tombstone compaction?
Q144.What is subrange repair, and why might you use a tool like Cassandra Reaper to schedule repairs?
Q145.What are the tombstone_warn_threshold and tombstone_failure_threshold, and how do they protect the cluster?
tombstone_warn_threshold and tombstone_failure_threshold, and how do they protect the cluster?Q146.What is Compaction in Cassandra? Explain the different compaction strategies and when to choose each.
Q147.Explain the Unified Compaction Strategy in Cassandra 5.0 and discuss its benefits and tradeoffs.
Q148.Discuss the strategies for handling data compaction conflicts in Cassandra, including tombstone-aware strategies.
Q149.How do you add, remove, or replace nodes in a Cassandra cluster and what happens during bootstrapping/streaming?
Q150.What is the difference between decommissioning a node and using removenode?
removenode?Q151.Explain token-aware and datacenter-aware load balancing policies in Cassandra client drivers. Why are they important?
Q152.How would you troubleshoot slow queries in Cassandra?
Q153.How can you optimize Cassandra for write-heavy workloads?
Q154.What are retry and speculative-execution policies in Cassandra clients?
Q155.What is the difference between key cache and row cache, and why can the row cache be dangerous?
key cache and row cache, and why can the row cache be dangerous?Q156.How does speculative execution improve tail latency in Cassandra reads?
Q157.Explain the CIDR Authorizer feature in Cassandra 5.0 and how it enhances security.
Q158.What options does Cassandra provide for encryption in transit and at rest?
Q159.What is Change Data Capture (CDC) in Cassandra, and what is it used for?
Q160.Explain lightweight transactions (compare-and-set via Paxos) and the SERIAL consistency level in Cassandra.
SERIAL consistency level in Cassandra.Q161.Explain the difference between logged and unlogged batches in Cassandra. When should you use a batch, and when can it hurt performance?
Q162.Why does SSTable corruption happen in Cassandra, and what is Cassandra's default disk failure policy when corruption is detected?
SSTable corruption happen in Cassandra, and what is Cassandra's default disk failure policy when corruption is detected?Q163.Describe the process of recovering a Cassandra node that has encountered corrupted SSTables.
SSTables.