• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet - > EJB -> Local classes v/s Servlet->Local classes  RSS feed

Ramnath Krishnan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had done some load testing using the following 2 approaches
1. Servlets - > Local Classes -> Database
2. Servlets -> EJB -> Local Classes -> Database
The Local Classes above are different and modified to suit each model.
My observation was that Model-1 was much faster(as expected)at about 65 users.
Q.1 Having said this, why should I go for Model 2, assuming that my application is not relying on heavy interaction in a distributed environment.
My Conclusions:
1. In Model 2, I can account for the overhead because of communication between Web Container and EJB container. Also, there is an extra bit of overhead using rmi.
2. No matter how many instances are available in the free pool, there may still be a requirement to instantiate new beans, which means some time spent in creating the objects.
3. Local Classes execute in the same container that it was initiated from. So in Model-1, local classes execute in the web container, and in the model-2 they execute in the EJB Container.
Am I right in this conclusion ?
Also, at runtime, the EJB instances are acquired from the free pool and shared across many clients, which requires passivation of the bean ( another added overhead)
Whereas, in the model-1 approach, new instances of the local classes are created as needed.
Q.2: Why use EJB instead of just helper classes/beans to perform tasks.
Q.3 Has anybody seen better performance in using Model-2 and how?
Thanks and appreciate any response.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!