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

ASF GitHub Bot commented on STORM-1650:
---------------------------------------

Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1250#discussion_r57166147
  
    --- Diff: storm-core/src/clj/org/apache/storm/daemon/executor.clj ---
    @@ -508,7 +509,7 @@
             ^Integer max-spout-pending (if max-spout-pending (int 
max-spout-pending))        
             last-active (atom false)        
             spouts (ArrayList. (map :object (vals task-datas)))
    -        rand (Random. (Utils/secureRandomLong))
    +        rand (XORShiftRandom. (Utils/secureRandomLong))
    --- End diff --
    
    We cannot use a thread local random here, because it is placed into 
functions that are not called from a single thread.  What is more the 
implementation of XORShiftRandom is that if we do lose the race, it is likely 
that we will repeat a number which could result in tuples not being tracked 
properly. 


> improve performance by XORShiftRandom
> -------------------------------------
>
>                 Key: STORM-1650
>                 URL: https://issues.apache.org/jira/browse/STORM-1650
>             Project: Apache Storm
>          Issue Type: Improvement
>            Reporter: John Fang
>            Assignee: John Fang
>
> '''Implement a random number generator based on the XORShift algorithm 
> discovered by George Marsaglia. This RNG is observed 4.5 times faster than 
> {@link Random} in benchmark, with the cost that abandon thread-safety. So 
> it's recommended to create a new {@link XORShiftRandom} for each thread.'''



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to