7 Replies Latest reply on Apr 2, 2003 1:54 AM by hunterhillegas

    JBoss CMP performance nightmare.

    transient

      I have created an app with JBoss 3.0.4.

      I have a CMP bean.

      It has finders etc that have required transaction, a read ahead of 100 and
      and on-find strategy using local interfaces.

      SQL Access to db is fine. Since in a transaction I get 1 query. This is good.

      What is not good by a long shot is the fact the fetching 1000 records takes
      6 seconds just to process the getXXX() methods on the local interface.

      Consider the following:

      Test case 1:

      Objective: return collection of value objects:

      ArrayList result = new ArrayList();
      Collection c = findSomething(code);
      Iterator i = c.iterator();

      while ( i.hasNext() ) {
      BeanLocal l = (BeanLocal)i.next();

      result.add(l);
      }

      Total time 980ms. Not too bad.

      Test case 2:

      Objective: return collection of value objects:

      ArrayList result = new ArrayList();
      Collection c = findSomething(code);
      Iterator i = c.iterator();

      while ( i.hasNext() ) {
      BeanLocal l = (BeanLocal)i.next();

      String goober = getGoober();
      result.add(l);
      }

      Total time 6000ms. Pathetic.
      Adding more getXXX() slows down even more.

      Whatever getXXX() is doing ( dynamic proxy etc, check for dirty read etc ) is way too complex.

      The problem in performance of CMP is the time taken to access the getXXX() methods. If the
      transaction and read ahead options are set correctly then the DB access part of the process seems to
      work quite well.

      Before any one says "Hey don't load 1000 beans this way you should not do this in EJB"
      I say you would be wrong.

      What this indicates is that the process of getXXX() is sludge on a stick.

      Whether 1000 iterations in a loop or 1000 concurrent access to fetches for separate clients
      the whole process is CPU bound.

      In addition to this there does not seem to be a way to toggle a bean to be read only or not
      to prevent the getXXX's from bothering to check db etc.

      Ok so you can declare it a deploy time. Big deal. You need to be able to dynamically change it
      to manage things like lookups. If I have to use JDBC or JDO to fetch 1000 records in real time
      so my users don't fall asleep from abject boredom then CMP has missed the plot.

        • 1. Re: JBoss CMP performance nightmare.
          arthursdw

          I am having same perf problem with JBoss3.0.3 and Postgres, my appliaction works ok when around 10 clients access it, but it become unacceptable when it has more clients.

          But after we switched to JBoss-Orable, it works OK, so it seems that the bottleneck is from DB.

          But who has experience with postgres perf tuning?

          Thanks in advance

          • 2. Re: JBoss CMP performance nightmare.
            transient

            Try increasing the number of connections in connection pool. This is described in configuration forum.

            Also you might like to fire up a monitor on oracle to see what is being sent to Oracle from container.

            I run on linux and use ethereal on lo interface. Its simple and allows me to monitor all traffic to db.

            In some cases I have read that the container on getXXX() methods of cmp fields can do a read field if it determines it needs to. This is a serious performance hit if reading heaps of records. Not sure if this is fact or fiction. Need 2-3 days to get into jboss source to suss this out.

            Also ejbStore() is called so often its ludicrous. If you have any cmp field modifies in this method every fetch will cause an update to db. Now thats a good idea isn't it? (Not).
            figure out exactly what it is doing.

            • 3. Re: JBoss CMP performance nightmare.
              arthursdw

              Happy new year!

              Thanks for your reply, but I have performance problem with jboss - postgres, not jboss - oracle, and we have a similar config on the connection pool size for both postgres and oracle.

              Is there any other way to improve the jboss - postgress perf?

              Thanks for any reply!

              • 4. Re: JBoss CMP performance nightmare.
                rafcio

                Hallo,

                try to anylse queries which are with PostgreSQL not so fast.


                Best Regards,
                Rafal

                • 5. Re: JBoss CMP performance nightmare.
                  pilhuhn

                  Hi,

                  I saw reports that Postgres itself is slowing down
                  after some time, when you don't regularly call the
                  cleanup task. Could this have something to do with it?

                  • 6. Re: JBoss CMP performance nightmare.
                    nbirch

                    Hi,

                    I have noticed Postgres (7.3.1) slow down and gradually increase its CPU utilization when I perform an Update and an Insert at a steady rate of 5 per second.

                    What is the cleanup task you refer to?

                    Thanks
                    NBirch

                    • 7. Re: JBoss CMP performance nightmare.
                      hunterhillegas

                      You must mean vacuum. You want to make sure you do a vacuum analyze fairly often and a vacuum full at least every once in awhile...

                      When stuff is deleted from Postgres it isn't actually gone until after the vacuum. Also, the query planner needs its statistics updated to make good plan choices... This does that as well.

                      Make sure you read up on it though, as it locks the tables.