Repository metrics
- Stars
- (3,761 stars)
- PR merge metrics
- (PR metrics pending)
Description
CDNs rely heavily on etag (usually a hash) to identify if the tile has changed or not. In some cases, the tile backend like .mbtiles is already storing tiles with some hash. For example, .mbtiles frequently uses two tables to remove duplicate tiles - one stores z, x, y, hash columns, and another table - hash, data blob.
Currently, we implement this via running a non-cryptographical hash function over the output. We do this even in cases where there is a hash that we could serve causing unnessesary CPU usage (latency is basically instant).
=> Implementing this optimisation would net us about 5% cpu time reduction which we could use to serve a few more tiles at the extreme end (likely you are network bound at the 200k/s mark)
Steps involved:
- make mbtiles backend recognize when the
.mbtilesfile has two frequently used tables as described above, and use the hash value as etag https://github.com/maplibre/martin/pull/1787 - in the individual backends like mbtiles to supply a pre-generated etag
- individual backends like mbtiles supply a pre-generated etag
- PostgreSQL functions return rows with two columns, treating the second column as the key. OpenMapTiles already generates these types of functions.
- support etags for
/catalog