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

$near query hangs server.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.4.7
    • Component/s: Geo
    • Environment:
      EC-2 linux, ubuntu 10.04
    • Fully Compatible
    • Linux
    • 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.

      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

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            Mark_H Mark HUANG [X]
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: