wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes When to EJB, Scalability Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "When to EJB, Scalability Question" Watch "When to EJB, Scalability Question" New topic
Author

When to EJB, Scalability Question

Jason Stull
Ranch Hand

Joined: Feb 02, 2004
Posts: 47
Hi Ranchers,

I'm starting work on a web application that will have around 300 users, where around 200 of those users will be using the application at any given time. In terms of scalability, am I at the point where EJBs make sense for this application in terms of scalability? The web application contains some heavy business logic and a lot of CRUD type data access behavior.


"I believe in coyotes and time as an abstract Explain the change the difference between What you want and what you need there's the key"
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Jason,

I work on the development and support of the web app that can have up to 40 concurrent users and more. This web app is build on J2EE - Servlets and EJB (both Session and Entity beans). Session beans are used for business logic (business facade) and Entity beans represent tables' records (entities).
Our current task is to improve the performance. The biggest kill comes from the entity beans. We are trying to reconfigure the system so that the entity beans are used only to update the database record (however, at the end we might stop using altogether).

If I was in your situation I'd think on leveraging on EJB advantages such as transaction management etc. However, I'd only use session beans and Plain Old Java Objects.

Would be good to hear from other ranchers about their thoughts on this topic.


Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
I am not convinced that you really need EJB for this application. Most standard web applications don't really need EJB. It is a common myth that EJBs are not for scalability and that is just not true. Applications built entirely on Servlets/JSP can be just as scalable as those making full use of the J2EE Stack.

For me there are really only three reasons to use EJB:
1) Remotability - Making distributed components with EJB is extremely, however this is a double-edged sword since most applictions should not be distributed.
2) Transaction Management - CMT is one of the best aspects of EJB. If your system makes heavy use of transactions (most don't) then EJB can be a compelling solution though there are others (see below).
3) Messaging - MDBs are a great convenience when creating message-based systems. I wouldn't want to write one without them.

For a full recap on my thoughts on EJB, read this article that I wrote for the JavaRanch Journal.

BTW, just because you may need some of the capabilities of EJB doesn't mean you actually need EJB. As an alternative, I suggest you checkout the Spring Framework, it provides many of the same services as EJB but without the need for an EJB Container. We were just discussing Spring over here if you are interested.
Lavern Matthew
Ranch Hand

Joined: Jun 05, 2004
Posts: 38
I agree with Alex. Use the Session Facade patter and behind that use POJOs. I would recommend using Hibernate as your persisence layer. And use Spring for transaction and session management.


Matthew Wilson<br />-http://valuelist.sourceforge.net
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
If you have no real need for much O/R mapping, by which I mean that the domain objects closely resemble relational database records, then surely all you need is JDBC.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
 
subject: When to EJB, Scalability Question
 
Similar Threads
What is the meaning of "SCALABLITY" ?
JSF Vs GWT
JBoss Seam compared to Spring/ Struts based app
running tomcat on windows as webserver and using it as webcontainer for IIS
Struts drawbacks