users@jersey.java.net

[Jersey] Re: Providing a stateful JAX-RS service in a cluster

From: algermissen1971 <algermissen1971_at_me.com>
Date: Fri, 25 Feb 2011 09:26:54 +0000 (GMT)

Gee - I skipped the first para. You did already make it a reasource.

Then I think your reference to 'session' is not really the issue.

Can't you place the node information into the URI? What is the point of load balancing the requests if they hit the same node anyway?
Or is this a public service and needs 'normal' URLs?

Jan


On 25 Feb, 2011,at 10:18 AM, Leo Romanoff <romixlev_at_yahoo.com> wrote:

>
> Hi,
>
> I have implemented a Jersey-based front-end for a very stateful service with
> a lot of state. The exposed APIs of this service are:
> - startSession (starts a long running process, returns process id)
> - readSessionState (get current snapshot of the process state)
> - stopSession (stop a long running process with a given id)
>
> The stateful service is running on the cluster. Currently, no failover is
> supported, which means that if a long running process is started in node X,
> it continues to run on node X. All subsequent requests related to this
> process should go to the same cluster node X.
>
> Now, I'd like to make the Jersey-based front-end for this service also run
> in the cluster mode. To achieve that I'd like to use load-balancing of
> incoming startSession requests between nodes to produce an even load on
> cluster members. And I need to achieve that all subsequent readSessionState
> and stopSession requests land at the right cluster node, that was picked for
> the initial startSession request.
>
> Probably some sort of a cookie should be provided? Or may be internal
> request rebalancing, i.e. if a request lands at the wrong node, it is
> redirected by the wrong node to the right one?
>
> At the moment, I don't see any very obvious solution for that. Therefore I'd
> like to ask on this forum, what kinds of solutions can be used to solve the
> mentioned problem?
>
> Thanks,
> Leo
>
> P.S. NOTE: I know that a stateful service is not a good idea from the REST
> point of view. But its statefulness cannot be changed - it is a big legacy
> system and not a subject to change. The reason for providing a Jersey
> front-end for this service is to make this service easily usable from
> AJAX-apps and other Web applications.
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Providing-a-stateful-JAX-RS-service-in-a-cluster-tp6063881p6063881.html
> Sent from the Jersey mailing list archive at Nabble.com.