You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Jeff Genender <jg...@apache.org> on 2007/01/24 21:25:58 UTC

Clustering injection points

Need to bounce some ideas here...

A while back I put a URL array in the ServerMetaData so the client could
failover.  I now need to get that list to the client.

So here is an idea...

1) The server has knowledge of the list of EJB servers in the cluster.
It computes a hash on this list.

2) The client, on initial contact with the JNDIRequestHandler, will get
the server list in the payload response.

3) The client computes a hash of this list and keeps it somewhere on
it's side.

4) With each interaction or method call (or other EJB lookup), the
client sends this hash (4 bytes?) along with it's request payload to the
server.

5) The server gets the EJB request and compares the hash against it's
own computed version (see step 1).

6) If the hash equals the client's version, the server sends the normal
payload response.  Goto step 4.

7) If the server's cluster list changes, it has a different computed
hash, and notices the client's hash is different.  It sends a normal
payload, but also adds a new cluster list for the client to use appended
to the payload.

8) Client has new cluster list and computes a new hash. Goto step 4.

Thoughts on this?

Jeff

Re: Clustering injection points

Posted by Jeff Genender <jg...@apache.org>.

David Blevins wrote:

> First quick thoughts.   You likely don't need the client to create the
> hash, no reason the server can't send the hash it has at the time it
> sends the URIs. 
> For that matter, it doesn't have to be a hash, it could
> simply be a version number.  I.e. instead of the server creating a hash
> for the current URI set, it could simply give them a version number (one
> byte) which it will increment on every change to the URI set.  Then
> using the same logic you mention, if the server sees the client has a
> different number it will send the URIs + version number back to the
> client with the other data.
> 
> Thoughts?
> 

Yep...that works too...and it's less computational overhead...works for me.

I am assuming much of this code will go in the JNDIResponse, correct?
Are there other objects I may need to be aware of or implement this within?

Jeff

> -David

Re: Clustering injection points

Posted by David Blevins <da...@visi.com>.
On Jan 24, 2007, at 12:25 PM, Jeff Genender wrote:

> Need to bounce some ideas here...
>
> A while back I put a URL array in the ServerMetaData so the client  
> could
> failover.  I now need to get that list to the client.
>
> So here is an idea...
>
> 1) The server has knowledge of the list of EJB servers in the cluster.
> It computes a hash on this list.
>
> 2) The client, on initial contact with the JNDIRequestHandler, will  
> get
> the server list in the payload response.
>
> 3) The client computes a hash of this list and keeps it somewhere on
> it's side.
>
> 4) With each interaction or method call (or other EJB lookup), the
> client sends this hash (4 bytes?) along with it's request payload  
> to the
> server.
>
> 5) The server gets the EJB request and compares the hash against it's
> own computed version (see step 1).
>
> 6) If the hash equals the client's version, the server sends the  
> normal
> payload response.  Goto step 4.
>
> 7) If the server's cluster list changes, it has a different computed
> hash, and notices the client's hash is different.  It sends a normal
> payload, but also adds a new cluster list for the client to use  
> appended
> to the payload.
>
> 8) Client has new cluster list and computes a new hash. Goto step 4.
>
> Thoughts on this?

First quick thoughts.   You likely don't need the client to create  
the hash, no reason the server can't send the hash it has at the time  
it sends the URIs.  For that matter, it doesn't have to be a hash, it  
could simply be a version number.  I.e. instead of the server  
creating a hash for the current URI set, it could simply give them a  
version number (one byte) which it will increment on every change to  
the URI set.  Then using the same logic you mention, if the server  
sees the client has a different number it will send the URIs +  
version number back to the client with the other data.

Thoughts?

-David