MongoDB – Thread Over Memory Limit

linuxmemorymongodb

What does it mean?

2017-04-28T04:37:53.126+0000 D – [conn1571] thread over memory limit, cleaning up, current: 67k
2017-04-28T04:37:53.911+0000 D – [conn1585] thread over memory limit, cleaning up, current: 79k

Should I make something to solve it? If I increas server memory will it help?

Best Answer

This is from source code:

// If many clients are used, the per-thread caches become smaller and chances of
// rebalancing of free space during critical sections increases. In such situations,
// it is better to release memory when it is likely the thread will be blocked for
// a long time.

And when numOpenSessions is over 40 and threadCacheSizeBytes (GetThreadCacheSize()) goes under 0x10000, system frees memory.

So, to "prevent" this, you should have less (concurrent) open sessions OR more (cache) memory. You can define (wiredTiger) bigger (than default) cache size, with current memory. But, yes, it's better give more memory than define bigger cache size, because when mongodb have more memory, cache size is automatically bigger.