Google AppEngine:“运行时启动”发生的频率

时间:2009-07-16 13:56:53

标签: java google-app-engine

我打算在Google AppEngine / Java上托管一个JRuby on Rails应用程序。我找到a great blog post by Ola Bini关于如何做到这一点,但在摘要中他说:

  

总的来说,JRuby on Rails非常有用   在App Engine上,除了   一些较小的细节。主要的   是启动成本和测试。如   它发生了,你实际上得不到   GAE / J预先制作东西。代替   你必须让第一个版本发布   采取这个打击。现在,GAE / J做到了   允许预先验证字节码和   等等,所以启动有点重   而不是其他JDK。 一个运行时需要   大约20秒的启动时间,   所以第一次打击需要一些时间。

我不完全理解这一点。在什么情况下,运行时需要多长时间才能启动?常规的20秒滞后可能是一个问题。

1 个答案:

答案 0 :(得分:7)

只要需求超过当前运行的实例,App Engine就会为您启动新的运行时。然后,当需求降低时,它将关闭实例。最终,这意味着如果您的应用程序在一段时间内未使用,则可以关闭所有实例。然后,下次用户尝试访问您的应用时,需要启动一个新实例,或者像某些人所说的那样“旋转”。

截至3月份,应用引擎团队不会对实例保持多长时间进行任何官方评估:


7:40pm] nwinter:  Is it possible to get a rough estimate of how long an app
instance will stick around once spawned?
[7:40pm] marzia_google: @nwinter, not really
[7:40pm] marzia_google: there are no garuntees
[7:41pm] nwinter:  No average time or anything?
[7:42pm] marzia_google: @nwinter i'm not sure an average time would be
meaningful, even if i knew off hand what it was ( i don't)
[7:42pm] marzia_google: since it really can be quite variable
[7:42pm] Kardax: Re instance lifetime: So an app instance could last a few
seconds or a few hours?  Just curious
[7:43pm] dan_google: nwinter: Apps are evicted by least-recently-used on an
app server.  As someone noted recently (forums or chat I forget), low
traffic could mean lots of "restarts", but so could spikes in traffic which
may start new instances on multiple app servers.
[7:43pm] nwinter:  @dan_google: good to know!
[7:43pm] dan_google: Kardax: Yes, depending on the weather.  By which I
mean, request patterns, other apps on each app server, and so forth.  Not
really predictable. 

这是与应用引擎团队聊天的记录。我删除了成绩单中的非相关行,如“so so so logged in”。完整的成绩单可以找到here