Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54078

[SBE] Improve perf of the bestbuy_agg_merge_wordcount benchmark suite

    XMLWordPrintable

Details

    • Fully Compatible
    • Query Execution 2021-05-03, Query Execution 2021-05-17, Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28, Query Execution 2021-07-12, Query Execution 2021-07-26

    Description

      When SBE is enabled, the aggregate() commands from the filtered_word_count_no_merge, filtered_word_count, all_word_count_no_merge, and all_word_count benchmarks (from the bestbuy_agg_merge_wordcount suite) are noticeably slower vs. the classic execution engine.

      Instructions on how to run the aggregate() commands:

      1) Download the bestbuy dataset.

      2) Start mongod. If you want to enabled SBE, pass '--setParameter "featureFlagSBE=true"' on the command line.

      3) Load the bestbuy dataset using the following command:

      mongorestore --gzip --archive=bestbuyproducts.bson.gz

      4) Launch the mongo shell and run the following commands to prepare your environment:

      > function millis(command) { const t1 = new Date(); const result = command(); const t2 = new Date(); print("time: " + (t2 - t1) + "ms"); return (t2-t1); }
      > use bestbuy

      5) Run the following commands multiple times to measure the performance of the aggregate() commands:

      > ## filtered_word_count_no_merge:
      > millis(() => db.products.aggregate([{"$match":{"type":{"$in":["Software","Game"]}}},{"$project":{"wordOfName":{"$split":["$name"," "]}}},{"$unwind":"$wordOfName"},{"$group":{"_id":"$wordOfName","count":{"$sum":1.0}}}]).itcount());

      > ## filtered_word_count:
      > db.target_range_id.remove({})
      > millis(() => db.products.aggregate([{"$match":{"type":{"$in":["Software","Game"]}}},{"$project":{"wordOfName":{"$split":["$name"," "]}}},{"$unwind":"$wordOfName"},{"$group":{"_id":"$wordOfName","count":{"$sum":1.0}}},{"$merge":{"into":"target_range_id","on":"_id","whenMatched":"replace","whenNotMatched":"insert"}}]).itcount());

      > ## all_word_count_no_merge:
      > millis(() => db.products.aggregate([{"$project":{"wordOfDesc":{"$split":["$longDescription"," "]}}},{"$unwind":"$wordOfDesc"},{"$group":{"_id":"$wordOfDesc","count":{"$sum":1.0}}}]).itcount())

      > ## all_work_count:
      > db.target_range_id.remove({})
      > millis(() => db.products.aggregate([{"$project":{"wordOfDesc":{"$split":["$longDescription"," "]}}},{"$unwind":"$wordOfDesc"},{"$group":{"_id":"$wordOfDesc","count":{"$sum":1.0}}},{"$merge":{"into":"target_range_id","on":"_id","whenMatched":"replace","whenNotMatched":"insert"}}]).itcount())

      Here is how long each of the aggregate() commands above took on my local machine when SBE was enabled vs. when SBE was disabled (as of 4/23/2021):
        308ms (SBE) vs. 150ms (classic) – filtered_word_count_no_merge
        663ms (SBE) vs. 502ms (classic) – filtered_word_count
        23979ms (SBE) vs. 11602ms (classic) – all_word_count_no_merge
        38506ms (SBE) vs. 25419ms (classic) – all_word_count

      Note: The examples above will print out the total amount of time that each "aggregate(..).itcount()" shell command takes from the client's perspective. If you are interested in how long each individual mongo command takes on the server, consider using the slow query timer.

      Attachments

        Issue Links

          Activity

            People

              mohammad.dashti@mongodb.com Mohammad Dashti
              andrew.paroski@mongodb.com Drew Paroski
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: