[SERVER-13499] Yield policy for batch-inserts should be the same as for batch-updates/deletes Created: 06/Apr/14  Updated: 11/Jul/16  Resolved: 16/Apr/14

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.6.0-rc3
Fix Version/s: 2.6.1, 2.7.0

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Backport Completed:
Participants:

 Description   
Issue Status as of April 16, 2014

ISSUE SUMMARY
Batch inserts can potentially yield after each single insert. This can negatively impact performance and is inconsistent with the yield policy of batch updates and deletes, which check less frequently.

USER IMPACT
Bulk insert tasks have a noticeable performance penalty compared to previous versions of MongoDB.

WORKAROUNDS
An older version of the driver that does not use the write commands is unaffected by this issue and can be used as a workaround with MongoDB 2.6.0.

RESOLUTION
Changing the yielding policy to the same as updates/deletes (allow yields less frequently) improves insert performance significantly (by ~28% in internal tests).

AFFECTED VERSIONS
Version 2.6.0 is affected by this bug.

PATCHES
The patch is included in the 2.6.1 production release.

Original description

For batch inserts, we were checking to yield after each insert. Batch updates/deletes only check every 100 operations, so batch inserts should be changed to match.



 Comments   
Comment by Githook User [ 09/Apr/14 ]

Author:

{u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-13499 bulk insert check for yield less often

(cherry picked from commit 68d42de9a958688acbf659dfb651fb699e9d7394)

Conflicts:
src/mongo/db/commands/write_commands/batch_executor.cpp
Branch: v2.6
https://github.com/mongodb/mongo/commit/ffa99f0d369e9eabd8eafa4ac5ff412075458c34

Comment by Githook User [ 09/Apr/14 ]

Author:

{u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-13499 bulk insert check for yield less often
Branch: master
https://github.com/mongodb/mongo/commit/68d42de9a958688acbf659dfb651fb699e9d7394

Comment by Eric Milkie [ 07/Apr/14 ]

This will be easy to fix; I'll just make it use the same elapsedTracker that the runner yield policy uses. It waits for 127 hits or 10ms to pass before calling suggestYieldMicros(), which is a terribly inefficient function, particularly if you have lots of outstanding connections (even if they are idle).

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