[infinispan-dev] ClockService

Bela Ban bban at redhat.com
Tue Jan 29 12:15:16 EST 2013


On 1/29/13 5:02 PM, Manik Surtani wrote:
> Thinking about Sanne's idea re: a clock service and not continuously relying on System.cTM, I stumbled upon this:
>
> https://blogs.oracle.com/ksrini/entry/we_take_java_performance_very
>
> The last section re: caching is interesting.
>
> Having all code use a Clock.currentTimeMillis() and having an implementation that kicks off a scheduled task to update a cached value every $frequency millis (by using the System call) is probably the correct way to implement something like this, but this adds complexities/concerns:
>
> * CPU cache line blowing away (see article)
> * Context switching
> * Managing an extra service thread
> * Probably an additional configuration option to configure that thread, its priority and frequency.  If frequency is dropped (e.g., every second) I suppose the perf gains would be huge.
>
> JGroups - does JGroups make many and frequent calls to System.cTM as well?

No; currentTimeMillis() is used in tasks that run every few seconds, 
otherwise we use nanoTime().


-- 
Bela Ban, JGroups lead (http://www.jgroups.org)



More information about the infinispan-dev mailing list