In AutomaticCE, first 60-100 queries are initially slow.

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • Hide

      Startup a mongod instance with plan ranker mode automaticCE.

      Load data into the mongod instance. Create indexes that are relevant to your queries. Restart the mongod instance. I have a harder time reproducing the issue if indexes are created just before running the queries.

      Run one or a set of relatively cheap queries such that the total number of runtimes is 100. Plot the runtimes from the explains.

      By relatively cheap, I mean a query that has an expected runtime of <3 ms. I could not reproduce the issue when I swapped the 1 million document 371 MB dataset with a 10,000 document 4MB dataset, so it seems like the collection needs to have a minimum size.

      A script that to reproduce the issue is here: https://github.com/10gen/mongo/blob/spm-2658-local-analysis/src/mongo/db/query/benchmark/analysis/unstable_query.ipynb

      Show
      Startup a mongod instance with plan ranker mode automaticCE. Load data into the mongod instance. Create indexes that are relevant to your queries. Restart the mongod instance. I have a harder time reproducing the issue if indexes are created just before running the queries. Run one or a set of relatively cheap queries such that the total number of runtimes is 100. Plot the runtimes from the explains. By relatively cheap, I mean a query that has an expected runtime of <3 ms. I could not reproduce the issue when I swapped the 1 million document 371 MB dataset with a 10,000 document 4MB dataset, so it seems like the collection needs to have a minimum size. A script that to reproduce the issue is here: https://github.com/10gen/mongo/blob/spm-2658-local-analysis/src/mongo/db/query/benchmark/analysis/unstable_query.ipynb
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Discovered while analyzing why q1, q2, and q3 have high coefficient of variance in this multi-patch comparison: https://performance-analyzer.server-tig.prod.corp.mongodb.com/perf-analyzer-viz?comparison_id=6881164078014293c88e9752&selected_tab=data-table&measurement_filter=AverageLatency&percent_filter=0%7C%7C100&z_filter=0%7C%7C10&filter_type=Default

      It turns out that these queries have high coefficient of variance because they are the first queries to run. There is something slows down the first 60-100 queries that run, and this something seems to decay exponentially.

      I have attached two graphs. The first one runs one query 100 times and tracks its runtime over time. The second one runs 9 different queries 13 times each and tracks the runtime over time.

            Assignee:
            Unassigned
            Reporter:
            Andi Wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: