metric: Add memdb size and key count metric
Add size and keys count metric for memdb
There could be multiple MemDBs. ~I think Gauge for MemdbSize is inappropriate. Maybe a Histogram?~ Gauge makes sense. We just need to differentiate memdbs.
~I'm wondering about the purpose of these metrics. It answers "how much data is in memdb" but cannot tell us a lot about "how much memory is used by memdb".~
I see, it's for measuring the actual memory consumed by memdb. db.size is just the sum of lengths of keys and values we put in which is the theoretical lower bound of the actual memory consumption. Could we consider calculating the memories allocated for the memdbArenas?
We can run some experiments with large transactions and compare our metrics with the profiling results to see if it's accurate.
We don't have a clear idea of the relationship between db.size and the memory allocated. I'm thinking could we export both of them so that we will be able to estimate the memory usage of certain kinds of jobs, e.g.insert into select a large table?
#520 tracks the memory allocated to the arena. That could be reused here.
@longfangsong Please address the above comments.
@longfangsong
Please address the above comments.
I plan to continue this pr after #520 is done.
@cfzjywxk @MyonKeminta do we want to continue this?
closing due to inactivity. Please reopen it if need.