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 291 forks source link

Multiple location-specific redis servers #189

Closed boynet closed 8 years ago

boynet commented 8 years ago

Thanks for your great work! just found this plugin. I am kind of afraid of using it because there is no info about how its scale, and how much 1 redis server can handle.. is there a technical problem of giving it array of redis servers?

slact commented 8 years ago

Using multiple Redis servers is not implemented yet. It's not a problem, but it is a challenge, especially with support for clusters. But chances are, unless you've got millions of channels and subscribers, one Redis server on modern hardware can handle it.

lordnynex commented 8 years ago

Hi @slact. I was wondering if you had any more information on this? I really need redis cluster support and I'm beginning to read the code. I'm not sure how much help I can provide but is there any specific challenges I should be on the look out for?

slact commented 8 years ago

@lordnynex : Cluster support and support for different redis servers per nginx location are different, but somewhat related features. Which one are you interested in?

lordnynex commented 8 years ago

@slact I have a need to use redis cluster support. This cluster (hostname(s)/ports) would be consistent across all nginx locations. In effect the lua persistence scripts that are in the adapter, and the redis connection code itself would need to be aware of the cluster. An ideal solution is using pub/sub patterns to effectively use redis cluster as a network bus, and long term storage of events could happen from external processes doing pattern based subscriptions (PSUBSCRIBE).

This allows nchan to scale horizontally almost indefinitely as it becomes a function of adding additional redis cluster nodes and nginx frontend servers. At present, using a single redis host presents a single point of failure that is uncomfortable for large installations.

slact commented 8 years ago

@lordnynex : let's take this discussion over to #197

slact commented 8 years ago

implemented in redis_multiserver, but still testing.

slact commented 8 years ago

merged into master and pretty well-tested at this point.