On Tue, 6 Apr 2021 04:26:58 GMT, Anthony Scarpino <[email protected]> wrote:
>> Hi,
>>
>> I need a review of the locking change to the RSA blinding code. The problem
>> was reported that multithreaded performance suffered because there was one
>> global lock on the many blindings operation. The change reduces locking by
>> using a ConcurrentLinkedQueue to store the different BlindingParameters that
>> other threads maybe using. The queue size is limited to prevent sudden
>> surges in stored BlindingParameters and a WeakHashMap is still used so the
>> objects can be freed when no longer used. Performance doubles under high
>> load.
>>
>> thanks
>>
>> Tony
>
> Anthony Scarpino has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Use ReentrantLock for put and get
src/java.base/share/classes/sun/security/rsa/RSACore.java line 443:
> 441: lock.lock();
> 442: try {
> 443: queue = blindingCache.get(n);
Suggestion:
queue = blindingCache.computeIfAbsent(n, ignored -> new
ConcurrentLinkedQueue<>());
-------------
PR: https://git.openjdk.java.net/jdk/pull/3296