[ 
https://issues.apache.org/jira/browse/HADOOP-15901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16675133#comment-16675133
 ] 

Steve Loughran commented on HADOOP-15901:
-----------------------------------------

-1

I used to think MonotonicNow was good, but now I don't. 

h3. Monotonic now is not guaranteed to be consistent across cores in a single 
socket, absolutely not consistent across sockets

It is only safe to use in certain situations
* you are doing micro benchmarks where you can take averages of many runs 
discard outliers
* you want a very low cost time value for diagnostics and testing & can cope 
with inconsistency, and you are confident the probability of a thread being 
suspended and rescheduled is 0
* you are running code where you have used CPU affinity calls to bind a thread 
to a specific core, and you are confident that you are not running in a VM, 
where the host OS can remap virtual to physical cores as it chooses.

Given IPC blocks for network requests, I'm not sure it matches any of these.

Further reading: 
http://steveloughran.blogspot.com/2015/09/time-on-multi-core-multi-socket-servers.html





> IPC Client and Server should use Time.monotonicNow() for elapsed times.
> -----------------------------------------------------------------------
>
>                 Key: HADOOP-15901
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15901
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc, metrics
>            Reporter: Vinayakumar B
>            Assignee: Vinayakumar B
>            Priority: Major
>         Attachments: HADOOP-15901-01.patch
>
>
> Client.java and Server.java  uses {{Time.now()}} to calculate the elapsed 
> times/timeouts. This could result in undesired results when system clock's 
> time changes.
> {{Time.monotonicNow()}} should be used for elapsed time calculations within 
> same JVM.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to