generated from Learning-Is-Vital-In-Development/study-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
marp: true | ||
paginate: true | ||
--- | ||
|
||
# 자바 프로파일링 도구 | ||
|
||
## 최 혁 | ||
|
||
--- | ||
|
||
# 자바 프로파일링이란? | ||
|
||
> 애플리케이션의 런타임 동작(메모리 사용량, CPU 활용도, 스레드 실행 등)을 프로파일링하는 프로세스 | ||
**> 프로파일링하는 이유: 리팩토링 및 성능 최적화 대상 코드 식별** | ||
|
||
**> 주의할 점: 프로파일러가 애플리케이션의 동작을 잘못 나타내거나 뚜렷한 편향을 드러낼 수 있음** | ||
|
||
--- | ||
|
||
## 프로파일링 편향 | ||
|
||
**> 무슨 편향?: 프로파일링은 data point 샘플링(스냅샷)을 통해 획득하는데 자주 샘플링하면 오버헤드가 발생하고, 가끔 샘플링하면 중요 장면을 놓친다.** | ||
|
||
**> 또한 프로세스를 샘플링하기 전에 모든 스레드가 세이브 포인트에 있어야 하므로 오버헤드가 가중되고, 세이브 포인트 지점에서만 샘플링하기에 sample point 분포가 왜곡될 수 있다.** | ||
|
||
**> 따라서 애플리케이션 세이브 포인팅 시간도 확인해야 한다.** | ||
(-XX:+PrintGCApplicationStoppedTime) | ||
|
||
--- | ||
|
||
## 프로파일하는 자원 | ||
|
||
- `CPU 프로파일링`: 처리 시간이 긴 메서드를 식별 | ||
- `메모리 프로파일링`: 애플리케이션의 메모리 사용량 분석, 객체 생성 추적, GC 이벤트 | ||
- `스레드 프로파일링`: 스레드 수명주기, 동기화 및 스레드 간 동신 | ||
- `GC 분석`: GC 이벤트 분석 | ||
|
||
--- | ||
|
||
## JProfiler | ||
|
||
> CPU 프로파일링, 메모리 프로파일링, 스레드 프로파일링 기능을 제공하는 프로파일러 | ||
**JProfiler를 설치하고 IDE에서 애플리케이션을 실행하면 JProfiler와 IDE에서 실행중인 프로세스와 Attach할 수 있다** | ||
|
||
- CPU 프로파일링: CPU View 탭에서 메서드를 실행하는데 소요한 시간을 볼 수 있다 | ||
- 메모리 프로파일링: Heap Walker 탭에서 메모리 누수 여부 및 정보를 확인할 수 있다 | ||
- 스레드 프로파일링: Threads 탭에서 스레드 상태를 모니터링하고 동기화 문제나 교착 상태를 확인할 수 있다 | ||
|
||
--- | ||
|
||
# 참고 | ||
|
||
- https://medium.com/@AlexanderObregon/profiling-java-applications-tools-and-techniques-3569b32862f4 | ||
- https://www.baeldung.com/java-profilers |