Java is used either for long running server side applications / application servers or for running short scripts. Java è utilizzato per le lunghe le tue applicazioni lato server / application server o per l'esecuzione di script breve. Let’s look at how you can speed-up both these type of applications. Vediamo come si può accelerare il ritmo di entrambi questi tipo di applicazioni.


How to speed-up server-side Java applications Come accelerare il ritmo di lato server applicazioni Java

It is very simple really. E 'davvero molto semplice. Just add -server after the java command like this: Basta aggiungere-server dopo il comando java in questo modo:
java -server HelloWorld Java-server HelloWorld

Replace HelloWorld with your application name. Ciao a sostituire con il tuo nome. That wasn’t so hard was it? Che non è stato così difficile è stato?

How to speed-up client-side Java applications Come accelerare il ritmo di lato client applicazioni Java

Download Scaricare and install nailgun. nailgun e installare. You may want to read the Ti suggeriamo di leggere il quickstart guide Guida rapida for details. per i dettagli.

Nailgun is a simple application server which allows you to run Java programs rapidly through the server instance. Nailgun è un semplice server applicativo che permette di eseguire programmi Java rapidamente attraverso il server di esempio. The nailgun client (ng for linux and ng.exe for windows) is a small c program which works on both windows and linux platforms. Il nailgun client (ng per Linux e ng.exe per windows) è un piccolo programma in C che funziona su entrambe le finestre e le piattaforme Linux. To run Java applications you just have to substitute ng (assuming it is in path) for java. Per eseguire le applicazioni Java è sufficiente sostituire il GN (ammesso che è in cammino) per Java. ng reduces startup time by running programs from the same instance. ng riduce il tempo di avvio di programmi in esecuzione dello stesso grado. However it uses socket connection for communication which can be further optimized. Tuttavia si utilizza la connessione socket per la comunicazione che può essere ulteriormente ottimizzato.
Let’s see how much ng improves the performance for simple client side applications. Vediamo come migliora di molto le prestazioni per semplici applicazioni lato client.

Here is a simple HelloWorld program I ran using java: Qui è un semplice programma Ciao ho eseguito tramite java:

 [angsuman@jaguar project]$ time java HelloWorld Hello World! [angsuman @ jaguar progetto] $ time java HelloWorld Ciao a tutti! real    0m0.107s user    0m0.049s sys     0m0.012s reale 0m0.107s sys 0m0.049s user 0m0.012s 

Here is the same program run using nailgun: Qui è lo stesso programma utilizzando nailgun:

 [angsuman@jaguar project]$ time ../software/nailgun-0.7.1/ng HelloWorld Hello World! [angsuman @ jaguar progetto] $ tempo ../software/nailgun-0.7.1/ng Ciao Ciao a tutti! real    0m0.002s user    0m0.000s sys     0m0.001s reale 0m0.002s sys 0m0.000s user 0m0.001s 

Can you see the difference? Potete vedere la differenza?

Here is the result of running helloworld in C (compiled with gcc): Qui è il risultato di esecuzione HelloWorld in C (compilato con gcc):

 [angsuman@jaguar project]$ time ./hello Hello World! [angsuman @ jaguar progetto] $. / ciao Ciao a tutti! real    0m0.001s user    0m0.001s sys     0m0.001s reale 0m0.001s sys 0m0.001s user 0m0.001s 

I am using: Sto usando:

 [angsuman@jaguar project]$ java -version java version “1.6.0_01″ Java(TM) SE Runtime Environment (build 1.6.0_01-b06) Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode) [angsuman @ jaguar progetto] $ java-version java version "1.6.0_01" Java (tm) SE Runtime Environment (build 1.6.0_01-b06) Java HotSpot (TM) Server VM (build 1.6.0_01-b06, modalità mista) 

The Java code is: Il codice Java è:

 public class HelloWorld {   public static void main(String args[]) {      System.out.println("Hello World!");   } } public class HelloWorld (public static void main (String args []) (System.out.println ( "Ciao Mondo!");)) 

The c code is: Il codice C è:

 #include # include  int main(void) {         printf(”Hello World!\n”); } int main (void) (printf ( "Ciao a tutti! \ n");) 

Let’s finally put to rest the myth that “ Let's finalmente messo a riposo il mito che " Java is slow Java è lento “. ".