How To Speedup Java Over 100%如何加速Java的超過100 %
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 Java的服務器的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客戶端(靄儀議員為Linux和ng.exe適用於Windows )是一個很小的C語言程序,其中工程對Windows及Linux平台。 To run Java applications you just have to substitute ng (assuming it is in path) for java.運行Java應用程序你一定要以靄儀議員(假設它是在路徑)的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程序我運行用Java :
[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 (彙編與海灣合作委員會) :
[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 (技術備忘錄)本身的運行時間環境(建立1.6.0_01 - b06 ) Java的熱點(技術備忘錄)服務器的越南船民(建設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 ( “世界您好! ” ) ; ) ) The c code is: C代碼是:
#include #包括int main(void) { printf(”Hello World!\n”); }詮釋主體(無效) ( printf ( “世界您好! \ n ” ) ; )
Let’s finally put to rest the myth that “讓我們最後付諸表決,休息的神話“ Java is slow Java是緩慢 “. “ 。
Filed under提起下 Enterprise Software企業軟件 , , Headline News頭條新聞 , , How To如何 , , Java Software Java軟件 , , Linux Linux的 , , Open Source Software開放源碼軟件 , , Programming編程 , , Tech Note技術說明 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |





August 29th, 2007 at 3:14 pm 2007年8月29日在下午3時14分
I downloaded Nailgun and tried out a little test and was impressed by the speed.我下載nailgun ,並試圖了一個小試驗,並留下了深刻的印象的速度。 I did have issues when I tried to run multiple clients through it at the same time.我本來有問題,當我嘗試運行多個客戶,通過它在同一時間內。 When the first exited, they all did.當第一個退出,他們都沒有。 It looks like it is not supported anymore… Last build was Feb, 2005.它看起來好像是不支持了…去年建立是2月, 2005年。 Is there any similar alternatives out there?是否有任何類似的替代品有?
September 25th, 2007 at 7:11 am 2007年9月25日在上午07時11分
I can build one if there is sufficient demand.我可以建立一個如果有足夠的需求。
March 13th, 2008 at 10:10 am 2008年3月13日上午10時10分
It looks like it just speedups the startup time, but most of proffesional apps are started only once a month, so there is no speedup in that case.它看起來像它只是加速啟動的時間,但大多數的proffesional Apps是開始,只有每月一次,所以沒有加速在這種情況下。
The same trick like for example in winamp agent.同樣的伎倆一樣,例如在Winamp中的代理人。
But of course very nice idea for some small applications run by user to do small tasks.不過,當然很好的想法對一些小的應用來說,由用戶做的小任務。