WSS4J
  1. WSS4J
  2. WSS-232

Performance Improvement in WSSConfig

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major 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%.

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

        Activity

        Mario Siegenthaler created issue -
        Hide
        Mario Siegenthaler added a comment -

        Patches for the trunk and 1.5.8

        Show
        Mario Siegenthaler added a comment - Patches for the trunk and 1.5.8
        Mario Siegenthaler made changes -
        Field Original Value New Value
        Attachment WSSConfig.java-trunk.patch [ 12445032 ]
        Attachment WSSConfig.java-158.patch [ 12445033 ]
        Hide
        Colm O hEigeartaigh added a comment -

        I'll take a look at this again for 1.6.

        Colm.

        Show
        Colm O hEigeartaigh added a comment - I'll take a look at this again for 1.6. Colm.
        Colm O hEigeartaigh made changes -
        Fix Version/s 1.6 [ 12313718 ]
        Colm O hEigeartaigh made changes -
        Assignee Ruchith Udayanga Fernando [ ruchith ] Colm O hEigeartaigh [ coheigea ]
        Hide
        Colm O hEigeartaigh added a comment -

        This is now fixed in 1.6-SNAPSHOT. Thanks for the patch.

        Colm.

        Show
        Colm O hEigeartaigh added a comment - This is now fixed in 1.6-SNAPSHOT. Thanks for the patch. Colm.
        Colm O hEigeartaigh made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Colm O hEigeartaigh made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        216d 4h 51m 1 Colm O hEigeartaigh 22/Dec/10 13:08
        Resolved Resolved Closed Closed
        5s 1 Colm O hEigeartaigh 22/Dec/10 13:08

          People

          • Assignee:
            Colm O hEigeartaigh
            Reporter:
            Mario Siegenthaler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 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

                Development