github maplibre/martin martin-v1.6.0

6 months ago

Smarter, more configurable caching

The tile cache received several improvements in this release:

  • Configurable cache expiry
    The in-memory tile cache Time To Live (TTL -> f.ex. cache.expiry: 1h) and Time To Idle (TTI -> f.ex. cache.idle_timeout: 20m) was previously hardcoded to "∞" (aka never expiring).
    You can now configure how long cached tiles stay in memory, allowing better trade-offs between freshness and performance for your specific workload.

    cache:
      # Maximum lifetime for all cache entries (time-to-live from creation).
      # Entries are evicted after this duration regardless of access.
      # Supports human-readable formats: "1h", "30m", "1d", "3600s".
      # default: null (no expiry, entries only evicted by size pressure)
      expiry: null
    
      # Maximum idle time for all cache entries (time-to-idle since last access).
      # Entries are evicted if not accessed within this duration.
      # default: null (no idle timeout)
      idle_timeout: null

    Done in #2691.

  • Per-source cache zoom levels
    New cache.minzoom and cache.maxzoom options (both globally and per-source) let you skip caching at zoom levels that don't benefit from it.
    For example, you can avoid filling the cache with rarely-reused high-zoom tiles or low-detail overviews.

    cache:
      # Default minimum zoom level (inclusive) for tile caching.
      # Tiles further zoomed out than this will bypass the cache entirely.
      # Can be overridden per-source (e.g. cache.minzoom on a type of source or an individual source).
      # default: null (no lower bound, all zoom levels cached)
      minzoom: null
    
      # Default maximum zoom level (inclusive) for tile caching.
      # Tiles further zoomed in than this will bypass the cache entirely.
      # Can be overridden per-source.
      # default: null (no upper bound, all zoom levels cached)
      maxzoom: null

    Done in #2673 by @carderne.

  • Cache deduplication under concurrency
    Cache insertions now use moka's entry API, so concurrent requests for the same tile only compute it once instead of redundantly.
    This is a meaningful performance win under thundering-herd scenarios.
    Done in #2688.

  • Accept header in cache key -- The sanitised Accept HTTP header is now part of the cache key, preventing a cached response encoded for one client from being incorrectly served to another.
    This previously did not have any effect and was also not incorrect, but in the next release we will add MLT encoding support (which we worked hard for).

    This also has the side-effect that if your client now says that you only Accept a certain format, we now correctly abort requests early.
    Done in #2703.

Broader MBTiles compatibility

  • Planetiler normalized schema alias -- Martin now recognizes Planetiler's normalized and normalized-with-view schema names as aliases for its own norm schema type, so MBTiles files produced by Planetiler no longer trigger schema-detection warnings. Done in #2681.
  • Compression type stored in metadata -- When writing tiles to MBTiles (e.g. via martin-cp), the compression method (gzip, brotli, etc.) is now recorded in the metadata table. Previously this information was lost, forcing consumers to guess. Done in #2618.
  • Transcoder API for library consumers -- The mbtiles crate now exposes a public API for converting between MBTiles storage schemas (flat, normalized, deduplicated) programmatically. Done in #2682.

--on-invalid CLI argument

The on_invalid setting (which controls whether Martin warns or aborts when it encounters an invalid source at startup) was previously config-file-only. It is now available as --on-invalid <warn|abort> on the command line, which is especially handy in CI/CD and container environments.

Done in #2668 by @Auspicus.

Other

  • Introduced TileSourceManager and ReloadAdvisory as groundwork for future live-reload of tile sources (#2661) by @Auspicus
  • Added hotpath-based profiling integration (#2663)
  • Enabled React Compiler for martin-ui and demo frontend (#2686)
  • Enabled clippy::unwrap_used workspace lint (#2670)
  • Ensured unit tests run on macOS (#2648) by @Weixing-Zhang
  • Various dependency bumps (#2702, #2684, #2624, #2662, #2657)

Don't miss a new martin release

NewReleases is sending notifications on new releases.