# Calculating "per record" memory in a cluster

**URL:** <https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81>\
**Category:** ScyllaDB\
**Created:** [November 14, 2022, 8:55am UTC](https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81 "2022-11-14T08:55:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [November 14, 2022, 8:55am UTC](https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81/1 "2022-11-14T08:55:52Z")

</div>

I have been tasked to come up with “some number” of how much memory it takes to store one record in Scylla (and related overhead if any). We had commands in Redis Cache that produced these metrics. Is that even possible to do in Scylla? I have scyllatop running and also the monitoring stack.

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [November 14, 2022, 8:56am UTC](https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81/2 "2022-11-14T08:56:22Z")

</div>

One way to accomplish this task is to create a million “average” records, execute “nodetool flush” to make sure they get flushed to disk (which will also place them in cache), then look at the cache metrics and divide the cache memory usage by the total rows in cache.

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [November 14, 2022, 8:57am UTC](https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81/3 "2022-11-14T08:57:18Z")

</div>

Thanks, a couple of follow-up questions. When you say “cache metrics,” do you imply ones provided by _scyllatop_ ? I presume this is where I get cache memory usage from? Also, would that work in a clustered environment (I have 8 nodes spread over four DCs). I know cache is over cluster, but what happens if not all records are in the cache? How would I find out how many have been put into cache?

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [November 14, 2022, 8:57am UTC](https://forum.scylladb.com/t/calculating-per-record-memory-in-a-cluster/81/4 "2022-11-14T08:57:55Z")

</div>

The metrics are available by scyllatop, though a nicer way to see them is with Prometheus or Grafana (see scylla-monitoring.git). The metrics contain the number of partitions in cache, rows in cache, and memory in cache, so from there you compute any statistic you want.  
About the rows not in cache, well they don’t have any cache footprint.
