[SERVER-65418] Release all resources before sleep in WriteConflictException::logAndBackoff Created: 10/Apr/22 Updated: 26/Oct/23 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 4.0.23, 5.0.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | peng zhenyi | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | former-storex-namer, writeConflict | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Storage Execution
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
When modify one single document concurrently, only on request can commit successfully, and other requests get WriteConflictExceptions and retry internally(https://github.com/mongodb/mongo/blob/v5.0/src/mongo/db/concurrency/write_conflict_exception.h#L70-L106).
For example, if 128 write requests are sleeping for 10ms (and waiting to retry again) in the same time, then there are no available global write ticket during this 10ms. All newly incoming write requests are stucked, but MongoDB has nothing to do (and just sleep). I think it is better to release all resources before sleep and get back resources after sleep if the retry-function is not in a WUOW. In this way, MongoDB can handle more requests in this period. My basic idea is this:
|