Announcement Announcement Module
No announcement yet.
Services should be stateless? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Services should be stateless?


    Is stateless service singletons prefered way of designing service layer ? Problem is that sometime I need some statefull service, but it simply doesn't work since most of my clients demand balancing my web app across multiple servers, thus avoiding single point of failure...

    Any suggestions ?


  • #2
    Could you not store state in your client (ie webapp) tier? Thus using the web server's session replication capabilities if this is actually required.


    • #3
      I don't see web session as shared storage solution in many cases. First, it is only shared among one client's requests. And second, it last only for some time, not indefinetily.
      Let's say I wan to start some scheduler that will do some actions periodically, maybe send emails once per day, and various client actions can affect it by fetching it's reference through BeanFactory and update it's workings. And it works fine until you cluster your whole application on multiple servers, since scheduler isn't singleton on cluster level anymore...?


      • #4
        I store certain kinds of states in a database, and one that comes immediately to mind is processing requests in a physical access management system because these have to survive for up to 30 days.