slact / nchan

Fast, horizontally scalable, multiprocess pub/sub queuing server and proxy for HTTP, long-polling, Websockets and EventSource (SSE), powered by Nginx.
https://nchan.io/
Other
3.01k stars 292 forks source link

Anycast behavior? #421

Open xorander00 opened 6 years ago

xorander00 commented 6 years ago

First off, thanks for the great project, I love it! :)

Probably a dumb question, but I I didn't see it in the docs (or I just plain missed it). Is there an easy way to set up anycast behavior? I have an application where I have multiple nChan instances with shared Redis storage. Clients will publish messages to a channel that will have a pool of workers listening. A single worker should pick up the request & process it, so I don't want multiple workers listening.

I can think of two options for this:

This is for front-end clients to use for real-time search. I'd like to it be as low-latency as possible, so it'll be done via WebSockets and the worker pool will be warmed up & ready to go. My back-end system uses RabbitMQ for this and it works fine, so I just need to solve it for the front-end. Thoughts? :)

slact commented 6 years ago

Right now Nchan only supports the broadcasting pattern. Anycast requires additional semantics and configuration (distance measurements/load balancing) that I haven't yet thought through. There is, however, some overlap here with anycasting a message to exactly n subscribers.

So this is a feature I'm open to implementing. How badly do you want it, and is it something you'd like to sponsor?

xorander00 commented 6 years ago

It's not a huge deal right now as this is for a longer-term project and isn't planned for deployment anytime soon. I'm interested in taking a crack at it myself, but it won't be for at least another couple of months as my schedule is busy.

What does sponsoring entail? If it's something I can manage then I can put it on my agenda for Q1 of next year.

slact commented 6 years ago

Got it. Shoot me an email at leo@nchan.io and I'll give you some more info. You can also check out https://nchan.io/support .