将请求定向到 Google 云上的实例
Directing requests to instance on Google Cloud
是否可以根据请求将某些请求组合在一起 url 以确保类似的请求发送到同一实例?
例如
我的应用引擎有多个实例
myurl.com?foo=abc // 多个人输入这个 url 都会去同一个实例
myurl.com // 我不在乎这是哪一个
我认为您无法控制哪个 instance
处理 url 模式。
如果您想将某些 url 发送到某个 service
,您需要的是 dispatch.yaml
,它正是这样做的。您可以使用正则表达式来定制您想要的方式。通过某种策略,您可以将 urls 与(组)实例匹配,尽管它们将位于不同的服务中。如果您的网站流量不多,您基本上可以为每个服务创建一个实例,并完成您想要的。
dispatch:
# don't forget: gcloud app deploy dispatch.yaml after changes !!!
- url: "*/some/high/memory/urls/*"
service: my_high_memory_service
- url: "*/some/fast/cpu/url"
service: my_fast_cpu_service
- url: "*/.*"
service: default
更多信息位于:https://cloud.google.com/appengine/docs/standard/python/reference/dispatch-yaml
是否可以根据请求将某些请求组合在一起 url 以确保类似的请求发送到同一实例?
例如 我的应用引擎有多个实例
myurl.com?foo=abc // 多个人输入这个 url 都会去同一个实例
myurl.com // 我不在乎这是哪一个
我认为您无法控制哪个 instance
处理 url 模式。
如果您想将某些 url 发送到某个 service
,您需要的是 dispatch.yaml
,它正是这样做的。您可以使用正则表达式来定制您想要的方式。通过某种策略,您可以将 urls 与(组)实例匹配,尽管它们将位于不同的服务中。如果您的网站流量不多,您基本上可以为每个服务创建一个实例,并完成您想要的。
dispatch:
# don't forget: gcloud app deploy dispatch.yaml after changes !!!
- url: "*/some/high/memory/urls/*"
service: my_high_memory_service
- url: "*/some/fast/cpu/url"
service: my_fast_cpu_service
- url: "*/.*"
service: default
更多信息位于:https://cloud.google.com/appengine/docs/standard/python/reference/dispatch-yaml