Hello,
clustering code for SFSB will bring you much of what you need. There is,
nevertheless, an "interesting" distinction.
When you work with a SFSB, the client keeps a reference on the bean. This
reference (stub) contains the list of target server that own a copy of the
state (generally a subset of the whole cluster members). Fine.
With clustered-HTTPSession, we generally have a hardware load-balancer in
front of the cluster i.e. HTTP invocations may be directed to any Jetty
instance (well, generally you can configure load-balancer to be smarter than
this and detect the "session" and thus always redirect to the same target).
Consequently, as any Jetty instance may receive a given invocation, Jetty
then needs to perform some kind of "getStateForSession (id)" on the cluster.
Fine.
Now, we have a location-problem: how could the "getStateForSession" be
performed will minimal impact (i.e. minimize network round-trip delays).
Either we use a dummy solution that will first find a bean with a given
session id and then get its state or we use a customized-way. The first
solution is a LEGO solution i.e. we use what is already present and build a
new concept but may not be really really smart in term of performance
(imagine the work needed for each HTTP call!)
For the customized-way, we may have some kind of service (we can implement
it as a SLSB, of a JMX service) that Jetty contact to get the state of a
given sessionId. As Jetty could reuse this service, only a single call to
this service is needed for each http call: getStateForSession. Any
optimization is then done in this service. Two implementation ideas (at
least):
1) Each node contains a kind of lookup table (SessionId, Targets) which
hold, for a given sessionId, the list of nodes that own a copy of the state.
The service then contact, sequentially, each of these target until a working
one is found (well, most of the time, the first will be ok). In the
background, the SessionState service (already implemented for SFSB) is used.
2) When creating a new sessionId, jetty asks the cluster service for a
given id. This id is appended, in some way, by jetty to the http session
(url, cookie, hidden field, SSL id, ...). When Jetty receives an invocation,
it decodes the session, get the cluster-id, and call getStateForSession
(sessionId, cluster-id). For the rest, everything is equivalent to the
previous proposal.
In the first case, we need to maintain a possibly large table of httpsession
on each node of the cluster but we make no intrusion on the jetty management
of session-id. In the second case, a session-id is shared by many many
httpsession so the overhead on each node is very small but we are intrusive
on the jetty side: the id that reference the session is no more completely
managed by jetty but a part of it now belongs ot JBossCluster.
Julian, once a desgin is choosen, if you want, I can work on the JBoss-side
of the problem and create such a service.
Cheers,
Sacha
> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]De la part de marc
> fleury
> Envoy� : lundi, 24 d�cembre 2001 15:44
> � : [EMAIL PROTECTED]
> Objet : Re: [JBoss-dev] distributed HttpSessions - advice...
>
>
>
> > I've put aside some time early in January to try to
> > get out my first cut.
>
> excellent
>
> > Initially my plan was to just use e.g. CMP to save
> > the
> > entire Session HashMap into the DB.
>
> yes, I argue that using the implementation that is in there with
> the SFSB in memory could be a big time saver, but that is besides
> the point just use CMP and we will plug in the right persistence.
>
> > I am now concerned that:
> >
> > 1). It is going to be difficult to ensure colocation
> > (ClassLoader-wise) and therefore optimisation of
> > distributed servlets and the HttpSession ejb-jar.
>
> Don't worry about this,
> a- I am working as we speak on the integration of the
> classloaders that won't be a problem
> b- the clustering of SFSB detects colocation in the proxy already
> so that is taken care of for you.
>
> > 2). By using EJBs I may end up paying for
> > functionality (speedwise) that I am not using...
> > (authentication etc...).
>
> This functionality
> 1- you pay nothing
> 2- we remove it with the JBoss container (we don't configure the
> security stack).
>
> The optimization of the that is really something that is
> independent of you. Just go ahead.
>
> > If this is the case, then would I be better off
> > simply
> > going native to the DB ? - would I not sacrifice
> > portability ?
>
> no no no, use that EJB and we will plug in persistence that can
> stay in VM... that is EJB for you :)
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development