RFR: 8285398: Cache the results of constraint checks

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Tue Apr 26 04:14:06 UTC 2022


On Mon, 25 Apr 2022 17:22:57 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>>> With all the above in mind I decided not to use `sun.security.util.Cache` here
>> 
>> I was not meant to use Cache and timeout for this update.
>> 
>> SoftReference and  this patch should work good in larger memory boxes.  Performance improvement sometimes is a trade-off game between memory and CPU. Did you have a chance to check the performance in the limited memory circumstance?  like '-mx64M".
>
> I run a few tests:
> `-Xmx16m`, with this patch, still better than the original version:
> 
> Benchmark                 (resume)  (tlsVersion)   Mode  Cnt     Score     Error  Units
> SSLHandshake.doHandshake      true       TLSv1.2  thrpt    5  4477.444 ± 375.975  ops/s
> SSLHandshake.doHandshake      true           TLS  thrpt    5   681.471 ±  72.531  ops/s
> SSLHandshake.doHandshake     false       TLSv1.2  thrpt    5   335.366 ±  89.056  ops/s
> SSLHandshake.doHandshake     false           TLS  thrpt    5   308.711 ±  90.134  ops/s
> 
> 
> `-Xmx8m`, before patch:
> 
> Benchmark                 (resume)  (tlsVersion)   Mode  Cnt    Score    Error  Units
> SSLHandshake.doHandshake      true       TLSv1.2  thrpt    5  153.760 ± 12.025  ops/s
> SSLHandshake.doHandshake      true           TLS  thrpt    5   70.700 ±  7.506  ops/s
> SSLHandshake.doHandshake     false       TLSv1.2  thrpt    5   67.459 ±  4.325  ops/s
> SSLHandshake.doHandshake     false           TLS  thrpt    5   64.695 ±  1.647  ops/s
> 
> after:
> 
> Benchmark                 (resume)  (tlsVersion)   Mode  Cnt    Score    Error  Units
> SSLHandshake.doHandshake      true       TLSv1.2  thrpt    5  557.324 ± 50.269  ops/s
> SSLHandshake.doHandshake      true           TLS  thrpt    5  155.258 ± 13.866  ops/s
> SSLHandshake.doHandshake     false       TLSv1.2  thrpt    5  181.755 ± 29.319  ops/s
> SSLHandshake.doHandshake     false           TLS  thrpt    5  120.627 ± 25.832  ops/s
> 
> Much slower, but still faster with the patch.
> With `-Xmx4m` the test failed with OOM.

Thanks for the additional testing.  The improvement is impressive.

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

PR: https://git.openjdk.java.net/jdk/pull/8349



More information about the security-dev mailing list