Maps API Rate Limits & Caching Best Practices

8 min read

Understanding Rate Limits

Every Maps API provider enforces rate limits to ensure fair usage and service stability. Hitting rate limits causes failed requests, degraded user experience, and potential revenue loss.

Default Rate Limits

ProviderRequests/secondDaily limit
Google Maps50 QPSNo hard limit
Beta Maps100 QPSNo hard limit
Mapbox600 RPM100,000 (free)

Caching Strategy

The most effective way to reduce API calls is aggressive caching.

What to cache:

  • Geocoding results (addresses rarely move)
  • Place details (update weekly)
  • Static map images (cache for 30 days)
  • Route calculations for common origin-destination pairs

What NOT to cache:

  • Traffic-aware directions (stale within minutes)
  • Real-time place occupancy data

Exponential Backoff

When you receive a 429 (rate limited) or 500 (server error) response, implement exponential backoff:

async function fetchWithRetry(url, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const res = await fetch(url);
    if (res.ok) return res.json();
    if (res.status === 429 || res.status >= 500) {
      await new Promise(r =>
        setTimeout(r, Math.pow(2, i) * 1000 + Math.random() * 1000)
      );
      continue;
    }
    throw new Error(res.statusText);
  }
  throw new Error("Max retries exceeded");
}

Request Batching

Instead of making individual requests in a loop, batch them. Beta Maps API supports batch endpoints for geocoding and distance calculations, reducing both latency and rate limit pressure.

Monitoring

Track these metrics to catch rate limit issues early:

  • API call volume by endpoint (per minute, per hour)
  • Cache hit rate (target: >60% for geocoding)
  • Error rate by status code (watch for 429 spikes)
  • P95 latency (increases near rate limits)

Set up alerts for error rate increases and cache hit rate drops. Most rate limit issues can be prevented with proper monitoring.