Greetings,
Thanks to badger, such an excellent embeded kv store, I am working in a game company, now we are planning to use badger as an in process cache service (like memcached), so as to reduce pressure of the center data server, the procedure is :
Best Regards.
You can get the total size of key-values stored in Badger, by doing a key-only iteration, and then use EstimateSize in Item to get the size. Not sure if that's what you're looking for.
Thanks
My purpose is to limit the memory usage when I used badger as a cache layer, the total items maybe vary,
However I hope I can control the maxmemory of the badger by setting some parameters of the Option , if it's not possible I hope there is a way to figure out the memory usage according to the total number of items, key size and value size along with the number of the most frequent accessed items.
It's been a long time ago, but we're using badger as a "read only" DB + our own facade and we're running all that in Kubernetes pods.
It sounds like Badger is using a lot of memory, as much memory as the DB size (which is 5gig for us). Memory size then lower when using the FileIO option instead of the MMAP one, but it still require lots of memory to start.
When I say start, it's just "opening the DB" like kv, err := badger.Open(opt).
So I do have quite the same question as this post :
I would extend it with this question :
Let's keep it simple and just answer the original question to this thread.
Is there any way to estimate the size in memory given an encoded file?
Assigning the question to @manishrjain since this is something that might be changing with v2.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue was marked as stale and no activity has occurred since then, therefore it will now be closed. Please, reopen if the issue is still relevant.
Most helpful comment
Thanks
My purpose is to limit the memory usage when I used badger as a cache layer, the total items maybe vary,
However I hope I can control the maxmemory of the badger by setting some parameters of the Option , if it's not possible I hope there is a way to figure out the memory usage according to the total number of items, key size and value size along with the number of the most frequent accessed items.