-
Type: Technical Debt
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Not Applicable
The standard allocators, jemalloc and tcmalloc have per-thread (tcmalloc), and per-core (jemalloc) caches, which means they reasonably expect to allocate memory without locking, which is the purpose of WiredTiger's scratch buffer support.
If MongoDB is reasonably limited to those allocators in production systems, we should measure if they are at least as fast as WiredTiger's code. If they are, we should remove the WiredTiger scratch buffer code in favor of simply calling the standard memory allocation functions.
This will simplify some WiredTiger code paths and stop WiredTiger from tying down memory in idle WT_SESSION handles.
Alternatively, if MongoDB isn't limited to allocators that support lock-free allocation, we could set session_scratch_max=0 to not cache buffers, or use some other mechanism to avoid caching buffers (assuming we can figure out when we're using a lock-free allocator).