如何在应用程序日志中配置避免错误404的预热请求? [英] How do I configure Warming Requests avoiding errors 404 on app's log?

查看:96
本文介绍了如何在应用程序日志中配置避免错误404的预热请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已启用加温请求添加到我的应用程序中,在 app.yaml 中添加以下指令。

  inbound_services:
- warmup

查看应用程序的日志, kind:


1。
01-05 02:49 PM 50.037 / _ah / warmup 404 300ms 280cpu_ms 1kb
查看详情

  0.1 .0.3  -   -  [05 / Jan / 2011:05:49:50 -0800]GET / _ah / warmup HTTP / 1.1404 1188 

2。
I 01-05 02:49 PM 50.336

这个请求导致了一个新的进程
被启动用于你的应用程序,

,从而导致您的应用程序代码
被首次加载。

此请求可能需要很长时间,并且
使用的CPU数多于一个典型请求


这很有意义,因为 Warming Requests 文档中提到:


这会导致App Engine
基础架构向/ _ah / warmup发出GET请求
。您可以在此目录中实现
处理程序,以执行
特定于应用程序的任务,例如
预缓存应用程序数据。


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



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

解决方案

/ _ ah / 很好,尽管这些文档可能导致你相信。



所以,是的,只需将一个处理程序映射到 / _ ah / warmup 以使预热请求起作用。不过,我不确定使用空处理程序会带来多少好处。通常你会想要导入所有重要的模块,并做任何缓存预热,你的应用需要响应。


I have enabled Warming Requests to my app, adding the following directive in app.yaml.

inbound_services:
- warmup

Looking at app's log I see several entries of this kind:

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.

This makes sense because the Warming Requests documentation says:

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 ah is a reserved URL, i.e. script handler and static file handler paths will never match these paths!

Should I simply add the ah/warmup route associating it to an empty web handler for example? Is this correct?

解决方案

Urls starting with /_ah/ work just fine, despite what the documentation might lead you to believe.

So, yes, just map a handler to /_ah/warmup to make the warmup requests work. I'm not sure how much benefit you'll get from using an empty handler, though. Usually you'd want to import all of your important modules and do any cache warmups your app needs to be responsive.

这篇关于如何在应用程序日志中配置避免错误404的预热请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆