[SERVER-20419] NetworkInterfaceASIO spends 70% of its cycles in vector::erase Created: 15/Sep/15  Updated: 07/Oct/15  Resolved: 18/Sep/15

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 3.1.9

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File perf.png    
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platform 9 (09/18/15)
Participants:

 Description   

Because we store the operations that are waiting for a connection from the pool as a std::vector<TaskExecutor::CallbackHandle>, we need to do an O(n) scan to remove it when we move it to the _inProgressMap.

Under load (10's of thousands of concurrent ops) the cost of traversing this vector dominates the total time of an operation. This has been verified by profiling with the linux perf utility, the output of which is attached to this ticket.

To remedy this, we should make CallbackHandles hashable so that we can use a better data structure with O(1) insert/removal.



 Comments   
Comment by Githook User [ 18/Sep/15 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-20419 Use constant time lookup to cancel operations waiting for a connection
Branch: master
https://github.com/mongodb/mongo/commit/5920f4fa07434626cc1ec9f8d22d696caad8e036

Generated at Thu Feb 08 03:54:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.