通过Google App Engine上的Cron Job来加速页面 [英] Cron Job on Google App Engine to Speed up pages

查看:103
本文介绍了通过Google App Engine上的Cron Job来加速页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安排Google App Engine上的cron作业每10分钟左右查看我的5个主页,以保持当前实例的正常运行并提高用户的页面速度.我了解创建cron作业的所有基本语法,但我很好奇python的外观.我是否只需要做5个不同的Cron作业,并让每个作业都获取一个URL?

I want to schedule a cron job on Google App Engine to view my 5 main pages every 10 minutes or so to keep a current instance up and running and to increase page speed for users. I understand all of the basic syntax for creating a cron job but I am curious what the python would look like for that. Do I simply need to make 5 different cron jobs and have each one fetch a URL?

推荐答案

要回答您的特定问题,这样的cron.yaml可能看起来像这样:

To answer your specific question, such a cron.yaml could look like this:

cron:
- description: five minute run
  url: /refresh
  schedule: every 5 minutes

其中/refresh是您在应用程序中编写的处理程序,然后自动将其命名为N分钟.

where /refresh is a handler you've written in your app that is then called even N minutes automatically.

E.G.myapplication.appspot.com/refresh

E.G. myapplication.appspot.com/refresh

无需刷新特定页面或多个页面.只需调用处理程序即可使您的应用程序继续运行.

There's no need to refresh a specific page or more than one. Just having the handler called will keep your app alive.

但是,正如其他人所指出的那样,这对于保持应用程序永久温暖来说有点不足.

But as others have noted, this is a bit much to keep an app permanently warm.

这篇关于通过Google App Engine上的Cron Job来加速页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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