6

Possible Duplicate:
How to speed up Java VM (JVM) startup time?

I am writing a command line utility in Java (or probably in another JVM-based language). The problem is JVM start-up time. JVM starts slower than Python and Ruby, for instance.

How to make JVM stat faster? Can I load JVM "in advance" (in Linux and Windows) somehow so that it should not be loaded every time I run my utility in command line?

Community
  • 1
  • 1
Michael
  • 41,026
  • 70
  • 193
  • 341

3 Answers3

5

For Windows there's the Java Quick Starter which comes with the default installation of the JRE.

http://www.java.com/en/download/help/quickstarter.xml

Koraktor
  • 41,357
  • 10
  • 69
  • 99
5

Nailgun is probably the best solution - it keeps a running JVM instance can then be called by your commands (using a super-lightweight C client).

As an alternative or additional option, you might want to try upgrading to Java 7 if you haven't done so already - there have been quite a lot of startup time enhancements.

mikera
  • 105,238
  • 25
  • 256
  • 415
  • We use Jruby at work and the jvm startup time and loading of spring objects is the lagging part. We switched to the client server NailGun setup recently and we have a 2X plus improvement speed wise. We love it! – Robert Beltran May 23 '13 at 17:09
3

To load JVM in advance you can use Drip. It keeps a fresh JVM spun up in reserve with the correct classpath and other JVM options so you can quickly connect and use it when needed, then throw it away. Drip hashes the JVM options and stores information about how to connect to the JVM in a directory with the hash value as its name.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
  • Thanks man.... I have this base requirement and then I want either a pool of jvms / a new one as soon as I have connected with the one or the last one (I have to profile and judge the strategy) AND then I need round robin way / some other way of selecting the jvm too if I go multiple jvm routes. Has something like that already built on / extending "drip". How am I going to close the jvm? any further resource? wiki is sparse. – manocha_ak Sep 19 '13 at 07:00
  • I got them I think from the sh script. – manocha_ak Sep 19 '13 at 08:04