입력 내용이 비슷한 코드 블록은 실행 시간도 비슷할 것이라 생각하기 쉽지만, 실제로 이러한
직관은 오해를 불러일으키기 쉽다.
2.10.7
레이턴시 분포의 일반적 특성
자바 애플리케이션의 실행 시간을 측정할 때는 몇 가지 특성을 잘 이해해야 한다. 동일한 코드
블록도 실행 시간은 매번 제각각이다. 입력 매개변수, 다운스트림 시스템, 힙 상태 등 변수는
다양하다. 그럼에도 입력 정보가 비슷한 요청은 일반적으로 비슷한 시간 안에 처리가 완료된다.
실행 시간이 대략적으로 정규분포를 따른다는 직관은 쉽게 믿음으로 바뀐다. 즉 [그림
2
-
10
]
처럼 중앙의 평균을 기준으로 더 빠르거나 느린 시간 분포가 양쪽에 낮은 확률을 보이며 꼬리
처럼 이어지는 형태를 예상하기 쉽다.
그림
2-10
정규분포 곡선
실제 상황에서 실행 시간은 대부분 다봉
multimodal
분포를 형성한다. 레이턴시 스펙트럼을 따
라 둘 이상의 ‘봉우리’ 또는 시간 그룹을 이룬다. 가장 일반적인 자바 실행 시간 분포는 [그림
2
-
11
]과 비슷한 쌍봉
bimodal
분포다. 왼쪽보다 더 작은 오른쪽 봉우리는 가비지 수집과
VM
중
단 상태를 나타내는 동시에, 다운스트림 서비스의 파급 효과를 반영한다.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.