-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.2, 3.5.2
-
Component/s: None
-
Fully Compatible
-
Platforms 2018-01-01
-
(copied to CRM)
Currently, a mongos instance will attempt to cleanup memory from a thread's cache during threadStateChange() if the thread's cache size is larger than 10,000 bytes. This number was chosen heuristically based on having no more than 1,000 clients connected to a mongos instance. If there are more than 1,000 clients, then the cleanup code is run far more often. This is also problematic as the mongos logs a debug message every time the cleanup is performed.
The suggested improvement is to adjust the maximum thread cache size value based on the number of currently active client connections.
The code that this change relates to is located in https://github.com/mongodb/mongo/blob/r3.4.2/src/mongo/util/tcmalloc_server_status_section.cpp#L68-L86