rbell01824
rbell01824

Reputation: 189

OVER_QUERY_LIMIT details

Google Maps returns status of OVER_QUERY_LIMITS under some conditions. I'm looking for any details on what those conditions are.

I'm able to deal with the status by resubmitting the Directions Services route request after a delay. I've been able to minimize the number of OVER_QUERY_LIMITS status by managing and throttling the requests with several 'magic number' setTimeout delays. I'm concerned that while these 'magic numbers' work for me on my machine with my network connection at my location on the day they were set they may be in appropriate under other circumstances.

Does anyone have any experience with addressing the OVER_QUERY_LIMIT issue particularly with adaptive strategies not susceptible to any of the above?

Edit ---------------------------------------------------------------------

It seems that the question might not be entirely clear. I found and understand the online documentation. The question is about what it means, what the details are, and strategies for dealing with them. In particular:

What is "to many request per second"? Is it 1 or 5 or 50 or what? How is it determined? What does it respond to? How does it change with use?

What strategies, particularly adaptive strategies, seem to work for dealing with the issue?

Edit again: Perhaps it's still not clear. ------------------------------------

In the particular case of a directions services request:

More generally, does anyone know how these change with other google map services?

Upvotes: 3

Views: 6393

Answers (3)

Nids Barthwal
Nids Barthwal

Reputation: 2419

This error comes when you try to request more than 8 or 9 per second. I have solved this by following code.

function(response, status) {
              if (status === 'OK') {
                    var directionsDisplay = new google.maps.DirectionsRenderer();
                    directionsDisplay.setMap(map);
                    directionsDisplay.setDirections(response);
              }
else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
                wait = true;
                setTimeout("wait = true", 2000);
                //alert("OQL: " + status);
              }

Upvotes: 2

rbell01824
rbell01824

Reputation: 189

While quoting the documentation seems popular, it seems that no one really knows the actual requests per second answer or much about the actual algorithms used. A bit of investigation suggests that the most likely algorithm is a decaying rate function. I've demonstrated that it is possible to issue many (>15) requests in a burst but then it is only possible to issue a few (<4) requests in >1000 ms. A significant pause allows a repeat with similar though somewhat smaller numbers.

I eventually adopted a queued rate limited function. While it is not the fastest possible approach (fails to capitalize on the burst characteristic) it is simple and appears to be very robust with extremely few OVER_QUERY_LIMIT errors.

Upvotes: 1

geocodezip
geocodezip

Reputation: 161334

Google's services are subject to a quota and a rate limit (which can depend on server load).

From the documentation on OVER_QUERY_LIMIT in the web services

Usage limits exceeded

If you exceed the usage limits you will get an OVER_QUERY_LIMIT status code as a response.

This means that the web service will stop providing normal responses and switch to returning only status code OVER_QUERY_LIMIT until more usage is allowed again. This can happen:

  • Within a few seconds, if the error was received because your application sent too many requests per second.
  • Some time in the next 24 hours, if the error was received because your application sent too many requests per day. The time of day at which the daily quota for a service is reset varies between customers and for each API, and can change over time.

Upon receiving a response with status code OVER_QUERY_LIMIT, your application should determine which usage limit has been exceeded. This can be done by pausing for 2 seconds and resending the same request. If status code is still OVER_QUERY_LIMIT, your application is sending too many requests per day. Otherwise, your application is sending too many requests per second.

Upvotes: 3

Related Questions