consbio / mbtileserver

Basic Go server for mbtiles
ISC License
655 stars 104 forks source link

Serve tiles from blob-storage #158

Closed thomafred closed 1 year ago

thomafred commented 1 year ago

Hi there,

We are generating tiles using tippacanoe and storing the resulting tiles in our azure blob storage.

It would be great if mbtileserver could support service such tiles from blob instead of just a local file system.

brendan-ward commented 1 year ago

Thanks for the suggestion @thomafred

I'm not super familiar with the performance implications of using blob storage in this way - so please feel free to reopen this issue and correct me if I'm wrong - but this seems potentially highly inefficient. mbtileserver is simply leveraging existing SQLite drivers to perform random reads within the binary SQLite mbtiles file; thus it assumes it has access to the full file in order to satisfy any query. SQLite isn't a cloud-optimized format that supports range read requests to read a smaller sequence of bytes from blob storage.

I think for your use case PMTiles is likely to be a much better fit. The file storage mechanism was designed from the beginning to be cloud-optimized for use cases similar to yours - and would obviate the need to have an intermediate tile server like mbtileserver. Any compatible client could just perform a few range read requests against the PMTiles file on blob storage, meaning you could have a browser client read directly from blob storage instead of a server in between.

I'm going to close this because I don't think it is the right use case for mbtileserver based on my existing understanding of SQLite files and blob storage.