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

Ways to reduce the startup time of Java and Scala applications have already been discussed here and here . One proposed solution was to use a client-server approach with Nailgun or a simple written server that communicates over 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'm a little worried if development has stopped and how stable it is. netcat seems like a pretty standard tool and is available on many Linux / Unix systems. But both of these systems are new to me, so I would like to know if my observations are correct and what are the other advantages and disadvantages of using Nailgun vs netcat to provide a fast command line interface for a Java application?

PS You may wonder why improve startup time, since it is already quite reasonable (~ 100 ms on my machine) or why not use C / C ++ instead. The first is that the application will be executed many times (for example, from a loop in a bash script), and this usage 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.

+4
source share
3 answers

My recommendation is now to go with nailgun and prove that such a solution really has a positive effect on startup time.

If you have confirmed that the startup time is the bottleneck, you can implement a very simple client / server with the advantage of being able to use any communication program (netcat, wget, curl, perl, etc.) and have full protocol control.

+4
source

"Before you download it, keep in mind that it is not protected. Do not even close it. Although there are means to ensure that the client is connected to the server from the local machine, there is still no concept of a" user ", Any programs running in Nailgun, run with the same rights as the server itself. You have been warned. "

I personally would like this to be fixed before introducing it into production ...

+3
source

Nailgun works well, and Netcat works well. I used both. Netcat is suitable for any program, not just Java. It can be used to execute shutdown scripts on a local network. For Windows, you just need to use Nailgun.

0
source

All Articles