Tamil
Tamil

Reputation: 5358

cassandra reads across multiple read requests

Does Cassandra use concurrent threads to read sstables of a column family to serve a read request for a row key or an individual worker thread does the job of look up across multiple sstables?

What would be the overhead of the one over the other [using concurrent threads and single thread]?

Upvotes: 1

Views: 444

Answers (1)

APZ
APZ

Reputation: 354

Cassandra implements a Staged Event-Driven Architecture (SEDA) see SEDA

In a typical application, a single unit of work is often performed within the confines of a single thread. A write operation, for example, will start and end within the same thread. Cassandra, however, is different: its concurrency model is based on SEDA, so a single operation may start with one thread, which then hands off the work to another thread, which may hand it off to other threads. But it’s not up to the current thread to hand off the work to another thread. Instead, work is subdivided into what are called stages, and the thread pool (really, a java.util.concurrent.ExecutorService) associ- ated with the stage determines execution. A stage is a basic unit of work, and a single operation may internally state-transition from one stage to the next. Because each stage can be handled by a different thread pool, Cassandra experiences a massive perform- ance improvement. Read is represented as a stage in cassandra so there are definitely multiple threads involved in the Read stage, you would have to look deeper in the source code to understand whether multiple thread in read stage are used for reading or no.

Upvotes: 1

Related Questions