How can a Phoenix application tailored only to use channels scale on multiple machines? Using HAProxy? How to broadcast messages to all nodes?

前端 未结 3 2027
北荒
北荒 2021-02-09 10:31

I use the node application purely for socket.io channels with Redis PubSub, and at the moment I have it spread across 3 machines, backed by nginx load balancing on one of the ma

3条回答
  •  天命终不由人
    2021-02-09 11:23

    Look at Phoenix.PubSub It's where Phoenix internally has the Channel communication bits.

    It currently has two adapters:

    • Phoenix.PubSub.PG2 - uses Distributed Elixir, directly exchanging notifications between servers. (This requires that you deploy your application in a elixir/erlang distributed cluster way.)
    • Phoenix.PubSub.Redis - uses Redis to exchange data between servers. (This should be similar to solutions found in socket.io and others)

提交回复
热议问题