4 Replies Latest reply on May 2, 2002 4:01 PM by dsundstrom

    CMR performance in JBoss 3.0RC1

    cwbrandon

      I have a question regarding CMR performance:

      When I perform a query and retrieve about 1000 Person EJBs and just call its simple attributes such as getFirstName, getLastName, etc. (without calling any of its CMR fields) it takes about 2-3 seconds to return the results. But when I start to retrieve any of the Person EJB's CMR relationships, is when things really slow down (takes around a minute to retrieve 1000). For example when I do a query for a Person I need to get the Person's firstName, lastName, and preferredName. In addition to the Person's firstName, lastName, and preferredName, I also want to get his/her address, which is modeled as a CMR relationship with an Address EJB. The server.log file indicates that each Address EJB is retrieved by calling a select by primary key statement. So this when I retrieve 1000 Person EJBs and want to get the Addresses, the container is calling a select by primary key statement 1000 times. Is this expected behavior? Can I somehow tell the container to retrieve every Addresses of every found Person using one select statement? I'm performing the query within a transaction within a session bean. The way I'm retrieving the Person EJBs is by overriding the EJB QL with declared-sql since EJB QL doesn't support use of the LIKE statement and I'm trying to search for Person's by first name, last name, etc. Any insight would be greatly appreciated...

      Thanks!

      Chad

        • 1. Re: CMR performance in JBoss 3.0RC1
          dsundstrom

          First off are you doing this in a single transaction?

          Are the Person/Address EJBs in a one-to-one relationship? Does Person have a fk for Address?

          Do you basically want to read-ahead all the persons and their address? I'm not sure that can currently be done, but I'll think about it while you answer the above questions.

          • 2. Re: CMR performance in JBoss 3.0RC1
            cwbrandon

            Hi Dain,

            Thanks for the quick response. Yes I'm performing the query in a single transaction because I'm doing it in a Session Bean with the transaction attribute set to "Required". Yes the Person/Address EJBs are in a one-to-one relationship, and yes Person does have a fk for Address. Yes I wondering if I could read-ahead all the Person's and Addresses, and if not, could you suggest some other way to do it that might make things faster? Also when I do the query, in the log file I get this statement: "The Pool for com.vcomponet.doms.ejb.person.PersonCMP has been overloaded. You should change pool parameters." What parameters is it referring to? Thanks I appreciate it!

            Chad

            • 3. Re: CMR performance in JBoss 3.0RC1
              cwbrandon

              Hi Dain,

              Have you had a chance to think over my question?

              Thanks

              • 4. Re: CMR performance in JBoss 3.0RC1
                dsundstrom

                No. I missed it.

                No you can read-ahead all persons and addresses, but you can read all persons on-find and when you getAddress it can block load the entire address on-find.

                Mark the finder on-find (everything except the address fk field) and mark the relationship on-find eagerload *.

                That will work.