OOM by large number of pmemkv

27 views
Skip to first unread message

Yong Yang

unread,
Apr 11, 2020, 9:50:47 PM4/11/20
to pmem
I notice large pmemkv consumes a lot of memory (with 512+ dbs of pmemkv), and may triggered linux oom killer.  As my experimental it may takes 19G residue memory with 512 db files with each 8MB size. In avergage the linux memory per db takes 19G / 512 = 38M, even larger than the DB file size(8M) itself.  Is this too high? Any way to reduce it?
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
25955 admin     20   0 23.307g 0.019t   5648 S 0.000 35.14   0:53.89 ./examples/pmemkv_basic_c/pmemkv_large /mnt/mem/dbfi+
...
"[1018084.741418] Out of memory: Kill process 25955 (pmemkv_large) score 622 or sacrifice child"


Below is running experiments using emulated pmem on VM, but it also applies on physical real optane device.
Linux kernel: 4.12.14-94.41-default #1 SMP Wed Oct 31 12:25:04 UTC 2018 (3090901) x86_64 x86_64 x86_64 GNU/Linux
admin@suse12sp4
:~/opensources/pmemkv> gcc -o examples/pmemkv_basic_c/pmemkv_large examples/pmemkv_basic_c/pmemkv_large.c -lpmemkv && rm -rf /mnt/mem/* && PMEM_IS_PMEM_FORCE=1 ./examples/pmemkv_basic_c/pmemkv_large /mnt/mem/dbfile 512
Creating config
Opening pmemkv database with 'cmap' engine-0
Opening pmemkv database with 'cmap' engine-1

...
Opening pmemkv database with 'cmap' engine-511

...


It make no difference with either cmap or stree engine, emulated pmem or real optane.


Piotr Balcer

unread,
Apr 14, 2020, 6:27:33 AM4/14/20
to pmem
Hi,
38M seems like quite a lot, but it's not a stretch.
The libpmemobj uses not insignificant amount of preallocated memory, to reduce runtime overheads. Also, a pool of the smallest possible size (8 megabytes) has very little usable space - so what you are trying to do is inefficient.

Piotr

Igor Chorążewicz

unread,
Apr 14, 2020, 7:03:32 AM4/14/20
to Piotr Balcer, pmem
Hi,

If you use all those engines from within a single application then you can put all engines into a single pool (and the total DRAM overhead will be ~38MB + some small overhead for each engine).
Please take a look at the oid API:  https://github.com/pmem/pmemkv/blob/master/examples/pmemkv_pmemobj_cpp/pmemkv_pmemobj.cpp

Igor

--
You received this message because you are subscribed to the Google Groups "pmem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pmem+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pmem/d9748ec6-af58-4c6e-b72b-fb5796bed0d8%40googlegroups.com.

Yong Yang

unread,
Apr 14, 2020, 10:42:43 AM4/14/20
to pmem
Does it support concurrent access on single pool? Is a single pool mapped to single db file?   I would like to running multiple engines (by sharded keys), saying multiple threads, in a process.
To unsubscribe from this group and stop receiving emails from it, send an email to pm...@googlegroups.com.

Igor Chorążewicz

unread,
Apr 14, 2020, 1:16:29 PM4/14/20
to Yong Yang, pmem
Yes, it supports concurrent access from different threads.
The pool may be a single file or consist of several parts if you use poolsets (see https://pmem.io/pmdk/manpages/linux/master/poolset/poolset.5). When using oids you have to manage the pool yourself.


To unsubscribe from this group and stop receiving emails from it, send an email to pmem+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pmem/4579932b-6e40-49c2-9cc8-90f26f064e07%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages