-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OOM enabler in operator tree #1379
Conversation
This commit introduces memory tracker with jemalloc extent hooks which fully works in case when jemalloc config is following: MALLOC_CONF="retain:false,percpu_arena:percpu,oversize_threshold:1000000000000,muzzy_decay_ms:0,dirty_decay_ms:0" \ ./configure \ --disable-cxx \ $COMMON_CONFIGURE_FLAGS \ --with-malloc-conf="retain:false,percpu_arena:percpu,oversize_threshold:1000000000000,muzzy_decay_ms:0,dirty_decay_ms:0" This config will for jemalloc not to use lazy purge or MADV_FREE(muzzy_decay_ms=0 and dirty_decay_ms=0), it will force jemalloc not to use custom arena for huge allocations (oversize_threshold) and it will force jemalloc not extend virtual memory indefinitely (retain=false) and therefore call alloc hook when allocation actually takes place. Only problem is if we do huge allocations which are not mapped on alloc directly, in that case jemalloc uses cache and we can overcounter allocation size.
… into improve-memory-tracker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several things:
- why do you need exception enabler in the operator tree?
- I think it is not good to disable OOM for disk storage
- not sure you need exception enabler in all methods (why would create index need it)?
-> The operator tree goes through all storage methods, so it is common place for all allocations to happen. It seems less error-prone than adding it to each method. |
RN: @vpavicic : Out of memory exception is now thrown whenever memgraph is out of memory. |
This diff will introduce the OOM exception enabler to the operator tree.
The reason why OOM enabler was not introduced inside disk storage directly is that exceptions can blow during storing inside
rocksdb
and the transaction never commits, nor is the exception returned. We need to be careful when to add an OOM Exception enabler, and when to use a blocker in disk storage. Currently, the OOM enabler in the operator tree enables exceptions for all operations.OOM enabler needs to be introduced also in mg_procedure_impl and that is what new diff will do. Currently, if a user specifies multiple threads that will do allocations from the procedure, due to the thread local variable for the OOM enabler to check if the error can be thrown, call in procedure will pass (although it shouldn't if memory is too big) and error will be not thrown.
[master < Task] PR
To keep docs changelog up to date, one more thing to do: