Siddhant Sangwan created HDDS-14345:
---------------------------------------

             Summary: Performance optimisation for random pipeline choose policy
                 Key: HDDS-14345
                 URL: https://issues.apache.org/jira/browse/HDDS-14345
             Project: Apache Ozone
          Issue Type: Improvement
          Components: SCM
            Reporter: Siddhant Sangwan
            Assignee: Siddhant Sangwan


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):
{code}
---- 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  
{code}

So for selecting one out of 500 pipelines and 8 threads doing this, the latency 
is 295.03 nanoseconds per operation.

With ThreadLocalRandom:
{code}
---- 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
{code}

Latency = 6.25 nanoseconds per operation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to