Leandro.

Essa sua pergunta tem mais sentido na lista enterprise, mas...
Uma explica��o clara para auxiliar na escolha do tipo de Session para 
cada situa��o analisada

Alvaro

Leia isso.

"Stateful versus Stateless Session Beans
EJB offers two forms of session beans: stateful and stateless. The 
choice between these can significantly affect system scalability. Each 
has strengths and weaknesses. Stateful session beans provide a 
convenient stash for conversational state in the application. 
Consequently, they make an application easier to program. But stateful 
beans have their dark side. Because they hold state, they must be mapped 
one to one with application clients. Thus, if an application has 10,000 
concurrent clients it must manage 10,000 stateful session beans. How 
many beans can a container manage and maintain acceptable performance? 
Well, more than you might think, but not too many. To help with this 
problem, stateful beans have a complex lifecycle that includes the 
possibility of the passivation and activation by the container. But 
passivation and activation are not without cost. The bean's state 
information must be committed into and recovered from the database, and 
the bean must be reinstantiated and populated upon activation.

By contrast, stateless session beans are more complex to program: if an 
application must save conversational state, this information must be 
accommodated somewhere else in the application architecture. For 
example, the application might commit state information into the 
database or stash it in some other artifact in the system (HTTP session 
state, etc.). The important advantage of stateless beans is that they 
can be shared among many clients. The basic approach is to create a pool 
of the stateless bean references. Clients grab a bean reference out of 
the pool, use it for a method invocation, and return it to the pool for 
another client to use. Using this scheme, 10,000 concurrent users might 
be served by a few hundred beans

Systems using stateless or stateful beans will ultimately differ in 
their ability to scale. Because stateless beans can be multiplexed 
across many clients, systems built on stateless beans can scale to 
larger number of users. However, stateful beans are a very legitimate 
choice for small applications (those serving a few hundred concurrent 
users). By contrast, large-scale applications (those serving many 
thousands of concurrent users) clearly need to use stateless beans in 
order to scale. So what of the gray area we run into with applications 
serving a few hundred to a few thousands clients? At what point do you 
say that stateful beans are too costly and move on to stateless? 
Unfortunately, there is not wide industry experience with this 
technology and so the answer is unknown. Over time, metrics will arise 
to help guide this decision. In the meantime, perhaps the best rule of 
thumb is that if the number of users could possibly -- ever, in your 
wildest dreams -- grow beyond a few thousand, go stateless."


Leandro Franchi wrote:

> Ol� lista, gostaria de saber qual � a diferen�a entre EJB Sessions 
> Stateful e Stateless...
>
> Grato
>
> Leandro Franchi
>



------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br  -  Sociedade de Usu�rios Java da Sucesu-SP
d�vidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
historico: http://www.mail-archive.com/java-list%40soujava.org.br
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------

Responder a