Spatial view changing performance

I’m using Couchbase Server 4.0, I have a bucket with 7-8 mln objects, each one has geographical coordinates.
My spatial function code is:
function (doc) {
if (doc.geoLocation) {
geojson = {};
geojson.type = “Point”;
geojson.coordinates = [, doc.geoLocation.lon];
emit( geojson, doc );
I am using REST API for querying spatial view, for example:

When I was testing it for the first time on localhost, my laptop, it would return results after 5-10 seconds, but soon, without any changes in couchbase server settings it started to work really quickly with response time less than 500 ms.
However after few days response time again was around 30 seconds

Then I made a Couchbase cluster on an external server and I tried to have similar settings to the ones on my computer.
However querying view had response time ~ 1 minute, so that’s totally unacceptable for my use case. After experimenting with some RAM setting response times went down to ~ 5-10 seconds, but that’s really quite slow and I would like to make it work as fast as once on my localhost.

Do you happen to know what can cause so different response times and how to make it work faster and more predictably?