If you’re a Java developer of Java application user, you are not new to the fact that startup time for Java application is huge, of the order of milliseconds to seconds.
Drip, an open source effort, is one step forward from other solutions that help accelerate JVM startup times. Drip, is very different when compared to other fast JVM startup solutions.
What is Drip?
Drip is a launcher for the Java Virtual Machine that provides much faster startup times than the
java command. The
drip script is intended to be a drop-in replacement for the
java command, only faster.
Drip vs. Others: Nailgun, Cake
Other tools try to overcome slow JVM startups using a persistent JVM. This approach although makes startup time almost down to zero, has many sideffects. Persistent JVM leads to a lot of problems like JVM gets dirty over time, producing strange errors and requiring liberal use of
cake kill whenever any error is encountered, just in case dirty state is the cause.
Drip rapidly boots up (and then disposes of) JVMs – a simple but effective solution with the added benefit of working across languages. This Drip based startup of JVM supports Java, Clojure, JRuby and Scala.
Drip only loads your main class at startup, but you can tell Drip to run additional code at startup. This can be used to load classes or execute any initialization code you like. For a language like Clojure, which compiles code on-the-fly, this can be used to precompile commonly used code by requiring it.
Many developers and application users use commandline tools to interact with JVM, for them it becomes essential yo have a handy fast startup script. With the rise of languages like Clojure and Scala, you need a very short edit-compile-test cycle, and Java’s slow startup time can get frustrating.
“The most important feature is getting Drip to work correctly with JLine,” says Balthrop. “We just released the ability to run initialization code when starting the JVM. This can increase speed a lot by loading classes or compiling Clojure code ahead of time. Of course, you have to be careful not to pre-load code that will change, but this can work well for build tools, because they have a lot of classes that don’t change. “We’d also like to add a hook so you can tell Drip how to check if the JVM is stale before accepting a connection”.
Drip is straightforward, easy to use and maintain. You can get handson Drip and its source at github repo.