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

sorts with multiple batches with small collections can be slower in rc2

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0-rc2
    • Component/s: Querying
    • Labels:
    • ALL
    • Hide
      1. insert n documents
      2. query for a range of (for example) 100 documents with a batch size of 10
      3. retrieve the first batch
      4. remove a document later in the batch
      5. exhaust the cursor

      The attached code is more of a stress test. It can be run against a v2.4 and v2.6 server, and will produce a .json file for each run, which can be imported/aggregated as described below:

      First, build with something like:

      c++ -I/opt/libmongoclient/include -std=c++11 -o op_bench_repro.o -c op_bench_repro.cpp
      c++ -I/opt/libmongoclient/include -std=c++11 -o scoped_probe.o -c scoped_probe.cpp
      c++ op_bench_repro.o scoped_probe.o -o op_bench_repro -rdynamic -lmongoclient -lboost_thread-mt -lboost_filesystem 
      -lboost_program_options -lboost_system 
      

      Then import the results to mongodb:

      echo '[' > tmp.json
      find . -name '*.json' |xargs cat >> tmp.json 
      echo ']' >> tmp.json 
      mongoimport --jsonArray --collection regression tmp.json
      

      Then aggregate:

      db.regression.aggregate({
            $group: {
                _id:        {ServerVersion:'$ServerVersion', TestName:'$TestName'},
                Seconds:    {'$sum': "$ClockSeconds"}
              }
          });
      
      Show
      insert n documents query for a range of (for example) 100 documents with a batch size of 10 retrieve the first batch remove a document later in the batch exhaust the cursor The attached code is more of a stress test. It can be run against a v2.4 and v2.6 server, and will produce a .json file for each run, which can be imported/aggregated as described below: First, build with something like: c++ -I/opt/libmongoclient/include -std=c++11 -o op_bench_repro.o -c op_bench_repro.cpp c++ -I/opt/libmongoclient/include -std=c++11 -o scoped_probe.o -c scoped_probe.cpp c++ op_bench_repro.o scoped_probe.o -o op_bench_repro -rdynamic -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system Then import the results to mongodb: echo '[' > tmp.json find . -name '*.json' |xargs cat >> tmp.json echo ']' >> tmp.json mongoimport --jsonArray --collection regression tmp.json Then aggregate: db.regression.aggregate({ $group: { _id: {ServerVersion: '$ServerVersion' , TestName: '$TestName' }, Seconds: { '$sum' : "$ClockSeconds" } } });

      There is a performance regression in v2.6-rc2 when querying for multiple batches of documents with a sort while one (or more) of those documents are removed.

      The attached code takes 41 seconds to execute in v2.6-rc2, and 25 seconds to execute in v2.4.9.

        1. op_bench_repro.cpp
          3 kB
        2. scoped_probe.cpp
          0.3 kB
        3. scoped_probe.h
          2 kB
        4. scoped_timer.h
          2 kB
        5. server-13316.svg
          101 kB
        6. disableSplitLimitedSort.patch
          0.5 kB
        7. server-13316-with-patch.svg
          108 kB
        8. server13316.js
          4 kB

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            benjamin.becker Ben Becker
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: