2 Replies Latest reply on Apr 3, 2002 1:54 PM by Marcus Brito

    JBossCMP issuing UPDATEs when not needed (also: performance

    Marcus Brito Novice

      I've noticed a strange (harmless, but with great impact in performance) behavior with JBossCMP (CVS version about a week ago).

      Everytime I load an entity with relationships, it will issue an UPDATE command for each related entity just after loading it. While it may be acceptable when loading a single bean, it almost takes the server down when loading lots of entity (+100) the performance goes to unacceptable levels.

      What can I do (if I can do something) to help this? There are times when I need to load only 2 fields from around 2000 entities from a table. I've already defined load groups and JBossCMP is loading just the needed data. However, it's loading one entity at a time and issuing an UPDATE for each entity loaded. It takes minutes to load all entities.

      JBoss is 3.0.0beta2 Date:200203221637 and the database is PostgreSQL 7.1.3-4

        • 1. Re: JBossCMP issuing UPDATEs when not needed (also: performa
          Marcus Brito Novice

          Some more info: here is a log excerpt when trying to load a single entity (AF) with 3 relationships (with Cliente, Agente and AFItem).
          2002-04-03 15:28:18,306 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.AF.findAll] Executing SQL: SELECT t0_a.af_id FROM af t0_a ORDER BY t0_a.af_data_preenchimento DESC
          2002-04-03 15:28:18,438 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AF] Executing SQL: SELECT af_numero, af_finalizada, af_data_preenchimento FROM af WHERE (af_id=?)
          2002-04-03 15:28:18,447 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.AF] Executing SQL: SELECT af_agen_id FROM af WHERE (af_id=?)
          2002-04-03 15:28:18,486 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Agente] Executing SQL: SELECT DESCRICAO FROM AGENTES WHERE (AGENTE_ID=?)
          2002-04-03 15:28:18,504 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.AF] Executing SQL: SELECT af_clie_id FROM af WHERE (af_id=?)
          2002-04-03 15:28:18,551 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Cliente] Executing SQL: SELECT clie_nome, clie_ende_bairro, clie_ende_cep, clie_ende_cidade, clie_ende_uf, clie_ende_fax, clie_ende_logra, clie_ende_telefone FROM cliente WHERE (clie_id=?)
          2002-04-03 15:28:18,572 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.AF] Executing SQL: SELECT afpr_id FROM af_produto WHERE (afpr_af_id=?)
          2002-04-03 15:28:18,587 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.AF] Executing SQL: UPDATE af SET af_agen_id=?, af_clie_id=? WHERE af_id=?
          2002-04-03 15:28:18,591 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.AF] Create: Rows affected = 1
          Please note that JBoss issues an UPDATE for each relation loaded. My code didn't called a single setXXX() method.

          This is a simple case, just to illustrate the problem. Things goes bad when there are lots of entities to be loaded.

          • 2. Re: JBossCMP issuing UPDATEs when not needed (also: performa
            Marcus Brito Novice

            More performance issues: are all relations loaded when the entity is loaded? I noticed relations are being loaded even when I haven't asked for them. And they aren't specified on the eager-load-group either.