The benefit of pooled stateless session beans vs singleton use?
posted 7 years ago
I'm curious what performance advantages do you get (if any?) using a pool of stateless session beans vs a single instance of an object (singleton)?
For example, imagine first a non clustered application where initial communication comes in through a servlet.
From my understanding way back when I studied this stuff, containers create single instances of each servlet (yea I know that can be altered but everything I read back in the day said you don't want to mess with changing the instances of servlets created.) Now lets assume the doPost does a local ejb lookup and gets you a local stateless session bean. The container will create a pool of these beans, but does that actually give you a performance gain over your servlet just calling a method from a singleton pojo? If so how? I can see for asynchronous stuff with mdbs how a pool helps - but what do you gain from a pool of stateless session beans (assuming you are comparing to using singletons.)
I'm probably missing some basic concept here - so someone fill me in thanks
Brick, Welcome to JavaRanch! This must be a popular question. We just discussed it last month. Here's a link to that thread. Feel free to reply with a follow up if you have more questions after reading the discussion in that thread.