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

Improve SBE perf for bestbuy_agg_merge_wordcount::filtered_word_count

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:

      When SBE is enabled, the aggregate() command from theĀ filtered_word_count benchmark (from theĀ bestbuy_agg_merge_wordcount suite) is noticeably slower vs. the classic execution engine.

      At the time of this writing, on my local machine this benchmark takes 805ms when SBE is enabled, compared with 658ms for the classic execution engine (i.e. SBE disabled).

      Instructions on how to run the aggregate() command:

      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() command:

      > 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());

      Note that step #5 above will print out the amount of time the entire "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.

            andrew.paroski@mongodb.com Drew Paroski
            andrew.paroski@mongodb.com Drew Paroski
            0 Vote for this issue
            1 Start watching this issue