In Cassandra, When the data is read for the first time from sstable, will the data be stored in row cache for the immediate access when it is read again?
What happens if the data in row cache is updated or deleted?
GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.
In Cassandra, When the data is read for the first time from sstable, will the data be stored in row cache for the immediate access when it is read again?
What happens if the data in row cache is updated or deleted?
Hi,
if row caching is enabled, Cassandra will detect frequently accessed partitions and store rows of data into RAM to limit the cases where it needs to read from disk.
When data is first read from the table, it's a row cache miss, and the row is cached for the next read.
For the next read it's a row cache hit, and the row is read from the cache.
If the row is updated or deleted later, the cache for it will be invalidated.
Here is a great blog with examples, if you want to practice for yourself. It is quite old, but the examples still work and illustrate very well when the row cache is hit. Note that you may have to enable the row cache first in the cassandra.yaml and restart your node (assuming you are working with your own installation of Cassandra).
https://www.datastax.com/blog/2014/05/tuning-row-cache-cassandra-21
I ran through the example to see if it still worked, the table create syntax is not quite right, use this one:
CREATE TABLE status ( user text, status_id timeuuid, status text, PRIMARY KEY (user, status_id)) WITH CLUSTERING ORDER BY (status_id DESC) AND caching = {'keys':'ALL', 'rows_per_partition':'10'};
But the rest is good.
Hope this answers your questions!
8 People are following this question.
How do I troubleshoot why a read is taking 600ms?
Does the python driver allow executing nodetool like commands?
Can system_view.clients be used to monitor node connectivity?
What are the names of tables that store peer data?
Can we replace a node that is down with a new node to take over the same token range(s)?
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2022 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use