akamai 在部署前刷新缓存并在指定时间进行切换
我的目标是在部署过程中实现零停机。我的网站使用 akamai 作为 CDN。假设我有主要和辅助 IIS 服务器集群。在部署期间,将对辅助集群进行更新。在从主设备切换到辅助设备之前,我可以请求 akamai 缓存内容并在指定时间进行切换吗?
My objective is to achieve zero downtime during deployment. My site uses akamai as CDN. Lets say I do have primary and secondary cluster of IIS servers. During deployment, the updates are made to secondary cluster. Before switchover from primary to secondary, can I request akamai to cache the content and do a cutover at a specified time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将遇到的问题是确保您的内容缓存在所有 akamai 服务器上。您是否希望在切换后立即强制刷新内容?
这里有几个选项。
1 - 在请求“?v=1”中使用版本。该版本始终会从源请求,并将附加到每个请求中。一旦您更新站点,请更新源版本,以便下一个请求将附加“?v=2”,从而“破坏”缓存并强制所有请求都命中源
2 - 将您的 akamai 配置更改为“honor”网络服务器 TTL”。然后,您可以在切换前设置非常低或几乎为 0 的 TTL,然后在切换后逐渐增加
3 - 配置 akamai 以使用 If-MOdified-Since。这将迫使 akamai“验证”是否有任何请求发生更改。
4 - 使用 ECCU,它可以清除整个目录,但这可能需要长达 40 分钟的时间,但在维护窗口期间应该是可以管理的。
The problem you are going to have is to guarantee that your content is cached on ALL akamai servers. Is the issue that you want to force content to be refreshed as soon as you cutover?
There are a few options here.
1 - Use a version in the requests "?v=1". This version would ALWAYS be requested from origin and would be appended to every request. As soon as you update your site, update the version on origin, so that the next request will append "?v=2" thus "busting" the cache and forcing an origin hit for all requests
2 - Change your akamai config to "honor webserver TTLs". You can then set very low or almost 0 TTLs right before you cut over and then increase gradually after you cutover
3 - Configure akamai to use If-MOdified-Since. This will force akamai to "validate" if any requests have changed.
4 - Use ECCU which can purge a whole directory, but this can take up to 40 minutes, but should be manageable during a maint window.
根据我在 Akamai 的经验,我认为这是不可能的(但事情变化的速度比我能跟上的快) - 您可以手动刷新内容(需要付费),这样您就可以刷新 /* 我们曾经这样做过对于部署期间的特定文件(从不使用 /*,因为我们有超过 120 万个 URL),但我看不出 Akamai 如何缓存站点的不可见版本以便在没有某些辅助域和源的情况下进行即时切换。
不过,我还发现 Akamai 非常好相处,绝对值得联系他们寻求解决方案。
I don't think this would be possible based on my experience with Akamai (but things change faster than I can keep up with) - you can flush the content manually (at a cost) so you could flush /* we used to do this for particular files during deployments (never /* because we had over 1.2M URLs) but I can't see how Akamai could cache a non-visible version of your site for instant cut-over without having some secondary domain and origin.
However I have also found that Akamai are pretty good to deal with and it would definitely be worth contacting them in relation to a solution.