-
Very happy to see the project is growing, and that Cloudflare R2 is now generally available. I think I could try hosting my PMTiles there, after reading Why deploy Protomaps on a CDN? and Protomaps on Cloudflare, but pricing is scary...
So, if users start scraping tiles -- as is the common bad-practice for raster tiles -- bill can sky-rocket. On the plus side it seems there are various rate limiting options, that are probably worth a shot:
So it seems for a hobby project (low scale so low cache reuse opportunity), if ZXY compatibility is not needed, using only R2 directly is fine and would be less costly? The main issue I see is the bad concurrent-range request browser support (as per #16 / https://cesiumjs.s3.amazonaws.com/caching/index.html ). Also, IIUC, smarter hilbert-aware batching of tile request would not help when workers are involved, only for direct protomaps-js → R2 requests -- which could make this option more cost-effective and alleviate the issue above. Am I right? Do you have feedback from running your workloads, and demos like https://protomaps.github.io/protomaps-themes/examples/maplibre-basemap.html ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Using R2 or S3 directly without the CDN is the recommended deployment method for hobby projects. Range requests work fine concurrently on R2 because it uses HTTP/2, but the latency is poor right now (can spike to 1-2 seconds). Batching tile requests would affect only the direct-to-storage option, correct. That could be implemented in a modular way at the |
Beta Was this translation helpful? Give feedback.
you can set
CACHE_MAX_AGE
in the Workers script and choose 1 week or 1 month. a 50% cache hit rate is a reasonable guess at longer cache ages.Range reads are Class B operations, which are $0.36 per million.
1000 tiles per session is pretty unusual, I would estimate an average of 20-50 tiles per user session, of course it depends on your application.
The possibility of users scraping tiles is present for any public-facing API, even if you use a hosted SaaS.
Using R2 or S3 directly without the CDN is the recommended deployment method for hobby projects. Range requests work fine concurrently on R2 because it uses HTTP/2, but the latency is poor right now (can spike to 1-2 seconds).
…