Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages and disadvantages of using Nailgun vs netcat to provide fast CLI to a Java application?

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.

like image 985
vitaut Avatar asked Oct 28 '10 10:10

vitaut


2 Answers

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

If you have confirmed that the bottleneck 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 to have full control over the protocol.

like image 132
PeterMmm Avatar answered Nov 16 '22 20:11

PeterMmm


"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...

like image 3
Thorbjørn Ravn Andersen Avatar answered Nov 16 '22 21:11

Thorbjørn Ravn Andersen