pmem / pmemkv

Key/Value Datastore for Persistent Memory
https://pmem.io
Other
398 stars 119 forks source link

Any way to get the kv usage of total db capactiy? #671

Open JerryYangSH opened 4 years ago

JerryYangSH commented 4 years ago

I would need an interface to query the current used or remaining capacity. I know we can scan to get this but it's not good way to scan each time for query.

igchor commented 4 years ago

Right now there is no such API but in future we might expose pmemobj statistics (number of allocated bytes, number of active/allocated runs): https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3. However, even with such API, finding out what is the remaining capacity is not an easy task. The number of entries which you can add to the pmemkv, might be a lot less than the "remaining capacity". One reason is fragmentation (both internal and external).