Uploaded image for project: 'RH-SSO'
  1. RH-SSO
  2. RHSSO-1920

Script Mapper Performance Issues - Java 8 and Java 11

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • RH-SSO-7.6.0
    • None
    • None
    • None
    • False
    • None
    • False
    • Hide
      • Run RHSSO on Java 11 (can use Openshift Image) with G1GC
      • Ensure scripts and upload scripts feature is enabled
      • Create a client with a script mapper - contents can be very simple like
        • token.audience("some-other-aud"); exports = true;
      • Run load test to generate access , ID , refresh tokens against the endpoint
      • Monitor heap usage and watch Old Gen growth and Eden creation rates.
      Show
      Run RHSSO on Java 11 (can use Openshift Image) with G1GC Ensure scripts and upload scripts feature is enabled Create a client with a script mapper - contents can be very simple like token.audience( "some-other-aud" ); exports = true ; Run load test to generate access , ID , refresh tokens against the endpoint Monitor heap usage and watch Old Gen growth and Eden creation rates.
    • CIAM Sprint 14

      While switching from a Java 8 based deployment to Java 11 of RHSSO, we noticed an increase in memory usage and that some objects were long lived.

      Our RHSSO deployment makes use of script mappers. We ultimately have determined that the Nashorn engine in Java 11 is creating many weak/soft references and are not culled with mixed GC as they were with Java 8. This ultimately results in the application being required to perform a Full GC or otherwise risk memory exhaustion.

      There are also some other changes to Nashorn in Java 11 that also create additional classloaders and classes with each instantiation of the engine (a factor of 3).

      Additionally, we determined this is also an issue to some degree with Java 8 - it went unnoticed previously as the Full GC cycles did not occur (Java 8 was able to reclaim the space during mixed gc), but could be observed by the rather fast allocation and promotion of new objects from young to old gen, but subsequently cleared by mixed GC. By turning off the script mappers, we could observe the young and old gen growth rates slowed significantly.

      There are some recommendations about sharing the ScriptEngine created initially (I believe RHSSO/Keycloak creates it with each request), which could reduce some of the resource consumption. I am unsure if that would solve the weak/soft reference issues in Java 11 as those could be from one of many bugs open for Java 11 + Nashorn.

            mposolda@redhat.com Marek Posolda
            jsorah Joshua Sorah
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: