Java is used either for long running server side applications / application servers or for running short scripts. 서버 쪽 중 하나를 실행 오랫동안 자바를 사용 응용 프로그램 / 애플 리케이션 서버 또는 짧은 스크립트를 실행하기위한합니다. Let’s look at how you can speed-up both these type of applications. 수있는 방법에 대해 살펴보겠 속도 -을이 두 유형의 응용 프로그램을합니다.


How to speed-up server-side Java applications 하는 방법을 스피드 - 접속 서버 - 사이드 자바 애플 리케이션

It is very simple really. 그것은 매우 간단합니다 진짜. Just add -server after the java command like this: - 서버 이후에 추가 자바 명령을 이렇게 :
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 속도 -을하는 방법을 클라이언트 - 사이드 자바 애플 리케이션

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의 응용 프로그램 서버는 간단한 자바 프로그램을 실행할 수있는 서버 인스턴스를 통해 급속하게합니다. The nailgun client (ng for linux and ng.exe for windows) is a small c program which works on both windows and linux platforms. the NailGun의 클라이언트 (ng.exe를 위해 리눅스 및 windows)가 작은 c 프로그램을 윈도우와 리눅스 플랫폼에서 모두 작동합니다. To run Java applications you just have to substitute ng (assuming it is in path) 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 @ 재규어 프로젝트] $ 타임 자바 helloworld 여러분, 안녕하세요! real    0m0.107s user    0m0.049s sys     0m0.012s 실제 0m0.049s 시스템 0m0.107s 사용자 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.000s 시스템 0m0.002s 사용자 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 @ 재규어 프로젝트] $ 자바 - 버젼 자바 버전 "1.6.0_01"자바 () 남동 런타임 환경 (빌드 1.6.0_01 - b06) 자바 핫스팟 () 서버 vm (빌드 1.6.0_01 - b06, 혼합 모드) 

The Java code is: the 자바 코드는 :

 public class HelloWorld {   public static void main(String args[]) {      System.out.println("Hello World!");   } } 공용 클래스 helloworld (공공 정적 무효 메인 (문자열 args []) (system.out.println ( "여러분, 안녕하세요!");)) 

The c code is: the c 코드 :

 #include # 포함  int main(void) {         printf(”Hello World!\n”); } int 메인 (무효) (printf ( "여러분, 안녕하세요! \ n");) 

Let’s finally put to rest the myth that “ 마지막으로 자신의 신화 나머지 봅시다 " Java is slow 자바가 느리 “. "합니다.