sangmin, lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 java...

39
Sangmin, Lee www.tuning-java.com

Upload: others

Post on 03-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

Sangmin, Lee www.tuning-java.com

Page 2: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� 자바성능을결정짓는코딩습관과튜닝이야기집필

� Java Language Specification Third edition � Java Language Specification Third edition

공동번역

� 하는일� Performance test

� Java application tuning

Page 3: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Performance (40 min)

� Java Tuning (1 H)

Java Tuning Report example review (20 min)� Java Tuning Report example review (20 min)

Page 4: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Time …

� TPS …(Transaction Per Second)

Page 5: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� 웹에서의시간은 ???

� 응답시간과대기시간= Response time and Think time= Response time and Think time

� Think time

� 두 Request time 사이의시간

Request

&

Response

Think time

Request

&

Response

Page 6: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Response time is divided by…

� Network connection

� Send request data� Send request data

� Wait time

� Receive response data

� Network close

N/W connect Send request Server time Receive response N/W close

Page 7: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 8: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 9: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Transaction Per Second means…

1 TPS = 60 TPM = 3,600 TPH� 1 TPS = 60 TPM = 3,600 TPH

� Our system's TPS is 20 TPS means ~~~

Our system can serve 72,000 transactions per

hour.

Page 10: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 11: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 12: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Which is better to show system capability ?

Page 13: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� There are a lot of performance tools in the world

� Load Runner

� Performance suite enterprise� Performance suite enterprise

� SilkPerformer

� Web LOAD

� JMeter

� MS Web application stress tool

� …

Page 14: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

시나리오선정

스크립트작성및확인스크립트작성및확인

테스트환경준비

테스트수행 및튜닝

테스트결과정리및보고

Page 15: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Performance (40 min)

� Java Tuning (1 H)

Java Tuning Report example review (20 min)� Java Tuning Report example review (20 min)

Page 16: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� 20 80의법칙� 상위 20%의 application이 80%의사용량과리소스를점유함.점유함.

� 5 95의법칙� 상위 5%의 application이 95%의사용량과리소스를점유함.

�대부분의사이트를분석해본결과이법칙이더정확함.

Page 17: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

1. Web server

2. WAS

3. DB Server3. DB Server

4. File Server

5. Legacy Server

6. Network

7. Nothing

8. I don’t know

Page 18: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Because …

Page 19: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Response time is divided by…

� Network connection

� Send request data� Send request data

� Wait time

� Receive response data

� Network close

N/W connect Send request Server time Receive response N/W close

Page 20: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Server time is divided by …

(in a point of WAS view)

� CPU 시간과대기시간� CPU 시간과대기시간

= WAS 에서잡아먹는시간 +딴데서잡아먹는시간

= Thread time + Wait time

Page 21: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Thread time consumes WAS’s CPU

Can we reduce these time ?� Can we reduce these time ?

Page 22: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Wait time is divided by…

� Network time

� DB time� DB time

� IO time

� Other system’s response time

� Can we reduce these time ?

Page 23: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Everything you have to do is…

Page 24: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Well… the best way is…

� But after find point, you must tune application.

Page 25: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� If you don’t have tool…

Page 26: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� If you don’t have tool…

� Analyze access log

� 웹로그에는기본적으로응답시간이찍히지않음.� 웹로그에는기본적으로응답시간이찍히지않음.

� %D (마이크로초) or %T(초) 를 access log 포맷에추가

Page 27: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� The most important thing is …

Page 28: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 29: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

튜닝시작

대상식별및분석대상식별및분석

튜닝수행

성능 비교

튜닝결과반영

Page 30: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 31: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Application is to0ooo slow or doesn’t response

� Server dies every day

Page 32: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

public ReasonVO getSlowReason(Object problem) {

if(problem instanceof Environment) {

return checkEnvironment(problem);return checkEnvironment(problem);

} else if(problem instanceof WASSetting) {

return checkWASSetting(problem);

} else if (problem instanceof Program) {

return new ReasonVO(“Too much reason”, …);

}

}

Page 33: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

public ReasonVO checkEnvironment(Object problem) {

if(problem instanceof DB) {

return checkDB(problem);

} else if (problem instanceof Network) {} else if (problem instanceof Network) {

return checkNetwork(problem);

} else if(problem instanceof Storage) {

return checkStorage(problem);

} else {

return checkExtraEnvironment(problem);

}

}

Page 34: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

public ReasonVO checkWASSetting(Object problem) {

if(problem instanceof ThreadNumber) {

return checkThreadNumber(problem);

} else if (problem instanceof DBConnectionPool) {} else if (problem instanceof DBConnectionPool) {

return checkDBConnectionPool(problem);

} else if(problem instanceof WebServer) {

return checkWebServer(problem);

} else {

return checkExtraSetting(problem);

}

}

Page 35: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� How to prevent.

� Monitor with monitoring tool. (Best)

� Monitor with WAS Console� Monitor with WAS Console

� Check thread usage

� Check memory

� Check DB Connection pools

� Monitor with JMX

� Build your own JMX Codes.

Page 36: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

public ReasonVO getDieReason(Object problem) {

if(problem instanceof MemoryProblem) {

return analysisMemory(problem);return analysisMemory(problem);

} else if(problem instanceof TooMuchUser) {

return checkServerSettingOrExpandServer(problem);

} else {

return new ReasonVO(“Too much reason”,…);

}

}

Page 37: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java

� Performance (40 min)

� Java Tuning (1 H)

Java Tuning Report example review (20 min)� Java Tuning Report example review (20 min)

file link

Page 38: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java
Page 39: Sangmin, Lee 2015-01-22 · 자바성능을결정짓는코딩습관과튜닝이야기 집필 Java Language Specification Third edition 공동번역 하는일 Performance test Java