View Full Version : Services should be stateless?
vmarcinko
Sep 13th, 2004, 05:13 PM
Hi.
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 ?
-Vjeran
Ben Alex
Sep 13th, 2004, 05:25 PM
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.
vmarcinko
Sep 13th, 2004, 05:41 PM
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...?
smccrory
Sep 13th, 2004, 06:46 PM
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.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.