如何使App Engine / Java应用程序在Java / Python Web cron的聋人请求中运行? [英] How to keep an App Engine/Java app running with deaf requests from a Java/Python web cron?

查看:131
本文介绍了如何使App Engine / Java应用程序在Java / Python Web cron的聋人请求中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. App Engine允许您加载应用程序30秒钟。
  2. 我的应用程序需要大约30秒 - 有时更多,有时更少。我不知道如何解决这个问题。

  3. 如果应用程序空闲(暂时没有收到请求),它需要重新加载。

因此,为了避免应用程序需要重新加载,我想通过每隔一段时间ping应用程序来模拟用户活动。 p>

但有一个问题。 。 。

如果我ping了应用程序并且它已被App Engine卸载,我的Web请求将成为应用程序的第一个请求,应用程序将尝试重新加载。这可能需要超过30秒,并超过加载时间限制。



所以我的想法是ping应用程序,但不等待响应。我通过从浏览器进入网站手动模拟了这一点,提出请求并立即关闭浏览器 - 它似乎让应用程序保持活跃状态​​。



任何关于在Python或Java Web cron中做这件事的好方法(我假设Python解决方案会更简单)?

解决方案

使用内置于App Engine的 cron 保持您的应用程序活着。


  1. App Engine allows you 30 seconds to load your application
  2. My application takes around 30 seconds - sometimes more, sometimes less. I don't know how to fix this.
  3. If the app is idle (does not receive a request for a while), it needs to be re-loaded.

So, to avoid the app needing to be reloaded, I want to simulate user activity by pinging the app every so often.

But there's a catch . . .

If I ping the app and it has already been unloaded by App Engine, my web request will be the first request to the app and the app will try to reload. This could take longer than 30 seconds and exceed the loading time limit.

So my idea is to ping the app but not wait for the response. I have simulated this manually by going to the site from a browser, making the request and immediately closing the browser - it seems to keep the app alive.

Any suggestions for a good way to do this in a Python or Java web cron (I'm assuming a Python solution will be simpler)?

解决方案

It would probably be easier use the cron built in to App Engine to keep your application alive.

这篇关于如何使App Engine / Java应用程序在Java / Python Web cron的聋人请求中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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