kvrocks icon indicating copy to clipboard operation
kvrocks copied to clipboard

Metrics for namespace level

Open liangyuanpeng opened this issue 3 years ago • 4 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Motivation

Ref: https://github.com/apache/incubator-kvrocks/discussions/726 We are using the namespace to separate data between users and it works well. But the metrics from the info command stats didn't separate by namespace as well. As a user, we want to know the speed of commands for each namespace.

Solution

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

liangyuanpeng avatar Jul 27 '22 04:07 liangyuanpeng

@liangyuanpeng Thanks for your feedback, it makes a lot sense.

git-hulk avatar Jul 30 '22 04:07 git-hulk

Do you want only the data of stats to be isolated according to the namespace, or all parameters of the command INFO are required?

zevin02 avatar Apr 21 '23 13:04 zevin02

Now kvrocks don't save stat data for each namespace, if we need make it we should save stat for each namespace.

we can change Server#stats to a map that save namespace to stat mapping.

This will increase additional cost above:

  1. Roughly 2KB memory usage per namespace
  2. lock namespace-stat map when we add namespace
  3. One more indirect addressing for access stat
  4. Administrator info command need to foreach all namespace stat and count sum/average.

For 1rd we won't have thousands of namespace, so this memory usage is not large. For 2nd add namespace is low-frequency operation and it is fast. For 3rd if we think indirect addressing expensive, we can cache it in connect.(I don't think this is necessary) For 4rd this is not important.

I think them is acceptable. So do we need do it?

jihuayu avatar Jun 04 '23 04:06 jihuayu