Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap 크기에 따른 JVM 의 Zero-Based Compressed OOP 사용 여부 확인하기 #172

Open
occidere opened this issue Aug 25, 2022 · 0 comments

Comments

@occidere
Copy link
Owner

Heap 크기에 따른 JVM 의 Zero-Based Compressed OOP 사용 여부 확인하기

내용

  • 예전에 Heap 크기에 따라 Compressed OOP 사용 여부를 확인하는 내용을 정리한 적이 있음
  • 그러나 일반적으로 JVM 의 힙 메모리 주소가 0번지부터 시작하지 않기 때문에, Compressed OOP 방식에선 객체를 찾아갈 때 저렴한 Shift 연산에 더해 상대적으로 비싼 Add 연산이 추가로 필요함
  • 이 때, Zero-Based Compressed OOP 를 사용하면 JVM 시작 시 힙 메모리 시작 번지가 0번지 부터 되도록 논리적으로 강제할 수 있음
  • 단, 논리적으로 0번지부터 시작되게 강제하는 것이므로, 강제로 0으로 조절되는 만큼의 메모리 번지를 사용할 수 없게 됨
    • Compressed OOP 보다도 적은 힙 메모리만 사용 가능
  • Compressed OOP 를 사용하는 것은 거의 필수이며, 상황에 맞춰 Zero-Based Compressed OOP 를 사용하는 것을 선택할 수 있음

커맨드

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompressedOopsMode 2>/dev/null | grep Compressed | grep Oops

image

  • 현재 PC 에선 16384 MB 이하로 힙을 설정해야만 Zero-Based Compressed OOP 를 사용할 수 있는 것을 알 수 있음
# Zero-Based Compressed OOP 적용 가능
java -Xmx16384m -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompressedOopsMode 2>/dev/null | grep Compressed | grep Oops

# Zero-Based Compressed OOP 적용 불가
java -Xmx16384m -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompressedOopsMode 2>/dev/null | grep Compressed | grep Oops

image

참고

  • 엘라스틱서치 실무 가이드
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant