-
1. Re: CMP performance
dokomesiter Nov 9, 2002 10:16 AM (in response to arno.huetter)Either you have an incredibly fast machine or you're testing one of the simplest cases.
Take your example, and use JBoss's AutoNumberFactory (like in the examples) to generate a unique primary key, and add CMR to another table.
You should get enormous performance degradation.
Yeah, it's a bit disappointing.
We'd hoped we were doing something wrong, and have tried everything in the doc, commit options, eager/lazy load, etc. etc, even using gemstone.
And there doesn't seem to be any circumvention other than "roll your own" if you need to access a non-trivial number of records. -
2. Re: CMP performance
drbugs Nov 13, 2002 4:10 PM (in response to arno.huetter)Wow!
Is there any way to use the database sequences (oracle, postgresql, etc)?
Using Jbuilder 7EE, and the Borland App Server, there is an option to Get Primary Key before insert. You type sql there such as select(nextval('customer_pk_seq'));
Also, do you have any links to the Jboss key factory?
Tx!
R -
3. Re: CMP performance
arno.huetter Nov 14, 2002 5:51 PM (in response to arno.huetter)Hello!
I used a local oracle 8i db, local home and remote interfaces, passed value objects to ejbCreate() and implemented my own simple (and hopefully fast) key creation algorithm. Still, I think the server could defer all inserts until the end of the transaction, and batch them then. Is there any way to achieve that? Will create() run in the caller's transaction context by default, or do I have to change the transaction type?
Kind regards,
Arno Huetter -
4. Re: CMP performance
vickyk Nov 15, 2002 2:58 AM (in response to arno.huetter)> Hello there,
>
> I did some performance profiling on my CMP entity
> beans. Creating 7000 beans (resulting in 7000 db
> inserts) took about 55 seconds (Oracle 8i, using
> LocalHome interface). Removing them took 25 seconds.
> I create/remove the EJBs within a session bean, using
> CMT.
>
> These results are somehow disappointing. I wonder
> about potential performance optimizations. Might it
> be that all those inserts/delete are being
> autocommited? If yes, is there a way to let them be
> batched and commited once at the end instead, or does
> this collide with CMP?
>
> Any ideas would be highly welcome.
>
> Kind regards,
> Arno Huetter -
5. Re: CMP performance
vickyk Nov 15, 2002 3:00 AM (in response to arno.huetter)Hi ,
Sorry for earlier post.
>
> I did some performance profiling on my CMP entity
> beans. Creating 7000 beans (resulting in 7000 db
> inserts) took about 55 seconds (Oracle 8i, using
> LocalHome interface). Removing them took 25 seconds.
> I create/remove the EJBs within a session bean, using
> CMT.
Have you checked how much time it takes to insert/delete the 7000 records in DataBase directly?
> These results are somehow disappointing. I wonder
> about potential performance optimizations. Might it
> be that all those inserts/delete are being
> autocommited? If yes, is there a way to let them be
> batched and commited once at the end instead, or does
> this collide with CMP?
How much minimum time you do expect to do the inserts and delete?
regards
Vicky -
6. Re: CMP performance
arno.huetter Nov 15, 2002 10:43 AM (in response to arno.huetter)Hello!
Ooops, I meant "local home and object interfaces", not "local home and remote interfaces".
Yes, JDBC-batching those db inserts directly takes 8 seconds (vs. 55 seconds on CMP), bacthing the db deletes takes 12 seconds (vs. 25 seconds on CMP).
Greetings,
Arno Huetter -
7. Re: CMP performance
juha Nov 16, 2002 4:56 AM (in response to arno.huetter)Ummm... so what's the point of this benchmark? How often do you need to create 7000 records all at once? It's the finder performance that counts. If you really need to create that many rows at once then use JDBC and set autocommit off.
-
8. Re: CMP performance
vickyk Nov 16, 2002 8:15 AM (in response to arno.huetter)Hi,
> Yes, JDBC-batching those db inserts directly takes 8
> seconds (vs. 55 seconds on CMP), bacthing the db
> deletes takes 12 seconds (vs. 25 seconds on CMP).
The insertion through EJB means basically creating the new EntityBean,means the network trips every time unless you use some Patterns to minimize.In order to make the trips reduced you can use the Session Facade hence the trips will be reduced.I hope this will increase the efficiency...
Similarly you call delete through the Session Facade with Local References.
Regards
Vicky -
9. Re: CMP performance
arno.huetter Nov 16, 2002 1:29 PM (in response to arno.huetter)Hello Vicky,
thanks for your reply. But as mentioned above, I call all those create()'s from within one loop in my session bean (which you might want to call the benchmark's SessionFacade), and I already do use local interfaces. My profiling included the execution time of 7000 create() invocations, not more than that.
But you are right abound the roundtrips, which actually are roundtrips to the database. Instead, I wished I would know how to convince JBoss to execute one single JDBC batch (covering all those inserts) once only at transaction commit time (at the end of my session bean method). Does anybody know how this could be achieved?
Kind regards,
Arno Huetter -
10. Re: CMP performance
arno.huetter Nov 16, 2002 1:33 PM (in response to arno.huetter)Juha,
well, those inserts actually are a real business case in our application. I do know that I can switch back to Bean Managed Persistence anytime, but where is the point of Container Managed Persistence with this kind of performance drawback?
Kind regards,
Arno Huetter -
11. Re: CMP performance
juha Nov 16, 2002 2:16 PM (in response to arno.huetter)There are many points in using CMP. Using it to batch create 7000 records may not be one of them though.
-
12. Re: CMP performance
arno.huetter Nov 16, 2002 3:20 PM (in response to arno.huetter)Juha,
as far as I know, several EJB server vendors support deferred database writes, exactly because of issues like this. My original question was referring to whether JBoss does or not.
Some application scenarios might require batch tasks. In this case, I don't want to break a chosen CMP approach by hardcoding SQL batches.
Thanks anyway.
Kind regards,
Arno Huetter -
13. Re: CMP performance
arno.huetter Nov 18, 2002 7:49 AM (in response to arno.huetter)I tried to set <sync-on-commit-only> to true in standardjboss.xml, hoping that the underlying SQL inserts would be batched at the end of the transaction. But this even decreased speed (seems as if I misunderstood the meaning of this setting).
Transaction type of my entity beans is "Mandatory", so creation should be executed within the transaction of the calling session bean.
Kind regards,
Arno Huetter -
14. Re: CMP performance
jboynes Nov 19, 2002 2:27 AM (in response to arno.huetter)This is planned for 4.0.
Until then, you do have the option of using JDBC to batch create the records and CMP for other accesses. Just be careful about caching effects after the initial insert.
But, as Juha says, if most of you access is batches, are entity EJBs the right technology for you anyway?