Scalability of stateful session beans


Performance and scalability: Scalability of stateful session beans

  1. Scalability of stateful session beans (4 messages)

    I have heard someone saying that stateful session beans are not scalable. Is it true? If so why? And if not why?

    My opinion is that the applications using stateful session beans may not be scalable because of the limitations of these beans. But however, this depends on the Application server being used. Am I right?

    Could someone clarify this please?


  2. Since they store conversational state of the client, stateful session beans are far less scaleable than stateless ones, but that's subtely different from saying that stateful beans are not scaleable.

    The steps go...

    1) Client proxy object calls method on server side EJBObject.
    2) EJBObject is attached to an instance of the appropriate bean type.
    3) All client conversational state from the EJBObject is set in the bean.
    4) The method is run.

    Step (3) is completely avoided using a stateless session bean. Since it tends to get done by reflection, this is a relatively expensive step and a good one to avoid.

    The more important issue is that most servers cannot fail over method calls on stateful session beans. If the server dies then the client proxy will get an exception and will have to relookup the bean. With stateless beans this is not usually an issue. (See other posts on session beans and idempotence etc for more info.)

    Does that help?


  3. Thanks Tony, your reply clarifies my doubt.

  4. What about when using the in-memory replication featured in Weblogic 6.0?
  5. That makes the more fault tolerant, but the step of restoring the state from the client still makes them less scalable than stateless session beans.

    However, with the new features in 6.0 I expect stateful beans to be much less painful to use than in the past.