Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

should i go for an EJB?  RSS feed

 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am developing a small workflow for HR management. Currently i have connection pooling using DDConnectionBroker and i have deployed the application on tomcat. I use struts for MVC. My application pattern is like this.

JSP -> Controller -> Helper -> Delegate ->DAO
(view) (Controller) (JDBC statements)

Now everyting seems to be working fine. My doubt is should i go for an EJB? As my application grows with new requirements will it be able to withstand the load if the pattern is as above?



Thanks and Regards
Venkatesh S
 
Mattias Arthursson
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm quite sure that you won't gain any performance benefits by adding an EJB in your design - that will only result in overhead. There are some other concerns, like transaction support and stuff, that an EJB container will give you, but you might as well stay with the current design and use a lightweight container like Spring to handle the transactions if needed.

Also, if you will need clustering further on, several application servers will handle that for you if you use EJBs, but there are other ways of doing that without adding the extra complexity of EJBs.
 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO, the words "small" and "EJB" does not belong together. Only add EJB if or when you need it.
 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mattias Arthursson,

I am already done with transaction management and its simply fine . Thanks for the information provided but wanted to know what if the application scales along?

Thanks and Regards
Venkatesh S
 
Mattias Arthursson
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will typically not add improve scalability by introducing EJBs - rather the contrary, since the EJB container adds unnecessary overhead.

Clustering (if that will be needed further on) may be a concern, but chances are good that you won't need it and if it comes to that there are other products that will help you with that.
 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes thats true but i am really curious to know like if the industrial level applications developed without EJB's are stable enough?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mattias Arthursson:
You will typically not add improve scalability by introducing EJBs - rather the contrary, since the EJB container adds unnecessary overhead.


Not sure I understand why you say this. EJB's are distributable components and one of their best features is that they can make an application more scalable.

Originally posted by Venkatesh Sai:
Yes thats true but i am really curious to know like if the industrial level applications developed without EJB's are stable enough?

Absolutely. there are plenty Servlet-only or Spring applications out there.
[ March 31, 2006: Message edited by: Paul Sturrock ]
 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Sturrock:

Absolutely. there are plenty Servlet-only or Spring applications out there.

[ March 31, 2006: Message edited by: Paul Sturrock ]


Hi Paul Sturrock,
Nice to hear that. The application i have developed and enhancing is using struts framework, MySQL and without EJB's. Deployed on tomcat 5.

I thought EJB's would make the application scalable
 
Mattias Arthursson
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB's are distributable components and one of their best features is that they can make an application more scalable.


Please correct me if I'm wrong as I might be on thin ice here, but the fact that the components in themselves are distributable doesn't necessarily mean that they are more scalable, does it? There's no reason to have the components managed on another server instance than where they're used (that adds an enormous amount of overhead in marshalling/unmarshalling), so I'm guessing that you refer to clustering.

Admittedly, this is a bit of speculation on my part, but I can't see any benefits with having a stateless EJB clustered (as compared to running on separate paralell server instances), clustered entity beans can be replaced by a distributed cache of POJOs if needed, and as I understand it stateful beans should be avoided as much as possible; if you need failover on session state you should probably handle that differently anyway.

And as long as you're NOT clustering your server environment (i.e. running on one single machine or on separate paralell server instances) the traditional EJB server does add quite a bit of overhead - compare the memory consumption of a lightweight container with that of a traditional app server for instance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!