How do I configure Warming Requests avoiding error

2019-03-29 12:02发布

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?

1条回答
等我变得足够好
2楼-- · 2019-03-29 12:32

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.

查看更多
登录 后发表回答