본문 바로가기
IBM - old/WAS 문제&해결

HP 사용중에 WAS 에서 출력한 시간이 OS 랑 안맞는 경우

by freeman98 2016. 5. 6.

1. WAS 버전 : WebSphere ND all

2. OS : HP 계열

3. Error 발생 시점 :  HP 사용중에 시작시점에는 문제가 없었는데 시간이 좀 지나고 난 후나,
 특정 이유로 OS 의 시간을 변경한 후에 WAS 출력을 봤더니  OS와 시간 차이가 발생하는 경우

4. Error message :
 WAS 출력과 OS 와의 시간 차이 발생

5. 예상 이유 :
 HP 의 JVM 의 경우는 JDK 1.3.1 이 후부터 성능상의 이유로 JVM 이 시작하면서 systemtime 을 호출해서 읽어온 후
 자체적으로 시간을 계산합니다. 추가로 OS의 systemtime 을 주기적으로 호출하는 것을 방지하려는 목적이죠.
 하지만, 반대급부로 특정 이슈로 인해 과부하가 오랜시간 지속되는 경우라던가 OS의 시간을 갑자기 변경하는 경우에는
 OS 와 시간일치가 안맞는 경우가 발생할 수 있습니다.

There has been a change in the way the HotSpot JVM uses the gettimeofday() system call to obtain date and time information.
For performance reasons a new mechanism is used that uses the number of cpu ticks since the application started,
to calculate the current time. As a result, changes to the system date or time using date(1), adjtime(2) or time
synchronization utilities such as ntp will not be reflected in the date and time that Java returns, until the process
is restarted.

6. 조치 방안 :
 HP 에서 JVM 시작시에 -XX:+UseGetTimeOfDay 옵션을 추가해주면 됨
 (단, OS에서 계속 시간을 주기적으로 호출하는 것이기 때문에 약간의 performance 손실이 있을 수 있음)
If your application requires that Java immediately reflects such system time changes, you can use the
-XX:+UseGetTimeOfDay option to tell the JVM to use the gettimeofday call instead of the new,
lightweight mechanism. However you may notice a drop in performance.

http://www.hp.com/products1/unix/java/java2/sdkrte14/infolibrary/sdk_rnotes_1.4.2.17.html

댓글