Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

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.
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!