Slow Query Performance


(Brian Seagraves) #1

Hello, I'm having some trouble getting some queries to perform well.

Info:

9,000,000 places with lat/lon
AWS EC2 m1.large instance
ES_MAX_MEM = ES_MIN_MEM = 5g
bootstrap.mlockall: true
ulimit -l unlimited

Using a geodistance filter, it takes 9 seconds and change consistently
to return a result set. It did this before upping the default memory
allocation too. How can I make this faster?

Thanks for the help,
Brian Seagraves


(Shay Banon) #2

First, make sure you execute it several times before you start to analyzer the response time.

What is the query that you execute? Is it a match all on all the docs and filter by distance? The computation (by default) is quite CPU intensive, since the values are loaded into memory and then a bbox is computed to be checked, and then the distance is calculated. You have several options to make it faster:

  1. Use a different distance calculation (http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter.html, under options, setting distance_type to plane).
  2. Use optimize_bbox set to indexed (the default is memory). For that though, you will need to enable specific lat lon indexing in the geo_type mapping (and reindex).
  3. Have a stronger machine / more machines with a bit more CPUs than the AWS large instance which is as strong as a laptop I had 5 years ago, and thats not without noisy neighbors.

On Wednesday, February 1, 2012 at 3:07 AM, Brian Seagraves wrote:

Hello, I'm having some trouble getting some queries to perform well.

Info:

9,000,000 places with lat/lon
AWS EC2 m1.large instance
ES_MAX_MEM = ES_MIN_MEM = 5g
bootstrap.mlockall: true
ulimit -l unlimited

Using a geodistance filter, it takes 9 seconds and change consistently
to return a result set. It did this before upping the default memory
allocation too. How can I make this faster?

Thanks for the help,
Brian Seagraves


(system) #3