siddhantsangwan opened a new pull request, #9583: URL: https://github.com/apache/ozone/pull/9583
## What changes were proposed in this pull request? Using ThreadLocalRandom instead of Math.random() gives significant performance improvement in my micro benchmark. Small improvement for the overall system, but still worth it since it's a simple change and this policy is used for each container allocation. Without ThreadLocalRandom (current master branch): ``` ---- S6 pipelines=500 healthy=100% threads=8 ---- BEGIN_MEASURE method=choosePipelineIndex policy=Random pipelines=500 threads=8 itersPerThread=200000 END_MEASURE method=choosePipelineIndex policy=Random pipelines=500 threads=8 itersPerThread=200000 choosePipelineIndex Random n=500 thr=8 295.03 ns/op 3389471 ops/s sink=11761373 ``` So for selecting one out of 500 pipelines and 8 threads doing this, the latency is 295.03 nanoseconds per operation. With ThreadLocalRandom: ``` ---- S6 pipelines=500 healthy=100% threads=8 ---- BEGIN_MEASURE method=choosePipelineIndex policy=Random pipelines=500 threads=8 itersPerThread=200000 END_MEASURE method=choosePipelineIndex policy=Random pipelines=500 threads=8 itersPerThread=200000 choosePipelineIndex Random n=500 thr=8 6.25 ns/op 160065355 ops/s sink=12453620 ``` Latency = 6.25 nanoseconds per operation. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-14345 ## How was this patch tested? Ran existing unit tests `TestWritableRatisContainerProvider` and `TestWritableECContainerProvider`. PR is draft while CI runs in my fork. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
