aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Concurrency / pooling with EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Concurrency / pooling with EJB" Watch "Concurrency / pooling with EJB" New topic
Author

Concurrency / pooling with EJB

Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
Hi. I have a question about concurrent access of many clients. Suppose I have a stateless session bean, which is pooled, and the pool has at most 10 instances. Does this mean 10 clients can be served simultaneously (1 for each bean, the 11th client waits) or can many many more client be served (because each of the pooled beans can be accessed by many threads of control)? The same would relate to MDBs.
With stateful session beans, if I have a million clients connected, and the memory and hardware would allow this, would I have a million ejb instances? What if the server runs out of memory? Does it throw an exception then?
Thanks.
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Raf,

Here are some pointers:

1. The number of concurrent stateless session beans are limited by the upper bound for the pool. If you don't think you need bandwidth control, you can set the pool size to increase indefinitely (not all app servers support this since it is really not advisable from an application SLA standpoint).
2. Once memory is low enough, most application servers will start serializing stateful session beans to the disk. This works as long as the high number of stateful clients are not "truly" concurrent. This is one of the reasons I worry about things like Seam that encourage the stateful model more than is necessary.

Regards,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concurrency / pooling with EJB