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

$near query hangs server.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Duplicate
    • Affects Version/s: 2.4.7
    • Fix Version/s: None
    • Component/s: Geo
    • Labels:
    • Environment:
      EC-2 linux, ubuntu 10.04
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      Linux
    • Steps To Reproduce:
      Hide

      1. Create a collection with 0.2 million records, all the location of them should be [-1.0,-1.0].
      2. start a mongo shell, db.test.find({loc:{$near:[-1,-1]}}).limit(3), mongo will hang for a long time till the query finished.
      3. start another mongo shell, db.test.find().limit(1), the qury will not be excuted until the geo query finished.

      Show
      1. Create a collection with 0.2 million records, all the location of them should be [-1.0,-1.0] . 2. start a mongo shell, db.test.find({loc:{$near: [-1,-1] }}).limit(3), mongo will hang for a long time till the query finished. 3. start another mongo shell, db.test.find().limit(1), the qury will not be excuted until the geo query finished.

      Description

      There are 1 million geo-data in my database and 20% of them are [-1.0,-1.0]

      I run the simple query db.test.find({lc:{$near:[-1.0,-1.0]}}).limit(1), which is extremely slow. It costs about 20~30 seconds and I think it is because the data will be sorted with $near operation first and then return 1 doc even if all of their locations are the same.

      The CPU usage would definitely rises up to 100%. Then the mongo hangs, all the other query has to wait the completion of the geo query.

      The problem is likely to: https://jira.mongodb.org/browse/SERVER-8207

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: