glassfish
  1. glassfish
  2. GLASSFISH-16347

Glassfish 3.1 is much slower to deploy when many methods have RolesAllowed Annotations

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.1
    • Component/s: security
    • Labels:
      None
    • Environment:

      Linux Redhat EL5 64 bit Jdk 1.6 update 24

      Description

      Glassfish 3.1 is much slower to deploy when many methods have RolesAllowed Annotations
      Our application previously deployed OK on glassfish 2.1 ( less than 1 minute )
      Now on 3.1 it takes about 500 000 milliseconds which makes for a painfully slow development cycle.

      I have experimented and what takes long is our Stateless Sesion Bean which is a Session Facade.
      It is large with over 700 methods.

      If I leave this out and just load a few ancillary stateless session beans our message beans, JPA classes etc the application deploys in about 20 s.

      I made a test case with 800 methods called hello_000 to hello_800 and it deployed quickly.

      each looked like

      public String hello_000()
      {
      return "hello";
      }

      I then added @RolesAllowed on about a third of the methods and this is what caused the slowdown
      it went from 20 000 millseconds to 180 000 milliseconds.

      eg at top of class

      @DeclareRoles(

      {"Role1", "Role2", "Role3", "Role4", "Role5", "Role6"})
      @RolesAllowed( {"Role1", "Role2", "Role3", "Role4", "Role5", "Role6"}

      )
      @Stateless
      public class TestStateless implements TestStatelessRemote
      {

      Now some methods look like

      @RolesAllowed(

      {"Role1", "Role2" }

      )
      public String hello_001()
      {
      return "hello";
      }

      But it seems that the roles processing is the slow part.

      See fourm discussion http://www.java.net/forum/topic/glassfish/glassfish/glassfish-31-much-slower-deploy

      1. granted.policy_v2
        0.9 kB
        Nithya Ramakrishnan
      2. granted.policy_v3
        3 kB
        Nithya Ramakrishnan
      3. Hot_Spots_with_sec_ann.html
        57 kB
        Nithya Ramakrishnan
      4. Hot_Spots_without_sec_ann.html
        90 kB
        Nithya Ramakrishnan

        Activity

        Hide
        Cheng Fang added a comment -

        Assign to security for further evaluation.

        Show
        Cheng Fang added a comment - Assign to security for further evaluation.
        Hide
        james100 added a comment -

        I downloaded 3.1.1 b06.
        My app deployment went from over 400 seconds to about 150 seconds while still not blindingly fast it is a big improvement and makes the test/deploy cycle usable.
        Thanks

        Show
        james100 added a comment - I downloaded 3.1.1 b06. My app deployment went from over 400 seconds to about 150 seconds while still not blindingly fast it is a big improvement and makes the test/deploy cycle usable. Thanks
        Hide
        Nithya Ramakrishnan added a comment -

        We tried to compare the time and policies for a test app (20 methods with overriding RolesAllowed annotations) in v2.1.1 and v3.1.1. It appears that in v2, the policies are generated incorrectly - the RolesAllowed annotations are not being converted to EjbMethodPermissions, while in v3, the conversion in happening and the policies are generated correctly.

        So the extra time taken in v3 is therefore justified.

        Show
        Nithya Ramakrishnan added a comment - We tried to compare the time and policies for a test app (20 methods with overriding RolesAllowed annotations) in v2.1.1 and v3.1.1. It appears that in v2, the policies are generated incorrectly - the RolesAllowed annotations are not being converted to EjbMethodPermissions, while in v3, the conversion in happening and the policies are generated correctly. So the extra time taken in v3 is therefore justified.
        Hide
        Nithya Ramakrishnan added a comment -

        Attaching the granted.policies for the test app in v2.1.1 and v3.1.1. It can be noticed that the EjbMethodPermissions are totally missing in v2.1.1. Please raise a bug for this on v2.1.1

        Show
        Nithya Ramakrishnan added a comment - Attaching the granted.policies for the test app in v2.1.1 and v3.1.1. It can be noticed that the EjbMethodPermissions are totally missing in v2.1.1. Please raise a bug for this on v2.1.1
        Hide
        Nithya Ramakrishnan added a comment -

        granted.policies for v2.1.1 and v3.1.1

        Show
        Nithya Ramakrishnan added a comment - granted.policies for v2.1.1 and v3.1.1

          People

          • Assignee:
            Nithya Ramakrishnan
            Reporter:
            james100
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: