【问题标题】:Google Cloud Platform: CDN cache misses when switched backend serviceGoogle Cloud Platform:切换后端服务时 CDN 缓存未命中
【发布时间】:2018-03-18 02:44:23
【问题描述】:

我有一个带有两个后端服务的负载平衡器设置。 LB 上的 URL 映射如下所示:

site.com -> backend-blue
test.site.com -> backend-green

两个后端服务都启用了 CDN。我可以看到后端蓝色服务的缓存命中率约为 96%。然后我在 LB 上切换了后端服务:

site.com -> backend-green
test.site.com -> backend.blue

后端绿色的缓存命中率变为 60%,我开始收到 502 错误。

缓存键保持不变,因此我预计会看到相同的缓存命中率约为 95%。

为什么缓存条目已被逐出,请求通过 LB 而不是由 CDN 提供服务?

【问题讨论】:

    标签: google-cloud-platform google-cloud-cdn


    【解决方案1】:

    CDN 缓存应用于 backendService 级别。 https://cloud.google.com/compute/docs/reference/rest/v1/backendServices#BackendService.FIELDS.enable_cdn

    当你将流量切换到绿色后端时,它的缓存是空的。

    要保留缓存,不要修改 URL 映射,而是将主 backendService 更改为使用绿色的 instanceGroup。 https://cloud.google.com/compute/docs/reference/rest/v1/backendServices#BackendService.FIELDS.backend

    【讨论】:

    • 啊,这很有意义。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2018-11-02
    • 2016-02-19
    • 2018-12-14
    • 1970-01-01
    • 1970-01-01
    • 2020-05-31
    • 2020-09-02
    • 2016-04-08
    相关资源
    最近更新 更多