[SERVER-19977] 30-50% performance regression in basic performance tests using mongo shell Created: 16/Aug/15  Updated: 15/Oct/15  Resolved: 07/Oct/15

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

Type: Bug Priority: Major - P3
Reporter: Bruce Lucas (Inactive) Assignee: Mira Carey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platform 8 08/28/15, Platform 9 (09/18/15), Platform A (10/09/15)
Participants:

 Description   

Saw a 30-50% performance decline with a standalone mongod between 3.1.6 and the 08-15 daily build on 8 threads doing a simple insert workload (separate collections to facilitate mmapv1 testing, not essential to repro on WT):

function insert(thread) {
    every = 10000
    c = db['c'+thread]
    for (var i=0; i<500000; ) {
        var bulk = c.initializeUnorderedBulkOp();
        for (var j=0; j<every; j++, i++)
            bulk.insert({x:0})
        bulk.execute()
    }
}

Execution time in seconds:

              wiredtiger     mmapv1
3.1.6             16           18
08-15 build       30           27       9b4d20439910450acf1385723c85f86bf41d15f0

Affects both WT and mmapv1.

Git bisect identified 2a6a8f7cf32465da072e63ee9e1272907b6bfa54 as the first bad commit, related to changing the default JS engine to SpiderMonkey.



 Comments   
Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 More fixes for javascript opt

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 add move operators to jsstringwrapper
Branch: master
https://github.com/mongodb/mongo/commit/f4cd4c9cec5e6e4c15ec48cc7c8f9366ba9cdf76

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 cstdint is required for std::int32_t
Branch: master
https://github.com/mongodb/mongo/commit/43863d9b90ad0b5627fa7f3e9065333836ce120c

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Optimize JS -> BSON conversion

Rather than a single tree of conditionals for object -> bson conversion,
only run checks against our types if they actually have a custom
jsclass and only check for array/date/regex if they're standard
types.
Branch: master
https://github.com/mongodb/mongo/commit/a170361541dd9ec3112046d4aff10e3ae65939f6

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Use JS_NewArrayObject directly

Rather than creating objects with stringified integer keys, just create
them directly with JS_NewArrayObject, which can take JS::CallArgs or
JS::AutoValueVector's directly.
Branch: master
https://github.com/mongodb/mongo/commit/054b0faf2cc16e3d40d2d40ffdda1e219e4c24e3

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Re-work JS ObjectID

Rather than storing a string with the encoded oid, just store a pointer
to the oid and convert it to a string on demand for "str" access.
Branch: master
https://github.com/mongodb/mongo/commit/cad0c421371e55fdf65c0be4badd23120bec72c1

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 DB::getProperty improvements in JS

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 JS ObjectWrapper improvements

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Switch JS BsonHolder to use StringMap

Using StringMap over std::set<std::string> when checking for removed
saves a bunch of string creation.
Branch: master
https://github.com/mongodb/mongo/commit/eebc4b80fd11fe4023700c598e72959533cd77af

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Small Improvements to IdWrapper

toValue() for serializing to a value
equalsAscii() for comparing with an ascii string
Branch: master
https://github.com/mongodb/mongo/commit/13613424af1ed48c7105651176136f4aef22a675

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Offer a stack based JSStringWrapper

Small string optimization for encoding utf8 strings from JS strings on
the stack. Additions to the api to use on stack buffers.
Branch: master
https://github.com/mongodb/mongo/commit/8d65462cd4b56fd12d3fbe8799ee78be677bae38

Comment by Githook User [ 07/Oct/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19977 Intern JS Strings

Rather than supplying const char*'s throughout our use of the MozJS api,
intern the strings and root their associated ids (to save on string
parsing).
Branch: master
https://github.com/mongodb/mongo/commit/95060c27ed2dddcb6343a88f7aa405ed8a935ad7

Comment by Bruce Lucas (Inactive) [ 16/Aug/15 ]

The issue here actually seems to be in the mongo shell - top shows mongo shell processes using 2x the CPU and the mongod process using 0.5 the CPU for the same test after the switch to SpiderMonkey. Confirmed by using an older shell with a recent mongod that the issue is with the shell.

This is a problem to the extent that people use the shell for simple performance tests.

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