• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tradeoff using http session/stateless bean and stateful session bean

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 196
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well put Rajan. For more information on this topic, "session affinity" is a good word to search for.
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sticky sessions will be required if you are running multiple web servers to address availability
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic