Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

Configuring key cache settings

Updated on July 5, 2022

This content applies only to On-premises and Client-managed cloud environments

Maintain fast read access to Cassandra SSTables by tuning the use of the key cache separately for each table.

Cassandra’s key cache stores a map of partition keys to row index entries, which enables fast read access into SSTables.

  1. Check the current cache size by using Cassandra's nodetool info utility.
    The following nodetool info snippet shows sample key cache metrics:
    root@ip-10-123-5-62:/usr/local/tomcat/cassandra/bin# ./nodetool info
    ID                     : 8ae22738-98eb-4ed1-8b15-0af50afc5943
    Gossip active          : true
    Thrift active          : true
    Native Transport active: true
    Load                   : 230.73 GB
    Generation No          : 1550753940
    Uptime (seconds)       : 634324
    Heap Memory (MB)       : 3151.44 / 10240.00
    Off Heap Memory (MB)   : 444.33
    Data Center            : us-east
    Rack                   : 1c
    Exceptions             : 0
    Key Cache              : entries 1286950, size 98.19 MB, capacity 300 MB, 83295 hits, 83591 requests, 0.996 recent hit rate, 14400 save period in seconds
    Row Cache              : entries 0, size 0 bytes, capacity 0 bytes, 0 hits, 0 requests, NaN recent hit rate, 0 save period in seconds
    Counter Cache          : entries 0, size 0 bytes, capacity 50 MB, 0 hits, 0 requests, NaN recent hit rate, 7200 save period in seconds
    Token                  : (invoke with -T/--tokens to see all 256 tokens)
  2. If the size parameter roughly equals the capacity parameter, increase the cache size in the prconfig/dnode/yaml/key_cache_size_in_mb/default dynamic system setting, depending on your needs.

    The key_cache_size_in_mb setting indicates the maximum amount of memory for the key cache across all tables. The default value is either 5% of the total JVM heap, or 100 MB, whichever is lower.

    Have a question? Get answers now.

    Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

    Did you find this content helpful?

    Want to help us improve this content?

    We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

    Close Deprecation Notice
    Contact us