users@websocket-spec.java.net

[jsr356-users] [jsr356-experts] Summary: Web Socket Sessions in Distributed Servers

From: Danny Coward <danny.coward_at_oracle.com>
Date: Thu, 06 Dec 2012 18:12:03 -0800

Hi folks,

I didn't end up getting a response to this one, so I did my own research.

What seems to be happening as folks add websockets to distributed
servers, is that they are using a gateway/proxy/loadbalancer that is
websocket aware in some way. The point to point TCP websocket connection
is between the clients and this facade. The facade is knowledgeable
about the nodes in the cluster and where the server side of the
application is running, and knows how to insulate its active clients
from a node failover.

Since in this setting we are likely to be running inside an EE
container, this kind of failover is mostly transparent to the server
side developer, but not totally. So I'd suggest the websocket spec use
the guidelines of EE web applications that are 'distributable' for
applications deployed on distributed web servers. This places some
programming restrictions on web components which allows distributed web
containers to replicate a running session on a different node in the
cluster should one node fail.

So I think that means websocket applications that are 'distributable'
should not
- use static variables or local filesystems to store application state
(use a database instead)
- put non Serializable data in websocket Sessions

Let me know if you have more things you think the specification should
define for deployments on distributed servers.

Thanks,

- Danny

  10/24/12 6:16 PM, Danny Coward wrote:
> Hello websocket experts,
>
> One issue that came up with the Java EE group here at Oracle was how
> to handle web sockets in the distributed container. This is JIRA issue 15.
>
> Most of you will know that the web container in Java EE can be
> distributed across a number of VMs. While the semantics are not
> crystal clear, there is the possibility in the spec that a distributed
> web container can 'move' an HttpSession from one node to another in
> the event of a node failure. Since we have been thinking of the
> WebSocket Session object as being a 'part' of the HttpSession
> corresponding to the same client, it is not clear what should happen
> to a Web Socket session this case. It seems unlikely/impossible to
> replicate the connection elsewhere if a node in the cluster fails, but
> I don't know.
>
> Does anyone have experience with websockets in this distributed
> setting that they could talk about ? We'll need to define what is
> possible in order that applications behave portably.
>
> Thanks,
>
> - Danny
> --
> <http://www.oracle.com> *Danny Coward *
> Java EE
> Oracle Corporation
>


-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation