Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tradeoff using http session/stateless bean and stateful session bean

 
guru prasanth
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application i want to use stateless session bean and store values in httpsession.
In this case i can use one webserver and one appserver running on two machine.
Is this fine?
Or is it better to use stateful session bean and not store in http session.
In this case i can use one webserver and 2 appserver running on two machine.In this case
i must implement session stickiness.
 
Rajan Choudhary
Ranch Hand
Posts: 196
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach of not using the stateful session bean is right to me. Stateful MUST be used very carefully and only when it's really required to implement the business logic. Your decision to use stateful for just handling the http related requests may be proved very expensive.

I may be wrong but my understanding is that load balancers maintain the requests with right host and cluster takes care of session migration among clustered servers based on the topology used for cluster. There is nothing much for architects to design here. Just notes that, this is what you know and will be implemented by system admins and network teams.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well put Rajan. For more information on this topic, "session affinity" is a good word to search for.
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you said you are going to use one web server. So obviously all the requests will be sent to the same web server .In that case why would you need session stickiness.
And about using stateful session bean, if you are going to pass more data into the app server(EJB param) for every call, it consumes more bandwidth. That implies that this scneario needs maintaining the state on the app server side. So you would have to use Stateful in this scenario.
 
Rishi Shehrawat
Ranch Hand
Posts: 218
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sticky sessions will be required if you are running multiple web servers to address availability
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic