[SERVER-33697] Provide sanity check on number of cached sessions Created: 06/Mar/18 Updated: 29/Oct/23 Resolved: 09/Jul/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 3.6.7, 4.0.1, 4.1.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Bruce Lucas (Inactive) | Assignee: | Cheahuychou Mao |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | ShardingTechDebt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||
| Backport Requested: |
v4.0, v3.6
|
||||||||||||||||||||||||
| Sprint: | Sharding 2018-07-16 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
Driver or application errors can result in an unbounded number of cached sessions, and that can result in performance degradation and eventually OOM. It would be useful to provide a sanity check, say at 1 M cached sessions, and warn or refuse further sessions when it is exceeded. Fix Implementation The commands that add new sessions to the cache are start_session_command, refresh_sessions_command and refresh_sessions_command_internal. These commands will now return false when the cache is full. The maximum number of sessions can be configured through an optional argument to the mongod command (maxSessions) and will default to 1M. LogicalSessionCacheImpl::_addToCache https://github.com/mongodb/mongo/blob/master/src/mongo/db/logical_session_cache_impl.cpp#L102 and LogicalSessionCacheImpl::startSession will now return a Status instead of void. |
| Comments |
| Comment by Githook User [ 11/Jul/18 ] |
|
Author: {'username': 'cheahuychou', 'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com'}Message: (cherry picked from commit ffbaee1a4dcb47a307986cb696807fe979f4a39d) |
| Comment by Githook User [ 09/Jul/18 ] |
|
Author: {'username': 'cheahuychou', 'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com'}Message: (cherry picked from commit ffbaee1a4dcb47a307986cb696807fe979f4a39d) |
| Comment by Githook User [ 09/Jul/18 ] |
|
Author: {'username': 'cheahuychou', 'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com'}Message: |
| Comment by Cheahuychou Mao [ 03/Jul/18 ] |
|
misha.tyulenev Could you please take a look at the fix suggestions in the "Fix Implementation" section? It is mostly what we discussed offline, just that I think the change will also affect the refresh sessions commands. |
| Comment by Kaloian Manassiev [ 28/Jun/18 ] |
|
misha.tyulenev, can you please work with Chou to figure out the best way to cap the number of active sessions? |