dcsimg
Helper javabean classes v/s stateless session beans
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ramnath_Krishnan
Posted On:   Monday, November 4, 2002 12:43 PM

I conducted a load testing experiment recently on one of my application that uses the Model View Controller Architecture. The Controller is a servlet that uses a helper bean as a model(business logic) to perform some database operation. The view is a jsp displaying additional information. Next, I replaced the helper bean with a stateless session bean and using value objects,it performs the same task as the helper bean. The load testing results showed that the application with helper bean class is more efficient than the one using stateless session bean. Note: I had a maximum of 1000 beans in pool and 100 beans instantiated in the free pool using weblogic 6.1. on a sun solaris machine. # of users: 6   More>>


I conducted a load testing experiment recently on one of my application that uses the Model View Controller Architecture. The Controller is a servlet that uses a helper bean as a model(business logic) to perform some database operation. The view is a jsp displaying additional information.


Next, I replaced the helper bean with a stateless session bean and using value objects,it performs the same task as the helper bean.


The load testing results showed that the application with helper bean class is more efficient than the one using stateless session bean.
Note: I had a maximum of 1000 beans in pool and 100 beans instantiated in the free pool using weblogic 6.1. on a sun solaris machine.
# of users: 65
Average Time for app with helper bean classes: 7 s
Average Time for app with statelss eJB: 8 s


There are a number of reasons why ejbs are slower than the helper bean model, I would like your opinion on the following:-


1. Why is the helper bean app model faster than with EJB's
2. If its inherently faster, why not just use helper classes than use stateless session bean.


Please assume, that there is no requirement for distributed calls or discovery from other J2EE containers and that all available code resides on one machine.


Here are my 2 cents:(not sure, it makes any sense)
With the helper class model, only resources for the web container is used and not the ejb container, but for ejb model both the web container and the ejb container is used, thereby adding the extra performance hit. But why pay this price if app is not distributed or can be contained in one j2ee container.


Any suggestion pointing to use or efficiency of EJB v/s helper classes or articles will be greatly appreciated.


Thanks

   <<Less

Re: Helper javabean classes v/s stateless session beans

Posted By:   Nick_Maiorano  
Posted On:   Saturday, November 9, 2002 09:49 AM

Hi Ramnath,



I supect that the reason you didn't get good performance out of your stateless bean was because of your transaction demarcation. In other words, you may have started many transactions for every single request when only one sufficed. Try this experiment:



1) Create a method in your stateless bean that will fetch a row from 2 different tables in the database using entity beans

2) Call several getXXX() methods on both entity beans

3) Call several setXXX() methods on both entity beans

4) Make sure your stateless bean has a "required" transaction demarcation

5) Re-run the test

Your stateless bean will out-perform your helper class by a wide margin.



I think your test case was contructed in such a way that didn't showcase the power of session beans. The benefits of EJBs are automated transaction control and declarative security. Plus, they will way scale better for applications that make heavy use of transactions. Furthermore, they offer better failover mechanisms than servlets. However, you are correct in stating that not all applications need EJBs. In other words, don't use an 18-wheel truck to carry your groceries if all you need is some milk at the corner store.

About | Sitemap | Contact