Search code examples
cassandracassandra-2.0cassandra-clinosql

Is update in place possible in Cassandra?


I have a table in Cassandra where I populate some rows with 1000s of entries (each row is with 10000+ columns). The entries in the rows are very frequently updated, basically just a field (which is an integer) is updated with different values. All other values for the columns remains unmodified. My question is, will the updates be done in-place ? How good is Cassandra for frequent update of entries ?


Solution

  • Initially these updates are stored in an in-memory data structure called Memtable. Memtables are flushed to immutable SSTables at regular intervals.

    So a single wide row will be read from various SSTables. It is during a process called 'compacation' the different SSTables will be merged into a bigger SSTable on the disk.

    Increasing thresholds for flushing Memtables is one way of optimization. If updates are coming very fast before Memtable is flushed to disk, i think that update should be in-place in memory, not sure though.

    Also each read operation checks Memtables first, if data is still there, it will be simply returned – this is the fastest possible access.

    Cassandra read path:

    When a read request for a row comes in to a node, the row must be combined from all SSTables on that node that contain columns from the row in question

    Cassandra write path: