Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a JRuby application on App Engine take so long to start (versus a Python app)?

I'm considering using JRuby on App Engine but have heard that Juby app on App Engine have a long startup lag versus a Python app. Why is this?

Is it because the JRuby jar files are so large that a cold startup requires them to be loaded into memory before the app can start serving? That would be my guess but I'm not sure if that's a precise technical explanation. And, if so, why is Python different?

like image 630
Major Tom Avatar asked Dec 28 '22 21:12

Major Tom


1 Answers

That's basically it. When your app hasn't been used in a while, App Engine swaps it out until another request comes in.

When that happens, it loads all the JARs your app requires, which may take a very long time, upwards of 10-15+ seconds in some cases.

I don't have any experience with JRuby in particular, but this page has some tips on how to reduce your app's cold start time. The tips should be useful even if you're not strictly writing vanilla Java.

Basically, just don't include any JARs that your app doesn't rely heavily upon.

like image 184
Jason Hall Avatar answered Dec 31 '22 11:12

Jason Hall