OpenCDSS / cdss-website-opencdss

Colorado's Decision Support Systems website for OpenCDSS (MkDocs project)
3 stars 1 forks source link

Figure out how to minimize latency of time to live updates to website #14

Open smalers opened 3 years ago

smalers commented 3 years ago

Uploading the MkDocs-generated website to the Google Cloud Platform files results in a latency. Browsers that have the website cached do not show the new content for awhile. And, sometimes viewing the website in an incognito window shows an incomplete website. There should be a way to "invalidate" the files so that the Google services refresh the cache and people see the latest content. This will require research of Google web services. I'm not sure if this is something I should do under OpenCDSS and if so how high a priority it is. It could be simple to resolve or take some time to do the research.

smalers commented 2 years ago

See this Stack Overflow article, which indicates that the default cache expiration is 3600 seconds. I am familiar with using CloudFront on AWS, which allows invalidation after uploading files. OIT set up a load balancer for OpenCDSS. Based on information provided about that, it looks like load balancing has been implemented without Cloud CDN. Therefore, I don't think it is possible to invalidate the cloud storage files immediately after uploading. Keep this open in case a full CDN is implemented.

smalers commented 2 years ago

Mikhail from OIT suggested adding the following header to files. That makes sense for some top-level index.html files that are "manually" created. I'll give it a try when I do updates.

Cache-Control:no-cache, max-age=0"
smalers commented 2 years ago

Actually, I had already tried such things. I think the problem is not the browser caching, it is that once a file is uploaded to GCP storage, there is a latency (default of 3600 seconds) in that version being publicly visible, due to internal caching in the GCP stack. This problem may not be resolved unless a CDN is implemented. Keep open as a placeholder. Maybe the State will implement a CDN for the OpenCDSS bucket and then files can be invalidated.