centrifugal / centrifuge

Real-time messaging library for Go. The simplest way to add feature-rich and scalable WebSocket support to your application. The core of Centrifugo server.

Home Page:https://pkg.go.dev/github.com/centrifugal/centrifuge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecate and then remove Engine Channels method

FZambia opened this issue · comments

Channels method of Engine (Broker part) returns a slice of all channels active throughout all Centrifugo nodes. This data is eventually consistent in case of Redis, not supported in Redis cluster case, not supported by most other PUB/SUB brokers, does not scale well for millions of channels thus can lead to error prone architectural decisions in applications that use Centrifuge or Centrifugo. I am considering to remove it in Centrifuge library Engine interface and in Centrifugo v3.

Maybe this sort of data should be extracted not via broker but over Centrifuge node cluster survey. But even in this case it won't scale well for business scenarios (should only be used as instrument of observability).

Done. New example added to show how to find channels on all nodes over node.Survey method. Getting channels over Survey does not scale well with adding more nodes and many channels in system - but it's mostly the same situation as with Channels over the broker. Personally I see the proper solution for investigating global Channels state over integration with real-time analitycs (ClickHouse for example).