[
https://issues.apache.org/jira/browse/HTRACE-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Colin Patrick McCabe updated HTRACE-170:
----------------------------------------
Description:
org.apache.htrace.Tracer#nonZeroRandom64 is obviously shares the same Random
instance between multiple execution threads.
That is slow.
Either {{ThreadLocal<Random>}} (1.5+) or {{ThreadLocalRandom}} (1.7+) should be
used.
Other places with the same problem:
org.apache.htrace.impl.CountSampler#random
org.apache.htrace.impl.MilliSpan#nonZeroRandom64
org.apache.htrace.impl.ProbabilitySampler#next
was:
org.apache.htrace.Tracer#nonZeroRandom64 is obviously shares the same Random
instance between multiple execution threads.
That does not work.
Either {{ThreadLocal<Random>}} (1.5+) or {{ThreadLocalRandom}} (1.7+) should be
used.
Other places with the same problem:
org.apache.htrace.impl.CountSampler#random
org.apache.htrace.impl.MilliSpan#nonZeroRandom64
org.apache.htrace.impl.ProbabilitySampler#next
> Optimize use of Random in htrace-core by using ThreadLocalRandom
> ----------------------------------------------------------------
>
> Key: HTRACE-170
> URL: https://issues.apache.org/jira/browse/HTRACE-170
> Project: HTrace
> Issue Type: Improvement
> Affects Versions: 3.3.0
> Reporter: Vladimir Sitnikov
> Assignee: Vladimir Sitnikov
> Priority: Minor
> Fix For: 3.3.0
>
> Attachments:
> 0001-HTRACE-170-Optimize-use-of-Random-in-htrace-core.patch
>
>
> org.apache.htrace.Tracer#nonZeroRandom64 is obviously shares the same Random
> instance between multiple execution threads.
> That is slow.
> Either {{ThreadLocal<Random>}} (1.5+) or {{ThreadLocalRandom}} (1.7+) should
> be used.
> Other places with the same problem:
> org.apache.htrace.impl.CountSampler#random
> org.apache.htrace.impl.MilliSpan#nonZeroRandom64
> org.apache.htrace.impl.ProbabilitySampler#next
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)