2

I was developing a chat system for a company, and played around a lot of tools available to do so. One of my most interesting journey was through Pheonix framework (Elixer Language! phew)

I ended up using an MQTT based server to manage chat. I had used MQTT for a few device based communications I did for IoT projects. Used an EMQ server for my broker and this js library for both FE and BE. Setting it up was a cakewalk.

Now I had a few questions when I was adding few more features. How should I scale my channels/messages ratio. How many subscriptions are too many subscriptions ?

I would have access to the usage so would have data to base these on. Any text on these would be appreciated.

Adding few facts about the application. The chat is used in an application which kindof conducts meetings. Here are some rough figures for the same.

Average size of a meeting = 25 people (Can go upto 10,000)
Average number of meetings a day = 50 (currently)
Messages per minute in a meeting = 20
karx
  • 557
  • 2
  • 6
  • 16
  • 1
    This question is unanswerable without detailed understanding of your application and even then it is likely to be an opinion rather than a hard and fast rule – hardillb Aug 28 '18 at 12:02
  • @hardillb Let me know of what kind of domain specific details should I add here. – karx Aug 28 '18 at 19:50
  • I'm saying it's not possible to answer this question within the Stack Overflow rules – hardillb Aug 28 '18 at 19:51
  • @hardillb Any resources you could recommend please. I posted this question so that I can form an opinion of my own, a well informed one. That input from you would help – karx Aug 28 '18 at 19:56

1 Answers1

1

How many subscriptions are too many subscriptions?

It depends on the infrastructure and resources you have available to build a cluster.

This is the link to the official documentation on how to build an EMQ cluster.

The cluster architecture of emqttd broker is based on distributed Erlang/OTP and Mnesia database.

The cluster design could be summarized by the following two rules:

  1. When a MQTT client SUBSCRIBE a Topic on a node, the node will tell all the other nodes in the cluster: I subscribed a Topic.
  2. When a MQTT Client PUBLISH a message to a node, the node will lookup the Topic table and forward the message to nodes that subscribed the Topic. Finally there will be a global route table(Topic -> Node) that replicated to all nodes in the cluster:

    topic1 -> node1, node2

    topic2 -> node3

    topic3 -> node2, node4

---------         ---------
| Node1 | --------| Node2 |
---------         ---------
    |     \     /    |
    |       \ /      |
    |       / \      |
    |     /     \    |
---------         ---------
| Node3 | --------| Node4 |
---------         ---------
Fabio Manzano
  • 2,847
  • 1
  • 11
  • 23