Combining Redis engine with custom engine

34 views
Skip to first unread message

Andrew Longley

unread,
Sep 13, 2017, 1:12:38 PM9/13/17
to Faye users
The architecture I want to have is to have two Faye servers (for failover) clustered via Redis, but to have a custom engine do the pub/sub. 

Thoughts on how I would accomplish this? Would I have a custom engine essentially do what the faye-redis engine does for notifications, but have the pub/sub go through new code I write? Or is it not so easy to separate the two functions? Has anyone implemented a clustered custom engine?

James Coglan

unread,
Sep 13, 2017, 3:45:21 PM9/13/17
to faye-...@googlegroups.com
On 13 September 2017 at 18:12, Andrew Longley <aolo...@gmail.com> wrote:
The architecture I want to have is to have two Faye servers (for failover) clustered via Redis, but to have a custom engine do the pub/sub. 

Thoughts on how I would accomplish this? Would I have a custom engine essentially do what the faye-redis engine does for notifications, but have the pub/sub go through new code I write? Or is it not so easy to separate the two functions? Has anyone implemented a clustered custom engine?

Could you explain a little more what you mean by clustering via Redis but using something else for pub/sub. The whole job of the engine is to do that actual message routing that makes pub/sub work, so if you're using something else do pub/sub I'm not sure what other tasks Redis would be performing.

Andrew Longley

unread,
Sep 14, 2017, 2:56:42 PM9/14/17
to Faye users

Could you explain a little more what you mean by clustering via Redis but using something else for pub/sub. The whole job of the engine is to do that actual message routing that makes pub/sub work, so if you're using something else do pub/sub I'm not sure what other tasks Redis would be performing.

Thanks for replying. I guess it boils down to, how to cluster two or more Faye servers using a custom engine. Let's assume there will be a load balancer or F5 device or something in front of the Faye servers.  Do the 2 or more Faye servers need to know about each other? Or is it sufficient for the LBs/F5 to establish sessions (word used loosely) and as clients connect, they just keep traffic roughly split between the two Faye servers? In this scenario if a Faye server goes down does the other Faye server need to know about it's clients so that it can pick up the slack? Maybe the Faye server is opaque to both the client and the Redis server and as long as _A_ Faye server is up the communication happens in this scenario.

I guess bottom line is I don't understand exactly how the Faye-redis (or the -sharded) Engines help create a HA Faye cluster (vs. the memory engine). Not trying to get a lot of your time, but if you have links to info I can read to grock this I'd appreciate it.




James Coglan

unread,
Sep 16, 2017, 4:39:59 AM9/16/17
to faye-...@googlegroups.com
To answer your question about whether multiple Faye servers need to know about each other: in order for multiple Faye servers to act as a single service, a couple of things must be true:

- IDs issued to clients must be unique across the cluster
- Messages published to one server must be forwarded to any client connected to any other server

The Bayeux protocol that's Faye is built on does not require sticky sessions; any client should be able to connect to any server and get the same behaviour. If one server shuts down, the clients connected to it will make fresh polling requests, which will be routed to another server assuming your load balancer is set up correctly. Whatever server a client connects to each time, that server should be able to recognise that client as active by its ID, and route messages from other clients to it.

You should view the Faye servers themselves as stateless; the engine is the only stateful part of the stack since it stores client ID, subscriptions and message queues. Everything above that does the job of exposing the engine's service via the Bayeux protocol and various network transports. 
Reply all
Reply to author
Forward
0 new messages