Google App Engine 上无限循环的后果?

发布于 2024-09-04 02:14:53 字数 139 浏览 4 评论 0原文

我不是 Google App Engine 用户。不过,据我了解,您需要按 CPU 时间和其他资源付费。如果你碰巧创建了无限循环,会产生什么后果?谷歌会终止它,还是你必须自己手动完成?

我是一名业余开发者,担心一个小错误可能最终导致数百美元的损失。

I am not a Google App Engine user. However, I understand you're billed for CPU time and other resources. What are the consequences if you happen to create an infinite loop? Will Google ever terminate it, or will you have to do it yourself manually somehow?

I'm a hobbyist developer worried about a small error that might end up costing hundreds.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月下客 2024-09-11 02:14:53

(我是 Google 员工,但对 AppEngine 的经验很少。请不要将此视为“官方”回复。)

我猜您正在使用 Java servlet API - 如果没有,请说明。

来自 AppEngine Servlet 文档

请求处理程序的数量有限
生成并返回一个的时间
对请求的响应,通常
大约30秒。一旦截止日期
已到达,请求处理程序
被中断。

我不知道这种情况如何/是否发生在紧密循环中,这不允许虚拟机在“正常”Java 中中断它。

(I'm a Google employee but have little experience with AppEngine. Please don't consider this an "official" response.)

I'm guessing you're using the Java servlet API - if not, please specify.

From the AppEngine servlet docs:

A request handler has a limited amount
of time to generate and return a
response to a request, typically
around 30 seconds. Once the deadline
has been reached, the request handler
is interrupted.

I don't know how/whether this occurs in a tight-loop which wouldn't allow the VM to interrupt it in "normal" Java.

虽然 Jon 处理了无限循环的低级别情况,但也可能存在一种情况,即您的一个处理程序被重复调用过多次 - 也许您不小心配置了某些东西来每秒备份整个数据存储,而不是每天一次。理论上,您可能会消耗大量资源,即使是 30 秒的块。但是,您仍然不会面临收取巨额费用的危险。您可以选择设置每天“花费”的限额。如果您没有剩余配额,您的应用程序将返回错误,而不是将您送入债务人监狱。

While Jon handled the low level case of an infinite loop, there could also be a situation where one of your handlers is called repeatedly an excessive amount of times - perhaps you accidentally configure something to back up your entire datastore every second instead of once a day. Theoretically, you could use up a lot of resources, even in 30 second chunks. However, you would still not be in danger of racking up a huge amount of charges. You have the option of setting a limit on how much you want to "spend" per day. If you have no quota left, your app will return an error, not put you into debtor's prison.

め可乐爱微笑 2024-09-11 02:14:53

Google AppEngine 对请求终止前可能需要的时间设置了限制,

有一个 大约 30 秒的限制,规定请求在终止之前必须花费多长时间。但是,在进程终止前不久,将引发 DeadlineExceededError 异常。

此外,还有每分钟配额,可防止应用程序短时间内消耗过多配额。在正常情况下,您的应用程序不太可能超出每分钟配额,但如果需要,可以增加此配额可以请求

Google AppEngine imposes a limit on how long a request may take before it is terminated,

There is a roughly 30 second limit imposed on how long a request must take before it is terminated. However, shortly before the process is terminated, a DeadlineExceededError exception will be thrown.

Additionally there are per-minute quotas to prevent the application from consuming too much quota in a short period of time. It is very unlikely that your application will exceed the per-minute quota under normal conditions, but, if needed an increase to this quota can be requested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文