Database / ScyllaDB Interview questions
1. What is ScyllaDB?
ScyllaDB is a distributed, wide-column NoSQL database built in C++ as a drop-in replacement for Apache Cassandra, designed to squeeze far more throughput out of the same hardware. It re-implements Cassandra's data model and wire protocol from scratch on top...
2. What are the key features of ScyllaDB?
ScyllaDB's design goals center on extracting maximum throughput per node while keeping the operational model familiar to Cassandra users. Shard-per-core architecture - each CPU core owns its own data and connections, avoiding lock contention....
3. What is the shard-per-core architecture in ScyllaDB?
Shard-per-core means each CPU core on a node runs an independent, single-threaded execution engine that owns a dedicated slice of RAM, a dedicated set of data (by token range), and its own network connections. Instead of one process sharing memory...
4. Define a partition key in ScyllaDB?
A partition key is the portion of a table's primary key that determines which node(s) store a given row, by hashing the key value into a token that maps to a range owned by a specific replica set. Every row...
5. What is a clustering key in ScyllaDB?
A clustering key is the part of the primary key that comes after the partition key and determines how rows within the same partition are sorted on disk. Where the partition key decides which node holds the data, the clustering...
6. What are the data types supported by ScyllaDB?
ScyllaDB, following CQL, supports a broad set of scalar and collection types for schema design: text / varchar, ascii - string data. int, bigint, smallint, tinyint, varint - integer types of varying width....
7. Describe the Seastar framework used by ScyllaDB?
Seastar is the open-source C++ asynchronous programming framework, originally built for ScyllaDB, that underlies its shard-per-core, high-performance design. Seastar provides a future-promise concurrency model, its own userspace network stack and memory allocator, and asynchronous I/O so applicat
8. What are the types of consistency levels in ScyllaDB?
ScyllaDB, like Cassandra, offers tunable consistency, letting each read or write specify how many replicas must acknowledge before the operation succeeds. Level Meaning ONE / TWO / THREE That exact number of replicas must respond....
9. List the compaction strategies available in ScyllaDB?
Compaction merges SSTables together to remove obsolete data and reduce read amplification; ScyllaDB supports several strategies suited to different workloads. Size-Tiered Compaction Strategy (STCS) - merges similarly-sized SSTables together; good default for write-heavy workloads.
10. How do you create a table in ScyllaDB?
Tables are created with standard CQL CREATE TABLE statements through cqlsh , a driver, or ScyllaDB's REST/CQL tooling, specifying the partition key and any clustering columns as part of the primary key. CREATE TABLE ecommerce.orders ( customer_id uuid, order_id timeuuid,...
11. What is a materialized view in ScyllaDB?
A materialized view is a server-managed table that automatically re-derives its rows from a base table using a different primary key layout, letting the same data be queried efficiently by a column that isn't part of the base table's partition...
12. Explain the purpose of the commit log in ScyllaDB?
The commit log is an append-only, on-disk log that ScyllaDB writes to before acknowledging any write, purely for crash recovery. Every mutation is appended sequentially to the commit log at the same time it's applied to the in-memory memtable, so...
13. What is ScyllaDB Alternator?
Alternator is ScyllaDB's implementation of the DynamoDB HTTP API, letting applications written against AWS DynamoDB's SDKs point at a ScyllaDB cluster instead, with no application code changes beyond the endpoint URL. aws dynamodb list-tables --endpoint-url http://scylla-node:8000 It supports Dyn
14. How do you apply TTL to data in ScyllaDB?
Time-to-live (TTL) can be set per-write in seconds, either on an individual INSERT / UPDATE statement or as a table-wide default, after which the data is automatically marked for deletion. INSERT INTO sessions (session_id, user_id, data ) VALUES (uuid(), 'user123'...
15. What is ScyllaDB Manager?
ScyllaDB Manager is a centralized operations tool for automating and scheduling cluster-wide maintenance tasks that would otherwise need to be run manually node by node, such as repairs, backups, and rolling restarts. Automated repair scheduling - runs anti-entropy repairs on...
16. Why doesn't ScyllaDB rely on a JVM?
Cassandra runs on the JVM, which means its performance is subject to garbage collection pauses: periodically the JVM has to stop application threads to reclaim memory, and under heavy load or large heaps these "stop-the-world" pauses can spike into hundreds...
17. How does ScyllaDB achieve linear scalability per node?
Per-node scalability in ScyllaDB comes from combining the shard-per-core architecture with a design that avoids shared, contended state as core counts grow. Each core runs its own shard with its own memtable, cache, and connections, so adding cores adds independent...
18. What is the difference between ScyllaDB and Apache Cassandra?
ScyllaDB Apache Cassandra Written in C++ on the Seastar framework. Written in Java, runs on the JVM....
19. When should you use a local secondary index versus a global one?
A local secondary index is stored on the same node as the base data it indexes, so a query using it can only be efficiently satisfied by first knowing (or scanning across) the partition, making it most useful when the...
20. What happens when a wide partition forms in ScyllaDB?
A wide partition occurs when a single partition key accumulates an unusually large number of rows or a very large amount of data, often from a low-cardinality key or unbounded time-series growth without bucketing. Because a partition is the unit...
21. How is data replicated across nodes in ScyllaDB?
ScyllaDB uses consistent hashing to map each partition key to a token, and that token determines a position on a logical ring of token ranges spread across the cluster's nodes. Each token range is owned by a set of replicas...
22. Why should you avoid large batch statements in ScyllaDB?
CQL's BATCH statement groups multiple writes together, but unless every statement in the batch shares the same partition key, ScyllaDB has to coordinate the batch as a distributed operation across multiple partitions, which adds a lot of overhead compared to...
23. What is the difference between ScyllaDB and DynamoDB?
ScyllaDB DynamoDB Self-managed or ScyllaDB Cloud; deployable anywhere. Fully managed, AWS-only.
24. How does ScyllaDB handle node failure with hinted handoff?
When a write's coordinator can't reach one of the replicas responsible for storing it, perhaps because that node is temporarily down or unreachable, ScyllaDB can store a hint : a record of the missed write, kept on a live node...
25. When would you choose LOCAL_QUORUM over QUORUM?
QUORUM requires a majority of replicas across all datacenters to respond, which means every read or write pays a cross-datacenter network round trip, even when the application only cares about consistency within its own region. LOCAL_QUORUM requires a majority only...
26. How can you optimize write performance in ScyllaDB?
Design partition keys to avoid hotspots - uneven key distribution caps throughput on a few nodes regardless of cluster size. Use a shard-aware driver so writes go directly to the owning shard, avoiding an internal network hop....
27. What is the difference between memtables and SSTables?
Memtable SSTable In-memory, mutable structure holding recent writes. Immutable, on-disk file holding flushed data....
28. Why do we use tombstones in ScyllaDB?
Because SSTables are immutable once written, ScyllaDB can't simply erase a row or column in place the way an update-in-place database would. Instead, a delete (explicit, or implicit via TTL expiration) is recorded as a tombstone , a special marker...
29. How does ScyllaDB's shard-aware driver route requests?
A shard-aware driver understands not just which node owns a given partition key, via the same token-ring logic every driver uses, but which specific CPU shard on that node owns it, since ScyllaDB partitions data by core within a node...
30. What is the difference between STCS and LCS compaction?
Size-Tiered (STCS) Leveled (LCS) Merges SSTables of similar size together. Organizes SSTables into size-bounded levels.
31. When should you use lightweight transactions in ScyllaDB?
Lightweight transactions (LWT), expressed with IF clauses like INSERT IF NOT EXISTS or UPDATE IF column = value , provide linearizable compare-and-swap semantics using a Paxos-based consensus protocol among replicas, rather than the normal fire-and-acknowledge write path. UPDATE inventory
32. How is repair implemented in ScyllaDB?
Repair is ScyllaDB's anti-entropy process for reconciling data drift between replicas that can build up from missed writes, expired hints, or clock/network issues. It compares data across replicas, typically using Merkle trees, hash-tree structures that let two replicas efficiently find...
33. Why doesn't ScyllaDB support arbitrary ad-hoc joins?
ScyllaDB is architected so that any single query can be efficiently routed and answered by the specific node(s) owning the relevant partition, keeping latency predictable at scale. An arbitrary join across two large tables would require correlating data that could...
34. What is the difference between ScyllaDB tablets and vnodes?
Vnodes (legacy) Tablets (newer architecture) Fixed number of token ranges assigned per node at join time. Dynamically sized, independently balanced units of data per table....
35. How do you troubleshoot high read latency in ScyllaDB?
Check for wide partitions - a large partition takes longer to scan and can dominate latency for that key. Check tombstone counts in query tracing - excessive tombstones force reads to skip past dead data....
36. Explain the internal working of the Seastar future-promise model?
Seastar's concurrency model is built around futures (a placeholder for a value that will eventually be ready) and promises (the producer side that eventually fulfills that value), composed together instead of using blocking calls or OS-level thread synchronization. sequenceDiagram participant...
37. Explain the execution flow of a write request in ScyllaDB?
A write in ScyllaDB moves from client to coordinator to replicas, with durability and consistency handled at distinct points along the way. flowchart TD A[Client sends write] --> B[Coordinator node receives request] B --> C[Coordinator computes token, identifies replicas] C...
38. Explain the lifecycle of an SSTable in ScyllaDB?
An SSTable's life begins in memory and ends when its data is either merged into a newer SSTable or fully expired and removed. flowchart LR A[Writes land in memtable] --> B[Memtable fills / flush triggered] B --> C[Memtable flushed to...
39. How does ScyllaDB guarantee strongly consistent schema changes using Raft?
Older versions of ScyllaDB (and Cassandra) propagated schema changes via gossip, an eventually-consistent protocol, which could momentarily leave different nodes with slightly different views of the schema during a rollout, an acceptable risk for schema but not ideal. ScyllaDB has...
40. What happens internally when ScyllaDB performs compaction?
Compaction reads several existing SSTables, merges their contents row by row, and writes the result as new, consolidated SSTables, all while the affected data remains readable and writable through the process. flowchart TD A[Compaction strategy selects candidate SSTables] --> B[Open...
41. How can you optimize a multi-datacenter ScyllaDB deployment for latency?
Use LOCAL_QUORUM (or ONE/LOCAL_ONE) for regular application traffic so requests don't pay cross-datacenter round trips. Set NetworkTopologyStrategy replication per-datacenter so each region has enough local replicas to satisfy local consistency without depending on a remote datacenter.
42. Which is better and why: LOCAL_QUORUM or ONE for a globally distributed app?
Neither is universally better; the choice trades off consistency strength against latency and availability, and the right answer depends on what the read or write is for. ONE LOCAL_QUORUM Fastest possible latency; only one replica must respond....
43. How does token-aware routing improve latency in ScyllaDB?
Without token awareness, a driver sends a request to an arbitrary node, which then has to act as a coordinator and forward the request to whichever node(s) actually own the relevant data, adding an extra network hop before the "real"...
44. Why is the gossip protocol critical to ScyllaDB's cluster membership?
In a large peer-to-peer cluster with no central coordinator for membership, every node needs a way to learn which other nodes exist, whether they're alive, and their basic state (load, schema version, token ownership) without a single point of failure...
45. How do you troubleshoot compaction backlog in ScyllaDB?
Check pending compaction metrics in the Monitoring Stack - a steadily growing backlog means compaction can't keep pace with incoming writes. Review the compaction strategy fit - STCS under heavy, uneven write patterns can lag; LCS or ICS may handle...
46. Explain the internal working of ScyllaDB's read path?
A read has to reconstruct the current value of a row from potentially several places at once, since data for one partition can be spread across the memtable and multiple SSTables. flowchart TD A[Coordinator receives read] --> B[Identify replicas for...
47. What happens when a node becomes unavailable in a ScyllaDB cluster?
Because data is replicated across multiple nodes per the table's replication factor, a single node going down doesn't make its data unavailable - the remaining replicas for its token ranges continue serving reads and writes. Other nodes' failure detectors (built...
48. How does ScyllaDB implement Change Data Capture internally?
When CDC is enabled on a table, ScyllaDB automatically creates a companion log table alongside it, and every insert, update, or delete on the base table also writes a corresponding row into that log table describing the change, as part...
49. Explain the execution flow of a lightweight transaction in ScyllaDB?
A lightweight transaction (LWT) needs every replica involved to agree on both the current value and the outcome of the conditional check before anything is applied, so it runs a Paxos round instead of the normal single-phase write path. sequenceDiagram...
50. How can you optimize schema design to avoid wide partitions at scale?
Bucket time-series data by a natural window (hour/day) appended to the partition key, so one logical entity's data spreads across many bounded partitions instead of one unbounded one. Add a synthetic bucket suffix (e.g....