How to keep an App Engine/Java app running with deaf requests from a Java/Python web cron?

烂漫一生 提交于 2019-12-01 08:21:41

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

I think what you want is just:

import httplib
hcon = httplib.HTTPConnection("foo.appspot.com")
hcon.request("GET", "/someURL")
hcon.close()

the simplest Java http pinger:

URLConnection hcon = new URL("http://www.google.com").openConnection();
hcon.connect();
hcon.getInputStream().read();

App engine also has a new PAY feature where you can have it "always-on". Costs about $0.30 USD cents a day. Just go into your billing settings and enable it if you don't mind paying for the feature. I believe it guarantees you at least 3 instances always running.

(I didn't realize hitting a /ping url which caused an instance to spin up would cause it to exceed the 30 sec limit!)

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