markusthoemmes commented on issue #2747: Use non-blocking UUID generation in 
controller
URL: 
https://github.com/apache/incubator-openwhisk/issues/2747#issuecomment-331089914
 
 
   @dgrove-oss fair point, here are a few profiling results. I think I arrived 
at a solution for us:
   
   ### Testcode
   
   ```scala
   def main(args: Array[String]): Unit = {
     (1 to 100000000).par.foreach { _ =>
       val uuid = randomUUID()
     }
   }
   ```
   
   Parallel generation of 100000000 random UUIDs.
   
   ### Baseline: `java.util.UUID.randomUUID()`
   
   
![image](https://user-images.githubusercontent.com/1289147/30686165-a9cf15e6-9eb7-11e7-9460-d57af4045616.png)
   
   (It goes on until about 2:50 minutes)
   
   ### Switching from `/dev/random` (blocking) to `/dev/urandom` (non-blocking)
   
   
![image](https://user-images.githubusercontent.com/1289147/30686276-07fdcb3a-9eb8-11e7-873a-c94a5676122a.png)
   
   Much better already, but still a lot of thread contention.
   
   ### Switching to `ThreadLocal[SecureRandom]`
   
   
![image](https://user-images.githubusercontent.com/1289147/30686332-3a20d9c2-9eb8-11e7-8f70-0cf451dbd8ff.png)
   
   There we go!
   
   So it looks like the innerts of `SecureRandom` do not contain any more 
contention which is great.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to