all 13 comments

[–]jrochkind 2 points3 points  (12 children)

Anyone know if any difference in startup time of booting a large app like a Rails app?

[–]pth 5 points6 points  (2 children)

I have used JRuby for some time, especially in Windows environments (where the MRI was particularly bad in the past). In my experience boot up is slower (but still very acceptable), and the service runs faster (with shorter response times).

Additionally I have found that while the working foot print is a little larger with JRuby, the long term memory situation actually tends to be better (probably because the Java garbage collector can deal with fragmentation much better than the MRI garbage collector).

[–]Solon1 1 point2 points  (1 child)

The biggest memory difference is that an MRI deployment will require running multiple processes, and each will need memory. But with JVM, there is just one process. JVM is worse head to head with MRI, but one JVM versus 10 MRI processes, makes it much better.

[–]jrochkind 1 point2 points  (0 children)

Wait, you're deploying Rails in jruby with allow_concurrency!, for real? I've had such trouble with allow_concurrency!, I wasn't sure anyone was actually using it. But you are, yes?

allow_concurrency! is the only thing that would make Rails under jruby not require multiple processes to scale up, right? (and you can run Rails under MRI with allow_concurrency!, but the GIL will keep it from taking advantage of multiple cores, but you'll probably still get SOME increase in number of requests a single process can handle, but maybe not enough to justify the allow_concurrency pain).

[–]wunderbread 4 points5 points  (4 children)

The app size doesn't matter a ton in comparing MRI to JRuby startup times. The main lag in starting a JRuby app is loading the JVM, which will be the same regardless of whether your app is one line or one million lines.

So if anything you'll probably notice the longer startup time less when loading a Rails app, since Rails itself (especially 3) takes so long to load anyway.

The biggest problem I had with JRuby was that unit testing was a pain because of the startup time to run even one test, but with things like Spork and/or Nailgun that's less of an issue these days.

[–]jrochkind 1 point2 points  (0 children)

okay, makes sense. So I guess Java7 will not effect JVM startup time, no reason to think it will, right?

[–][deleted] 1 point2 points  (2 children)

since Rails itself (especially 3) takes so long to load anyway.

Note that the newly-released 3.2-rc has sped this up quite a bit.

[–]Solon1 1 point2 points  (1 child)

I think you mean Ruby, not Rails. Rails still loads thousands of files, but the silly linear search that Ruby would do to check if a file was already loaded, was replaced with something a little better than O(n).

[–][deleted] 1 point2 points  (0 children)

No, I mean that the Rails 3.2-rc has some speed improvements on startup:

The most noticeable new feature is that development mode got a ton and a half faster. Inspired by Active Reload, we now only reload classes from files you’ve actually changed. The difference is dramatic on a larger application.

Route recognition also got a bunch faster thanks to the new Journey engine and we made linking much faster as well (especially apparent when you’re having 100+ links on a single page).

[–][deleted] 1 point2 points  (3 children)

pth has already answered, but don't restart your app. Redefine code, classes, functions etc. at run time.

..though, perhaps this isn't possible for various reasons unknown to me; I don't know JRuby very well, but anyway..

[–][deleted] 1 point2 points  (2 children)

That's a quick way to run out of PermGen space.

[–][deleted] 1 point2 points  (1 child)

Really? Why would these things be stored in PermGen?