6 Replies Latest reply on Nov 25, 2002 12:59 PM by danny

    Perfomance issue when using castor in Jboss

    Pierre Thorey Newbie

      Hi all,

      i'm using jboss3.0.0alpha with jdk1.3 on a tru64 server (compaq) and on sun server. On both platforms, i got the same problem :
      in a method of a stateless bean, i unmarshall an xml string by this way :
      for (int j=0;j<10;j++) {
      long heureDeb=0;
      long heureFin=0;
      heureDeb=new java.util.Date().getTime();

      Reader reader=new StringReader(xml);
      Object o=Unmarshaller.unmarshal(InputEvent.class,reader);
      heureFin=new java.util.Date().getTime();
      System.out.println("duration=" + (heureFin-heureDeb));
      }
      The Unmarshaller class is provided by castor.
      When launched in jboss, the average duration of the unmarshall is about 1000 ms. When launched as a single main class program, the average duration is about 50 ms. Then, it's more than 20 times quicker !


      Any kind of idea about this overcost ?

      Thanks,
      Pierre

        • 1. Perfomance issue when using castor in Jboss
          Juha Lindfors Master

          Hi all,

          i'm using jboss3.0.0alpha with jdk1.3 on a tru64 server (compaq) and on sun server. On both platforms, i got the same problem :
          in a method of a stateless bean, i unmarshall an xml string by this way :
          for (int j=0;j<10;j++) {
          long heureDeb=0;
          long heureFin=0;
          heureDeb=new java.util.Date().getTime();

          Reader reader=new StringReader(xml);
          Object o=Unmarshaller.unmarshal(InputEvent.class,reader);
          heureFin=new java.util.Date().getTime();
          System.out.println("duration=" + (heureFin-heureDeb));
          }
          The Unmarshaller class is provided by castor.
          When launched in jboss, the average duration of the unmarshall is about 1000 ms. When launched as a single main class program, the average duration is about 50 ms. Then, it's more than 20 times quicker !


          Any kind of idea about this overcost ?

          Thanks,
          Pierre

          • 2. Re: Perfomance issue when using castor in Jboss
            Juha Lindfors Master

            well in fact... why are you using 3.0.0 alpha ??

            • 3. Re: Perfomance issue when using castor in Jboss
              Pierre Thorey Newbie

              Thanks juha,

              in fact, i'm using jboss for several months on a crucial platform. I can't migrate whithout doing a lot of non regression tests..(I've used jboss3.0.0alpha because it was the latest release at this time)

              About the class loader, i tried to make the bean in a ear in which i put castor.jar, sax2.jar, and xerces.jar. I tried also to put the bean in a simple jar file, and i add castor.jar, sax2.jar and xerces.jar directly in the classpath of jboss. With both methods, i have no problem of ClassNotFoundException....but with both methods i have this issue of performance.
              And, in my code, i repeat the same unmarshalling operations 10 times in a "for loop" to avoid the overcost of loading jar files.

              • 4. Re: Perfomance issue when using castor in Jboss
                Pierre Thorey Newbie

                ok, i find the solution. There was a conflict between xalan.jar and xerces.jar. The default xml parser in my jboss was xalan...then the parsing's methods of xerces were overrided by xalan.
                I remove xalan from the lib directory, put xerces at the same place, and modified a property in the run.sh script. And finally, i got now the same perf. as in a single main class.

                • 5. Re: Perfomance issue when using castor in Jboss
                  Marcus Brito Novice

                  Just to add a little more salt to this thread. Have you benchmarkers ever tried to run JBoss and Websphere on a 1.4[.1] VM?

                  JBoss, and EJB as a whole use lots of reflection and 1.4 has impressive optimizations on this area. Perhaps using Sun or IBM jdk 1.4 could give a *great* speed boost to JBoss and perhaps to Websphere too.

                  • 6. Re: Perfomance issue when using castor in Jboss
                    danny Newbie

                    Hi Pierre
                    I had the same problem ..in castor's standalone mode i've unmarshalled my XMLDocs 50 times faster than using castor + jboss3. Now i've changed server to 3.0.3 version and everything works fine. I think it was jboss3 alpha bug. TRY TO CHANGE SERVER TO 3.0.3 (or 3.0.4) IT WORKS !!!

                    greetins
                    Daniel Stacewicz