gpt4 book ai didi

python - 如何配置 Warming Requests 以避免应用程序日志中出现错误 404?

转载 作者:太空狗 更新时间:2023-10-30 00:08:30 26 4
gpt4 key购买 nike

我启用了 Warming Requests在我的应用程序中,在 app.yaml 中添加以下指令。

inbound_services:
- warmup

查看应用程序的日志,我看到了几个此类条目:

1. 01-05 02:49PM 50.037 /_ah/warmup 404 300ms 280cpu_ms 1kb See details

0.1.0.3 - - [05/Jan/2011:05:49:50 -0800] "GET /_ah/warmup HTTP/1.1" 404 1188 

2. I 01-05 02:49PM 50.336

This request caused a new process to be started for your application,
and thus caused your application code to be loaded for the first time.
This request may thus take longerand use more CPU than a typical request
for your application.

这是有道理的,因为 Warming Requests 文档说:

This causes the App Engine infrastructure to issue GET requests to /_ah/warmup. You can implement handlers in this directory to perform application-specific tasks, such as pre-caching application data.

AFAIK ahreserved URL ,即脚本处理程序和静态文件处理程序路径永远不会匹配这些路径!

例如,我是否应该简单地添加 ah/warmup 路由,将其关联到一个空的 Web 处理程序?这是正确的吗?

最佳答案

/_ah/ 开头的网址工作得很好,尽管文档可能会让您相信。

所以,是的,只需将处理程序映射到 /_ah/warmup 即可使预热请求生效。不过,我不确定使用空处理程序会给您带来多少好处。通常,您会希望导入所有重要模块并进行应用响应所需的任何缓存预热。

关于python - 如何配置 Warming Requests 以避免应用程序日志中出现错误 404?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4605228/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com