How does the warmup service work in python google app engine?

走远了吗. 提交于 2020-01-02 07:25:31

问题


Can someone give an example of how the warmup inbound service works in the python runtime of Google App Engine?

I've read this: http://code.google.com/appengine/docs/python/config/appconfig.html#Inbound_Services, but it doesn't give me much of an example after the GET request is sent (I can't seem to ever pick it up)

My app.yaml looks like this:

application: whatevs
version: 1
runtime: python
api_version: 1

builtins:
- datastore_admin: on

inbound_services:
- warmup

handlers:
- url: /static
  static_dir: static

- url: /_ah/warmup
  script: main.py
  login: admin 

- url: /.*
  script: main.py

my main.py looks like this:

def main():
    application = webapp.WSGIApplication(
                     [("/", views.LandingPage),
                      ("/_ah/warmup", views.WarmupHandler)
                      ],
                     debug=True)
    run_wsgi_app(application)

WarmupHandler looks like this:

class WarmupHandler(webapp.RequestHandler):
    """
    Called on app init
    """
    def get(self):
        current_user = users.get_current_user()
        return

However, WarmupHandler never seems to get called (I have breakpoints and lots of debug code). What am I doing wrong?


回答1:


App Engine sends warm up requests only if there is some constant traffic on your app. It won't get always called if instances stand mostly idle.



来源:https://stackoverflow.com/questions/8235716/how-does-the-warmup-service-work-in-python-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!