• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMP V/S CMP

 
Sridhar Raman
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any performance advantage of using BMPs over CMPs?

Thanks in advance
Sridhar
 
Dhanush Dharsh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>> Is there any performance advantage of using BMPs over CMPs?
what do u mean by perf advantage. In BMP the container handles the low level stuff like connection handling and stuff whereas in BMP U EXPLICITELY HANDLE IT IN YOUR OWN WAY...
 
Rajat Juneja
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sridhar,
In BMP you have the opportunity to use your own well-tuned queries whereas in CMP you have to do with container generated ones.
That said, the performance advantage was definitely there in 1.1
In 2.0, CMP performance is thought to be good enough for it to be used in preference over BMP because of its obvious other advantages.
Rajat
 
Sridhar Raman
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhanush,
I came across a piece of information sometime back when preparing for Part I, probably from this forum, that DAO+BMP offers faster performance than CMP. I didn't quite question it critically at that time as to why it was so and am now trying to understand if it is correct. Any more insights?
Rajat,
Did CMP have any unnecessary overhead in 1.1/1.2 and it has been cleaned up now in spec 2.0?

Thanks
Sridhar
[ February 20, 2004: Message edited by: Sridhar Raman ]
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since CMP is handled by the container( and written by people who understand SQL well,) it can be argued that BMP can potentially result in performance overhead because of bad handwritten SQL. It can also be argued the otherway ie., since CMP is internally handled, one has no control over the SQL it generates.
With BMP, complex SQL logic can be handled using stored procedures and therefore BMP offers more opportunities for creative performance solutions. The strenghts of CMP are only as strong as its weak points.
Therefore, in the absence of specific scenarios, it is hard to argue one is better than the other.
 
Rajat Juneja
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Ajith in principle. But at the same time I would also like to add that CMP generated queries, though supported, through lot of indirections, by people who know SQL well, ultimately has to serve a generic framework. And this is where the inefficiences pour in. If you try to look at what the container does to a possible simple BMP query, by turning on logs, you would know what I mean.
But ofcourse, ultimately the resulting performance requirement and time to be spent coding makes the difference. And it's here that 2.0 CMP is said to overall score well.
Sridhar, I haven't ever tried to understand the 1.1 CMP model and hence wouldn't know the changes in 2.0 specs. Probably, somebody who has followed ejb spec journey from its initiation can comment. Anyone ?
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sridhar, I haven't ever tried to understand the 1.1 CMP model and hence wouldn't know the changes in 2.0 specs. Probably, somebody who has followed ejb spec journey from its initiation can comment. Anyone ?

With regard to CMP, the main changes in EJB2.0 has been the introduction of Container Managed Relationships(CMR) and the EJB Query Language(EJBQL).
If you are interested in reading about EJB2.0 changes, check out this link -
http://java.sun.com/developer/technicalArticles/ebeans/ejb20/
I have to point out that changes in the spec usually has no bearing on robustness in a vendor implementing the spec. Here is where as an architect you have to make a decision between performance and portability. A lot of vendors provide sophisticated fine-tuning and configurability of their implementation. If you decide to use them, you will get into a vendor-lock in.
 
Sridhar Raman
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the inputs, Ajith/Rajat. I understand from the discussions that choosing BMP over CMP or vice-versa is a scenario specific issue and there are no general motivations to choose one over the other when dealing with tradtional data sources with well-understood data types. Your points have answered my question satisfactorily.
Regards
Sridhar
 
Rajat Juneja
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the general motivation is that you "should" try to use CMP wherever you can as it saves a lot of time.
"What you end up chosing" would be the result of scenario specific analysis.
[ February 20, 2004: Message edited by: Rajat Juneja ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic