[SERVER-80297] Reduce size of LockRequest Created: 21/Aug/23  Updated: 29/Oct/23  Resolved: 06/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Jordi Olivares Provencio
Resolution: Fixed Votes: 0
Labels: perf-tiger, perf-tiger-handoff, perf-tiger-project-candidates, perf-tiger-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution EMEA
Backwards Compatibility: Fully Compatible
Sprint: Execution EMEA Team 2023-09-18
Participants:

 Description   

LockRequest is 72 bytes on x64. There are simple ways to reduce space by sizing the enums to uint8_t and by using a bitfield for the bools. Also, work should be done to remove any holes. Also, I doubt we need to support a 32-bit lock recursion count/ 16-bit or even 8-bit likely suffices. 

(gdb) ptype /o mongo::LockRequest.
/* offset      |    size */  type = struct mongo::LockRequest {
/*      0      |       8 */    mongo::Locker *locker;
/*      8      |       8 */    mongo::LockGrantNotification *notify;
/*     16      |       1 */    bool enqueueAtFront;
/*     17      |       1 */    bool compatibleFirst;
/*     18      |       1 */    bool partitioned;
/* XXX  1-byte hole      */
/*     20      |       4 */    unsigned int recursiveCount;
/*     24      |       8 */    mongo::LockHead *lock;
/*     32      |       8 */    mongo::PartitionedLockHead *partitionedLock;
/*     40      |       8 */    mongo::LockRequest *prev;
/*     48      |       8 */    mongo::LockRequest *next;
/*     56      |       4 */    mongo::LockRequest::Status status;
/*     60      |       4 */    mongo::LockMode mode;
/*     64      |       4 */    mongo::LockMode convertMode;
/*     68      |       4 */    unsigned int unlockPending;
 
                               /* total size (bytes):   72 */
                             }



 Comments   
Comment by Githook User [ 06/Sep/23 ]

Author:

{'name': 'Jordi Olivares Provencio', 'email': 'jordi.olivares-provencio@mongodb.com', 'username': 'jordiolivares'}

Message: SERVER-80297 Reduce size of LockRequest
Branch: master
https://github.com/mongodb/mongo/commit/2be1145f6925f2299019b037c676d9779b60a2a9

Generated at Thu Feb 08 06:43:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.