9 Replies Latest reply on May 3, 2010 4:17 AM by jaikiran pai

    Performance JAS 5.1.0.GA   with Security enabled

    max mueller Newbie

      Hi,

      we have the following problem. After update from jboss4.2.2 to jboss5.1.0 performance is very bad. We use EJB3 with SSB and JPA Entities.

      After a debugging/logging session i think the security is the problem.

       

      Following test:

      Three stateless session beans. A call from the TestController to the ping- methods of the TC2 and to SSBNoSecurity.

       

       

      ######################################################################

      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      @SecurityDomain("EVIJET")
      @TransactionManagement(TransactionManagementType.CONTAINER)
      @PermitAll
      @Stateless
      public class TC2 implements TC2Local
      {

       

          /**
           * Default constructor.
           */
          public TC2()
          {
              // TODO Auto-generated constructor stub
          }

       

          public String ping()
          {
              return "ping";
          }

      }

      ######################################################################

      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      @TransactionManagement(TransactionManagementType.CONTAINER)
      @Stateless
      public class SSBNoSecurity implements SSBNoSecurityLocal, SSBNoSecurityRemote
      {
          @Resource
          private SessionContext ctx;

       

          /**
           * Default constructor.
           */
          public SSBNoSecurity()
          {
              // TODO Auto-generated constructor stub
          }

       

          public String ping()
          {
              return "ping";
          }
      }

      #############################################################################

       

      @Stateless
      @TransactionManagement(TransactionManagementType.CONTAINER)
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      @SecurityDomain("EVIJET")
      @PermitAll
      public class TestController implements TestControllerRemote, TestControllerLocal
      {

       

          @PersistenceContext(unitName = "MainDS")
          private EntityManager entityManager;

       

          /**
           * Default constructor.
           */
          public TestController()
          {
              // TODO Auto-generated constructor stub
          }

       

       

       

          public void test()
          {
              long nanoTime = System.nanoTime();
            
              try
              {
                  InitialContext initialContext = new InitialContext();
                  String beanName = "TESTEJB3/TC2/local";
                  TC2Local t2 = (TC2Local) initialContext.lookup(beanName);

       

                  nanoTime = System.nanoTime();
                  t2.ping();
                  long nt2 = System.nanoTime();
                  System.err.println("Method with Security " + (nt2 - nanoTime));
              }
              catch (Exception e)
              {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              try
              {
                  InitialContext initialContext = new InitialContext();
                  String beanName = "TESTEJB3/SSBNoSecurity/local";
                  SSBNoSecurityLocal ssb = (SSBNoSecurityLocal) initialContext.lookup(beanName);

       

                  nanoTime = System.nanoTime();
                  ssb.ping();
                  long nt2 = System.nanoTime();
                  System.err.println("Method No Security " + (nt2 - nanoTime));
              }
              catch (Exception e)
              {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
      }

      #############################################################################

       

      The reult shows reprodusable:

       

      2010-03-10 09:50:10,775 ERROR [STDERR] Method with Security 1458425
      2010-03-10 09:50:10,777 ERROR [STDERR] Method No Security     614603

      2010-03-10 09:49:58,400 ERROR [STDERR] Method with Security 2092724
      2010-03-10 09:49:58,401 ERROR [STDERR] Method No Security     397606

       

       

      In JBoss4.2.2

      2010-03-10 09:54:19,276 ERROR [STDERR] Method with Security 186477
      2010-03-10 09:54:19,279 ERROR [STDERR] Method No Security   214483
      2010-03-10 09:54:22,426 ERROR [STDERR] Method with Security 222096
      2010-03-10 09:54:22,438 ERROR [STDERR] Method No Security   183892

       

      -->

      A call without security is in JBoss5.x two times slower as in JBoss4.2.2 a call with security enabled is ten times slower!

       

      Thanks