moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 509 forks source link

Loadbalancing Mosca server using HAProxy #550

Closed uvshah closed 7 years ago

uvshah commented 7 years ago

Hello,

I have successfully implemented Mosca server with RabbitMQ as a backend on single server. Now i am planning to use HAProxy for loadbalancing in two Mosca Server. Please find my below flow diagram mosca_haproxy

I have few questions regarding that 1) Which is the better way

2) What should be HAProxy server hardware configuration? It should be same as Mosca server? (My Mosca server config : 32 GB RAM, 8 Core CPU)

3) What if HAProxy server itself goes down?

Regards, Urmik

cendrizzi commented 7 years ago
  1. This is tough to ask. If you cluster you can potentially have more availability at the expense of more complexity. It's really down to your orgs needs.
  2. Any answer might be a guess. HAProxy scales quite well, but depending on how many messages you are sending over mqtt etc everything changes. The best you can do is load test to see where your bottlenecks are.
  3. A lot of people use pacemaker to cluster haproxy: http://clusterlabs.org/pacemaker.html. There are various tutorials out there on this.
mcollina commented 7 years ago

@cendrizzi thanks for the answer. Great job!