Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-19613

Performance regression with HttpSession.getAttribute

XMLWordPrintable

      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.

       

       

            pferraro@redhat.com Paul Ferraro
            kna@uniquare.com Anton Knes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: