Its worth noting that this is very much how Azul's VM works -- they 
provide a JVM stub that does little more than act as a server that loads 
the class files off the file system and pipes them up to the real VM.

Charles Oliver Nutter wrote:
> It's become increasingly frustrating that JVM startup is still so much 
> slower than most command-line programs.
> 
> In the JRuby world, we've now managed to convincingly pass the C 
> implementation of Ruby 1.8 in performance. But even on the fastest 
> systems, our startup time is a good couple seconds. At its worst, it can 
> be as high as ten seconds. Our users are very tired of waiting.
> 
> http://www.martiansoftware.com/nailgun/index.html
> 
> Nailgun is a project that appears to be mostly dead since 2005, but it 
> basically provides a simple "JVM server" on one end and a native client 
> on the other. You call ng like you'd call java, with a class and 
> arguments it should be passed. And it sends that class and arguments 
> across a socket to the ng server, where the class is started up and the 
> streams are all piped back and forth. When the class terminates, the 
> client terminates.
> 
> Here's a sample of JRuby startup time on OS X Java 6, first normal and 
> then with ng:
> 
> normal:
> 
> ~/NetBeansProjects/jruby $ time jruby -e "puts 'hello'"
> hello
> 
> real    0m1.944s
> user    0m1.511s
> sys     0m0.138s
> 
> nailgun:
> 
> ~/NetBeansProjects/jruby $ time jruby -e "puts 'hello'"
> hello
> 
> real    0m0.103s
> user    0m0.006s
> sys     0m0.009s
> 
> Obviously it's a substantial improvement.
> 
> Now there are a few issues with Nailgun that I've seen so far:
> 
> - it doesn't pass along CWD, so if I switch to another directory the 
> launched class on the remote server doesn't pick that up. Of course the 
> JVM only has one CWD anyway, but in JRuby we have one per JRuby 
> runtime...so we could implement our own wrapper around the Nailgun 
> server that's aware of this. But we'd still need to tweak the native 
> client to send it across.
> - you obviously can't pass JVM flags across the wire, since the JVM is 
> already started up. This also applies to classpath...but JRuby will 
> generally use a runtime-dynamic classpath anyway, so that issue is lessened.
> - I had some trouble with one Ruby app that uses a readline library; it 
> didn't appear to pipe correctly. The client needs better term support, I 
> would guess.
> 
> I'm debating trying to get Nailgun running again as a project, so these 
> issues can be resolved. In the absence of some other miracle, there's 
> not going to be a better way to get native-like startup times for those 
> of us implementing languages used heavily for small command-line 
> utilities. Nailgun seems like a 75% solution that could become something 
> pretty nice with a little work.
> 
> Thoughts on this? Other suggestions for defeating startup woes?
> 
> To try it out in JRuby:
> 
> 1. check out JRuby trunk at http://svn.codehaus.org/jruby/trunk/jruby
> 1.5. build JRuby with "ant"
> 2. run 'make' from within bin/nailgun
> 3. start up a server with jruby-ng-server
> 4. instead of 'jruby' run 'jruby-ng'. -J options are not passed on.
> 
> - Charlie
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to