4 Replies Latest reply on Apr 8, 2005 6:59 AM by ottoberg

    Why does JBoss load each column separately?

    ottoberg Newbie

      Recently, we are observing that most finder queries take exceedingly long to finish. Looking for the reason we have switched on cmp logging and found that relations are loaded column by column:

      Executing SQL: SELECT id, salutation FROM PERSON WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
      2005-03-03 16:31:28,089 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Person] Executing SQL: SELECT id, gender FROM PERSON WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
      2005-03-03 16:31:28,105 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Person] Executing SQL: SELECT id, title FROM PERSON WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
      2005-03-03 16:31:28,121 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Person] Executing SQL: SELECT id, firstname FROM PERSON WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
      2005-03-03 16:31:28,152 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Person] Executing SQL: SELECT id, lastname FROM PERSON WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
      


      Granted, all relations are loaded in one fell swoop, but column by column. Since we have no comparison data, that is we don't know if JBoss behaved differently before the performance degradation we cannot attribute our problems to this phenomenon. Maybe we have to look elsewhere.

      Still I would like to know if this is JBoss' intended behaviour. If the answer is yes I would like to know why. If the answer is no, maybe someone could give me a pointer as to where I can control this behaviour.

      Thanks for any help,

      Olaf

        • 1. Re: Why does JBoss load each column separately?
          Joachim Van der Auwera Expert

          You need to properly configure your load groups.

          Check out the Jboss administration docs for more details about CMP data loading settings and implications.

          Joachim

          • 2. Re: Why does JBoss load each column separately?
            ottoberg Newbie

             

            "triathlon98" wrote:
            You need to properly configure your load groups.

            Check out the Jboss administration docs for more details about CMP data loading settings and implications.

            Joachim


            Thanks for the answer. That is exactly what I have been doing all day. We haven't declared any load groups, yet since we are using JBoss 3.2.6 and the section in standardjbosscmp-jdbc.xml reads
            <read-ahead>
             <strategy>on-load</strategy>
             <page-size>1000</page-size>
             <eager-load-group>*</eager-load-group>
            </read-ahead>
            


            it has been my understanding that by default JBoss will use an on-load read-ahead strategy with _all_ cmp fields included in its eager-load-group. This seems to contradict the behaviour we are observing. Or am I mistaken?

            Browsing through some old log files it _seems_ as if this behaviour occured after switching from JBoss 3.2.3 to JBoss 3.2.6. Unfortunately, due to some other problems, we cannot use JBoss 3.2.3 anymore. So does anyone have any info regarding differences in the CMP engine between JBoss 3.2.3 and JBoss 3.2.6 which could help to explain this phenomenon?

            Thanks,

            Olaf

            • 3. Re: Why does JBoss load each column separately?
              Erez Efrati Newbie

              I am seeing this behaviour too in one of my entities where no matter what the CMP engine generates & fires a seperate SQL SELECT query for each cmp field accessed.

              I am too, using 3.2.6, why is it happening when the default load-group is set to '*'?

              Thanks in advance,

              Erez

              • 4. Re: Why does JBoss load each column separately?
                ottoberg Newbie

                I think that starting with JBoss 3.2.3 the CMP engine has undergone more or less drastic changes in order to accommodate more and more performance tuning switches. I have the _impression_ that as a side-effect JBoss does not honor some settings in standardjbosscmp-jdbc.xml anymore.

                We managed to restitute the old behaviour by adding something like

                @jboss.read-ahead
                 strategy = "on-load"
                 page-size = "1000"
                 eager-load-group = "*"
                
                @jboss.lazy-load-group
                 name = "*"
                

                to our EBs. Don't ask me about the exact meaning of these tags. Any time I read the CMP chapter in the JBoss docs I _think_ I finally got my head around it, only to see myself crashing into the next inexplicable phenomenon a few days later.

                Cheers,

                Olaf