Closed dmahr1 closed 3 years ago
This was implemented in https://github.com/geospatial-jeff/aiocogeo/pull/90, will be included in the next release!
Amazing! You're a hero, @geospatial-jeff. I was planning to play around with this over the holidays but you beat me to it!
https://cogeotiff.slack.com/archives/C01DE57GLHE/p1603130953009500
Summary
Consider a case where
N
unique tile requests are made to a single COG. Despite theENABLE_CACHE
environment variable being enabled, all requests would be cache misses. Thus at least2 * N
range requests would need to be made to the COG. But if the COG header were cached separately, then only1 + N
range requests would need to be made.Details
I plan to incorporate
aiocogeo
within a traditional tile server middleware that handles regularz/x/y.png
requests. These currently read PNG tiles that are stored as a tile pyramid in bucket storage. This dated architecture is space inefficient but very performant. I'm hoping to achieve the space savings of COGs (via YCbCr JPEG compression + GDAL mask bands) without a meaningful increase in latency. One way to eliminate that latency is by caching the header in redis or another fast cache available to many servers. For example:(z, x, y)
forcog.tif
in cloud bucket storage. Networking layer routes it to COG server 1 (one of many COG servers).cog.tif
header, but it's not found. CACHE MISS.cog.tif
header.cog.tif
header in redis.(z, x, y)
tile data.(z, x, y)
tile data to client.(z, x + 1, y)
forcog.tif
in cloud bucket storage. Networking layer routes it to COG server 2.cog.tif
header and it's found. CACHE HIT.(z, x + 1, y)
tile data.(z, x + 1, y)
tile data to client.The two italicized operations for the first request are not necessary for the second request.