[SERVER-11516] $near query hangs server. Created: 01/Nov/13 Updated: 29/Jan/15 Resolved: 29/Jan/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Geo |
| Affects Version/s: | 2.4.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Mark HUANG [X] | Assignee: | Siyuan Zhou |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
EC-2 linux, ubuntu 10.04 |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | Linux | ||||||||
| Steps To Reproduce: | 1. Create a collection with 0.2 million records, all the location of them should be [-1.0,-1.0]. |
||||||||
| Participants: | |||||||||
| 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 |
| Comments |
| Comment by Siyuan Zhou [ 29/Jan/15 ] | ||||
|
With samantha.ritter@10gen.com's script, I am able to reproduce this issue on 2.6. It takes 18291ms to return 3 results on my workstation. On 3.0.0-rc7, it only takes 567ms. Given the fact that near stage has to fetch all 200k documents and sort them before returning to user, the current performance looks reasonable to me. So I would close this as a dup to | ||||
| Comment by Greg Studer [ 18/Apr/14 ] | ||||
|
Some of this may be addressed by refactoring changes in | ||||
| Comment by Samantha Ritter (Inactive) [ 06/Nov/13 ] | ||||
|
Insert 200,000 legacy points, add 2d index, run query:
Query does hang server, and queries from another open mongos are blocked until first call returns. Also, query with and without limit() argument seem to take the same amount of time. From the server:
Opening for triage! Thanks, Mark, for reporting this! |