Uploaded image for project: 'WSS4J'
  1. WSS4J
  2. WSS-232

Performance Improvement in WSSConfig

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.6
    • Fix Version/s: 1.6
    • Component/s: WSS4J Core
    • Environment:
      Jetty

      Description

      When I profiled one of our webservices that uses SAML I noticed, that about half the CPU-time per call gets spent inside
      WSSConfig.getProcessor -> Loader.loadClass -> ClassLoader.loadClass
      The application server I was running on is Jetty 6 (might have some impact on the performance of classloading, since it's done with the Webapp-Classloader).

      When I reviewed the code I noticed that all the actions and processors inside WSSConfig are held in a Map with ID -> [either classname or instance). All the default processors/actions are as Strings (classnames). Most of the processors have to be instantated per invocation, so I couldn't switch from classnames to instances.

      I propose to add a third value-variant to the maps: Classes. The included patch contains the changes to WSSConfig. The central parts are inside the static initialization (I added a helper method to shorten initializer) and in the #getProcessor and #getAction methods (a third if-instanceof-part). I retained the dynamic lookup of the opensaml classes.
      The patch brings a massive performance enhancement, at least in the jetty-environment (I didn't test other application server) due to not looking up the classes on every invocation. The CPU-time of the wss4j library went from ~50% down to 2%.

        Attachments

        1. WSSConfig.java-158.patch
          13 kB
          Mario Siegenthaler
        2. WSSConfig.java-trunk.patch
          13 kB
          Mario Siegenthaler

          Activity

            People

            • Assignee:
              coheigea Colm O hEigeartaigh
              Reporter:
              msiegenthaler Mario Siegenthaler
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified