views:

43

answers:

2

The ways to reduce startup time of Java and Scala applications have been already discussed here and here. One of the solutions suggested there was to use client-server approach with either Nailgun or a simple hand-written server communicating through a TCP socket with netcat.

On the one hand, Nailgun is designed for this purpose. On the other hand, its last release 0.7.1 was in 2005 and I am a bit worried if the development has stopped and how stable it is. netcat seems to be a pretty standard tool and available on many Linux/Unix systems. But both these systems are new to me so I would like to know if my observations are right and what are the other advantages and disadvantages of using Nailgun vs netcat to provide fast command-line interface to a Java application?

P.S. You may wonder why to improve the startup time since it is already quite reasonable (~100ms on my machine) or why not to use say C/C++ instead. The first is because the application will be executed many times (e.g. from a loop in a bash script) and this use scenario cannot be changed unfortunately, the second is because this console program will be just an alternative interface (CLI) to the existing piece of software written in Java.

+1  A: 

"Before you download it, be aware that it's not secure. Not even close. Although there are means to ensure that the client is connected to the server from the local machine, there is not yet any concept of a "user". Any programs that run in Nailgun are run with the same permissions as the server itself. You have been warned."

I would personally like to have that fixed before putting it into production...

Thorbjørn Ravn Andersen
Thanks for pointing this out. That's a serious issue and AFAICS it applies to netcat as well.
vitaut
+1  A: 

My recomendation would be to go now with nailgun and to proof that this kind of solution really has an positive effect of starting time.

If you have confirmed that the bootleneck is the startup time then you may implement a very simple client/server with the advantage to be free to use any comunication program (netcat, wget, curl, perl, etc) and has full control over the protocol.

PeterMmm
I already implemented the proof using netcat and it works very well in terms of performance although special care should be taken to use socket's input and output stream instead of standard input/output. This was actually inspired by your comments in my previous question, so thanks a lot. I was wondering, however, why would one create a separate tool (I mean nailgun) for this, hence the question.
vitaut