markusthoemmes commented on issue #2747: Use non-blocking UUID generation in 
controller
URL: 
https://github.com/apache/incubator-openwhisk/issues/2747#issuecomment-330587501
 
 
   @rabbah and I have been debating a fix for this. Providing an alternative 
`SecureRandom` instance could help (especially if it uses the non-blocking 
`/dev/urandom` vs `/dev/random`), but there would still be the problem of 
thread contention due to the `synchronized` nature of `getBytes`.
   
   A naive implementation I did to at least get the issue out of the way for 
now is:
   
   ```scala
   new java.util.UUID(ThreadLocalRandom.current.nextLong, 
ThreadLocalRandom.current.nextLong)
   ```
   
   The randomness is not cryptographically secure, yes. We are namespacing our 
ActivationIds though, so the domain of collision is significantly smaller than 
having them globally namespaced. I'm not too much an expert in that area though 
to judge wether the randomness provided by `ThreadLocalRandom` is sufficient. 
It for sure does fix the contention and blocking problem though.
 
----------------------------------------------------------------
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