4 Replies Latest reply on Dec 8, 2003 8:09 AM by xf_fong

    How can I improve the CMP's client's speed?

    xf_fong Newbie

      I have written a simple CMP sample to test the efficiency. This CMP EJB will create a table in oracle 9i database.
      On the client I use findAll() method to get the all rows from the table. The total number of the rows is about 5000. But when I use followed codes in client side, I find the client program run very very slowly. And I found the oracle's process ORACLE.EXE was very busy(consumed about 50% CPU), but the JBoss's process was not!
      I think perhaps I need to modify some settings of the JBoss. Am I right? But what I need to do?
      **********************************
      Collection c = signalHome.findAll();
      Iterator it = c.iterator();
      Signal s;
      while(it.hasNext()){
      s = (Signal)it.next());
      System.out.println((s.getStationID()).toString()+", "
      +(s.getEquipmentID()).toString()+", "
      +(s.getSignalID()).toString()+", "
      +s.getSignalName()+", "
      +Double.toString(s.getCurrentValue()));
      }
      **********************************

      Any suggestion will be appreciated!

        • 1. Re: How can I improve the CMP's client's speed?
          Juha Lindfors Master

          Start by building a session facade and value objects. These are well known patterns in EJB programming. You should be able to find plenty of resources on the web on these.

          It is likely you're getting bogged down by excessive remote invocations. Don't know why your Oracle would be busy with such a simple query.

          -- Juha

          • 2. Re: How can I improve the CMP's client's speed?
            xf_fong Newbie

            Do you mean I ought to use session bean to do this kind of job(select * from ....)? I know perhaps that will perform better!

            But I want to know can I cache the whole table's rows into JBoss?Or can I only cache 1000 rows of a table which has 10000 rows?

            Thanks!

            • 3. Re: How can I improve the CMP's client's speed?
              Juha Lindfors Master

              Yes you can cache a whole table if you have enough memory. It also depends whether you have an exclusive access to the database whether caching a whole table really makes sense or not.

              -- Juha

              • 4. Re: How can I improve the CMP's client's speed?
                xf_fong Newbie

                Thanks for your answer!

                But I want to know how to cache the table?I only know perhaps the <instance-cache> tag will be the clue,but I don't find a good sample! Can you give me some links?

                Another thing confused me is when I use findAll() to do another test. In this case, I modified the Beans setEntityContext as followed:
                ==================================
                public void setEntityContext(EntityContext ctx){
                this.context = ctx;
                System.out.println("setEntityContext exec! -- " + this.context.toString());
                }
                ==================================
                I found when I start 5 clients, the memory consumed will 5 times as 1 client. And will also produce 5 different context. Is that mean 5 clients will produce 5 EJB Object instances and 5 Enterprise Bean instances? Or other kind of understanding?

                (I think EJB Object instance is from my Component Interface: XXX extends EJBObject and Enterprise Bean instance is from my EntityBean: XXXBean implements EntityBean. Am I right?)