-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
We are currently setting the connection thread stack size at a hard-coded 1MB here:
Technically, we are setting the size to the maximum of either the current stack size ulimit or 1MB, whichever is less. This was done at the request of a user a long, long time ago in SERVER-2707 to reduce memory pressure on highly-threaded systems:
https://groups.google.com/g/mongodb-user/c/GOAOwYH483c
This is not actually the case. The initial stack size is not an allocation but a reservation of address space. There is no additional memory pressure introduced by keeping the stack size at the default 8MB limit. The function of the ulimit only prevents actually using beyond a certain amount and does to by inducing an artificial stack exhaustion. In any case, this is not a thing you can do on Windows anyway, so it also represents a self-imposed platform difference.
Since stack consumption is generally a function of platform (compiler, kernel, etc.) and usage, the optimal stack size is not actually predictable in this way. We should instead offer an option that allows users on supported platforms to set an initial stack size lower than the default 8MB and (potentially) an upper limit using setrlimit. This should be documented as a feature available on resource-constrained platforms and not as a means of limiting resource consumption on production systems in general.
- is related to
-
SERVER-64594 measure executor task stack high water mark
- Backlog
- related to
-
SERVER-69905 Improve ServiceExecutorSynchronous worker threads
- Backlog