Java is used either for long running server side applications / application servers or for running short scripts.長い間のいずれかのJavaが使用されサーバー側で実行中のアプリケーション/アプリケーションサーバーやスクリプトの実行をショートします。 Let’s look at how you can speed-up both these type of applications.方法について見てみましょうスピードアップすることができます。両方のタイプのアプリケーションに最適です。


How to speed-up server-side Java applicationsスピードアップする方法をサーバー側のJavaアプリケーション

It is very simple really.本当にこれは非常に簡単です。 Just add -server after the java command like this:サーバーだけを追加した後、 javaコマンドのようなこの:
java -server HelloWorld ジャワ-サーバーのHelloWorld

Replace HelloWorld with your application name.あなたのアプリケーションに置き換えるのHelloWorld名を入力します。 That wasn’t so hard was it?ではないのでハードでしたか?

How to speed-up client-side Java applicationsスピードアップする方法をクライアント側のJavaアプリケーション

Downloadダウンロードする and install nailgun.してインストールしNailGunのです。 You may want to read theすることができますを読むには quickstart guideクイックスタートガイド for details.をご覧ください。

Nailgun is a simple application server which allows you to run Java programs rapidly through the server instance. NailGunのは、単純なアプリケーションサーバーのJavaプログラムを実行することを可能にするサーバーインスタンスを通じて急速にします。 The nailgun client (ng for linux and ng.exe for windows) is a small c program which works on both windows and linux platforms.のNailGunのクライアント( ng.exeのLinuxおよびWindowsの場合)は、小さなCプログラムをWindowsおよびLinuxプラットフォームの両方で動作します。 To run Java applications you just have to substitute ng (assuming it is in path) for java. Javaアプリケーションを実行するのを代用するしかない(と仮定のことはパス) for Javaのです。 ng reduces startup time by running programs from the same instance.スタートアップの時間を短縮するとき、同じインスタンスから実行中のプログラムです。 However it uses socket connection for communication which can be further optimized.しかしこれは通信用のソケット接続をより詳細に最適化できる。
Let’s see how much ng improves the performance for simple client side applications.どれどれ、どのくらいのパフォーマンスを向上させるの単純なクライアント側のアプリケーションに最適です。

Here is a simple HelloWorld program I ran using java:ここでは、単純なHelloWorldプログラムを使用して走ったジャワ:

 [angsuman@jaguar project]$ time java HelloWorld Hello World! [のAngsuman @ジャガープロジェクト] $時間Javaの世界のHelloWorldハロー! real    0m0.107s user    0m0.049s sys     0m0.012sリアル0m0.107sユーザー0m0.049sシステム0m0.012s 

Here is the same program run using nailgun:ここでは、同じプログラムを使用してNailGunの実行:

 [angsuman@jaguar project]$ time ../software/nailgun-0.7.1/ng HelloWorld Hello World! [のAngsuman @ジャガープロジェクト] $時間../software/nailgun-0.7.1/ng世界HelloWorldのハロー! real    0m0.002s user    0m0.000s sys     0m0.001sリアル0m0.002sユーザー0m0.000sシステム0m0.001s 

Can you see the difference?その違いが分かりますか?

Here is the result of running helloworld in C (compiled with gcc):ここでの結果を実行中のHelloWorldをC (コンパイルはgcc ) :

 [angsuman@jaguar project]$ time ./hello Hello World! [のAngsuman @ジャガープロジェクト] $時間。 /ハローハロー世界! real    0m0.001s user    0m0.001s sys     0m0.001sリアル0m0.001sユーザー0m0.001sシステム0m0.001s 

I am using:私は使用して:

 [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 @ジャガープロジェクト] $ JavaのバージョンのJavaバージョン" 1.6.0_01 " Javaの( ) seランタイム環境(ビルド1.6.0_01 - b06 ) Javaのホットスポット( )サーバVM (ビルド1.6.0_01 - b06 、混在モード) 

The Java code is: Javaのコードは:

 public class HelloWorld {   public static void main(String args[]) {      System.out.println("Hello World!");   } }パブリッククラスのHelloWorld (公共の静的な無効メイン(文字列args [ ] ) ( system.out.println ( " Hello World ! "を) ; ) ) 

The c code is:のCコードは:

 #include #含まれて  int main(void) {         printf(”Hello World!\n”); } intメイン(無効) ( printf ( "こんにちは世界! \ n " ) ; ) 

Let’s finally put to rest the myth that “レッツ最後に置くことを残りの神話" Java is slow Javaは遅い “. "です。