RFR: 8296746: NativePRNG SecureRandom doesn't scale with threads [v2]

Xubo Zhang duke at openjdk.org
Thu Nov 17 21:04:22 UTC 2022


On Wed, 16 Nov 2022 21:12:09 GMT, Bernd <duke at openjdk.org> wrote:

> Would it be easier to remove the state (singleton, thread local) caching completely? If somebody request a new instance just seed and return it. That might in some situations be even less seeding than once per thread and it decreases stat sharing even more.

ThreadLocal is basically a middle path. Creating a RandomIO to for access /dev/random each time 

> Would it be easier to remove the state (singleton, thread local) caching completely? If somebody request a new instance just seed and return it. That might in some situations be even less seeding than once per thread and it decreases stat sharing even more.

that would require too many open and close of /dev/(urandom). ThreadLocal is basically the middle path. The singleton approach only needs one open and close, however it would require threads to be sync'ed to access /dev/(urandom)

-------------

PR: https://git.openjdk.org/jdk/pull/11069


More information about the security-dev mailing list