Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-30394

[8.1.0.GA] - [GSS](8.0.z) WFLY-19613 - Performance regression with HttpSession.getAttribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.1.0.Beta
    • 8.1.0.Beta
    • Clustering, EJB
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide

      Add a custom, serializable Java Object into the HttpSession and access it using "getAttribute".

      Show
      Add a custom, serializable Java Object into the HttpSession and access it using "getAttribute".

      We experience a performance regression within our software running on WildFly 31.0.1 in combination with "HttpSession.getAttribute".

      According to JDK Mission Control every call to "getAttribute" leads to 2 Exceptions (one NoSuchFieldException and one RuntimeException) - both "caused" by the "StatefulSessionBeanImmutability" test which is implemented in a "Exception-based" way.

      This check was (as far as I can tell) introduced with WFLY-17217, but due to a bug not yet active until WFLY-18023 (i.e. starting with WildFly 29 and higher and also present in JBoss EAP 8, EAP 7.4.x doesn't have this check yet as far as I can see).

      Since a "getAttribute" call is quite common in our software a single user interaction (request) leads to roughly 4800 Exception and is therefore quite noticeable (~62 ms increase in response time).

       

      From my point of view there are two possible solutions for this:

      • Alter the "StatefulSessionBeanImmutability.test" method to be "not-exception-based"
        or
      • Skip the immutability check, when the session is already marked as "dirty"

       

      For the second solution we tried the following change, which worked in our case (reducing the amount of exceptions per user-interaction / request down to 2)

      org.wildfly.clustering.web.cache.session.attributes.coarse.CoarseSessionAttributes.getAttribute(String)

      
          @Override
          public Object getAttribute(String name) {
              Object value = this.attributes.get(name);
              //if (!this.immutability.test(value)) {
              if (this.dirty.get() == false && !this.immutability.test(value)) {
                  this.dirty.set(true);
              }
              return value;
          }
       

      -> i.e. don't invoke the "immutability" test, if the session is already "dirty".

      A similar solution would also be needed for "FineSessionAttributes", but we can't use that in our software hence we didn't test / try.

       

       

              rhn-cservice-bbaranow Bartosz Baranowski
              rhn-support-jbaesner Joerg Baesner
              Bartosz Baranowski, Joerg Baesner, Paul Ferraro
              Tommaso Borgato Tommaso Borgato
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: