-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS 2-6: Evaluate Adding Hybrid Tiling Endpoint #10
Comments
Adds the 2023 IO LULC layer to the layer settings, pointing at the static tiles that were generated and uploaded to the Datahub S3 bucket. This is just a preview of the layer, since the tiles were only generated through z8 and this static source will ultimately be replaced by a hybrid static/dynamic TiTiler setup (see WikiWatershed/mmw-tiler#10 and WikiWatershed/mmw-tiler#11).
Adds the 2023 IO LULC layer to the layer settings, pointing at the static tiles that were generated and uploaded to the Datahub S3 bucket. This is just a preview of the layer, since the tiles were only generated through z8 and this static source will ultimately be replaced by a hybrid static/dynamic TiTiler setup (see WikiWatershed/mmw-tiler#10 and WikiWatershed/mmw-tiler#11).
After some conversations and some experimentation in the staging AWS console, I have a picture of how I think this should work. It's not exactly what's described here and on issue #11, but I think it would achieve the goal in a way that takes advantage of existing resources and would be reasonably straightforward to implement and maintain. The big difference is that rather than modify TiTiler-MosaicJSON to be able to return cached tiles and write generated tiles to the cache bucket, it would leave the TiTiler-MosaicJSON API unchanged but put a CloudFront distribution in front of it that would send some tile requests on to the API but handle others from an S3 bucket that we manually populate with pregenerated tiles. InfrastructureSo the infrastructure would be:
This would have some advantages and some disadvantages vs the idea of adding the cache behavior into TiTiler-MosaicJSON:
DeploymentThe question of how to deploy the new infrastructure while keeping the existing TiTiler-MosaicJSON endpoint is a bit tricky. The current deployment uses https://github.com/Element84/filmdrop-aws-tf-modules, so this repo only includes some config files and a Github Actions workflow that checks out and applies the Filmdrop deployment code. Which is pretty slick and provides a lot of functionality without a lot of new code or config, but it doesn't lend itself super-well to adding additional infrastructure or modifying what's included in the FilmDrop deployment beyond toggling which major components are desired. Specifically, the challenge here is that we want an S3 bucket that's not provided by the FilmDrop deployment and we want the CloudFront distribution that sits in front of the TiTiler service to have an additional origin and some custom behaviors. One way to make that happen would be to raid The other possibility, which seems a little messier but would preserve the benefit of relying on The first big hurdle for the latter approach is the CloudFront distribution—there already is one, so we would need to either switch that part of the deployment off and make our own (reducing the benefit of using the existing deployment framework) or find a way to modify it. One other note re deployment: most of the MMW resources are in Proof-of-conceptI manually created a proof-of-concept implementation in the staging AWS account, so if you change the "IO Global LULC 2023" layer config in your MMW instance to set |
@rajadain since this isn't a PR but the next step is review, I added you as an additional assignee. |
👏 👏 fantastic work! Really detailed and well written plan. Here's some thoughts:
Give the above, we should timebox checking if the check-s3-first-then-fetch-from-source pattern can be implemented in a CloudFront Function or Lambda@Edge. The main issue I foresee there is writing to S3, which we would have to for all data fetched from the source on an S3 miss. I don't know if that can be done from CloudFront Functions or Lambda@Edge. If not easily and obviously possible, we should pivot to add this new endpoint to Windshaft in the current implementation of MMW: https://github.com/WikiWatershed/model-my-watershed/tree/develop/src/tiler. For a given layer code, the Windshaft server should query the TiTiler CloudFront (instead of Postgres like it currently does for all other layer codes), and use the S3 cache just as it does for the other layers. The main disadvantage of using Windshaft for the above is the lack of massive parallelization we get with TiTiler, which being Lambda driven can scale horizontally to a great extent. But Windshaft has worked well enough for us so far, so its quite possible that it will continue to scale for a while before reaching its limit. |
If we go with Windshaft, since that is running in The reason for putting this in Let me know if the above makes sense. |
Summarizing the huddle @rajadain and I had this afternoon:
That will require implementing a new route and method in our Windshaft deployment that gets tiles from an external endpoint rather than from the database. The rollout will be a little bit complex, because the mosaic UUIDs will need to be generated for the production environment and provided to Windshaft. So we'll need to do the TiTiler-MosaicJSON deployment in advance, then do the manual mosaic creation and tile pregeneration, then provide the endpoint and year->UUID mapping to the production Windshaft deployment via Ansible variables. Re what region to deploy to: as noted above, the data is in |
As of #9, we'll have static tiles for lower zoom levels, but we'll use regular TiTiler operation for higher zoom levels. This should be transparent to the front-end, which should hit only one endpoint. This card is to create that proxy endpoint which handles these decisions.
Because TiTiler is cloud-native, with each tile request spinning up its own Lambda, it makes sense to add the proxy endpoint to TiTiler itself (or more precisely, to the TiTiler-MosaicJSON fork).
This card is to:
The text was updated successfully, but these errors were encountered: