icipe-official / vectoratlas-software-code

MIT License
1 stars 4 forks source link

Add tile caching to improve performance #111

Closed ray-millward-tessella closed 2 years ago

ray-millward-tessella commented 2 years ago

Add route caching to the nginx proxy for the tile server tiles to avoid on the fly calculation. Each call to the tile server causes it to calculate the tile needed for the request.

We should add caching to the nginx reverse proxy to cache calls to the /data/ route for pbf files and png files (or whatever file format is returned for the tiles). The cache time should be set to 1 hr for now to allow for updates to the model overlays if needed.

We should also add preloading to the map component in the UI https://openlayers.org/en/latest/examples/preload.html

Acceptance criteria:

colin-turner-cg commented 2 years ago

AC met: 1) png tile files have the header: Cache-Control: max-age=3600 2) At a high (high = zoomed in) zoom level map behavior when panning/adjusting zoom is similar to that here: https://openlayers.org/en/latest/examples/preload.html. I've confirmed using my local log that the tileserver isn't called when performing panning actions at high zoom. I can also see that the X-Cache-Status has the value HIT when loading the map in a different broswer.