3 Replies Latest reply on Apr 22, 2002 9:30 AM by David Jencks

    Performace tuning and CMP2

    Daniele Newbie

      Hi,
      I'm evaluating CMP2 functionality and performaces in JBoss 3.0.0 beta. Particularly I'm interested in data cashing advantages in using CMP2 instead of BMP. For example monitoring Entity Beans life-cycle activity I've noticed an ejbStore activity even if only getter methods are invoked against the Bean (either CMP2 and BMP). For BMP beans this is not strange: the container cannot know which field the method is changing or reading. But in CMP2 all fields are declared and persistence is managed by the container. Is there a way (in the deployment descriptor or something else) to ensure JBoss Container that DataBase fields will be accessed only by the deployed bean in order to activite a strategic and performing caching and DB activity (database accessed only when probably the mem bean data are not in sync, not at every Business method invocation even getter methods)?

        • 1. Re: Performace tuning and CMP2
          David Jencks Master

          What are you watching? I believe that unless you declare the bean read-only in jboss.xml (this will prevent ejbStore from ever being called), ejbStore will be called when synchronization is necessary but the cmp2 engine checks to see if anything has changed before writing to the database.

          • 2. Re: Performace tuning and CMP2
            Daniele Newbie

            Perhaps I've not explained my "problem" clearly.
            I know that declaring the bean read-only will prevent every data insert/update. But this is not my purpose. Certainly ejbStore is called whenever synchronization may be necessary.
            I'm only trying to understand if JBoss has some performance tuning options to enhance on-memory works. For example you say "cmp2 engine checks to see if anything has changed": how is this performed? How could JBoss know if something has changed in the DB (without reading its data every time) if it is not the only process accessing it? If there were a way to ensure JBoss that it is the only process accessing the DB it should be able to work only in memory whenever it's possible, in the assumption that nobody is changing underlined data meanwhile. In every moment memory could be a partial mapping of the DB.
            In a very simple way and some work this is implementable with BMP and a boolean field-status vector... but I was looking for a Container Managed solution.

            • 3. Re: Performace tuning and CMP2
              David Jencks Master

              The only way to get accurate info from the db when others are changing it behind your (Jboss's) back is to use commit option B or C so the data used in a transaction is reloaded in that transction.

              As far as what jboss can notice and control, that is whether you have changed data in an entity, with cmp2 the container manages the data via those abstract accessors, not your entity bean, so it has no problem noticing if you changed something. If you didn't, no db access on ejbStore.