Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google AppEngine: how often does a "runtime startup" occur

I'm planning on hosting a JRuby on Rails app on Google AppEngine/Java. I found a great blog post by Ola Bini on how to to this, but in the summary he says:

Overall, JRuby on Rails works very well on the App Engine, except for some smaller details. The major ones are the startup cost and testing. As it happens, you can’t actually get GAE/J to precreate things. Instead you’ll have to let the first release take the hit of this. Now, GAE/J does a let of preverifying of bytecodes and so on, so startup is a bit more heavy than on other JDKs. One runtime takes about 20 seconds wall time to startup, so the first hit takes some time.

I don't fully understand this. How often, under what circumstances, will a runtime need to be started up? A regular 20 second lag is likely to be an issue.

like image 278
User 42 Avatar asked Jul 16 '09 13:07

User 42


1 Answers

App Engine will start new runtimes for you whenever demand is outstripping the currently running instances. It will then shut down instances when demand is lower. Ultimately, this means that all of your instances could be shut down if your app is not used for a certain amount of time. Then, the next time a user tries to access your app, a new instance will need to be started, or "spun up" as some people call it.

As of March, the app engine team wouldn't give any official estimate on how long an instance will stay up:


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. 

This is the transcript of a chat with the app engine team. I have deleted the non-relevant lines in the transcript like "so and so logged in." The full transcript can be found here

like image 64
Peter Recore Avatar answered Sep 23 '22 02:09

Peter Recore