How to efficiently pass messages between nodes in raft implementation

Hello. I’ve been trying to implement raft in golang. I am using channels and rpc for passing messages between the nodes( which are just goroutines in my implementation). But this is getting out of hand very fast. Can someone suggest a better way of passing messages around. Are messaging libraries like zeromq helpful here? Is context package useful here?
PS: this is my first-time implementing something that requires messaging to such an extent. So I don’t know if what I am doing is even right. Any suggestions appreciated.

What is raft? What exactly are you trying to do?

OK. So this algorithm solves the consensus problem:

Consensus is a fundamental problem in fault-tolerant distributed systems.

Note that I’ve highlighted ‘distributed systems’. A single Go process using Goroutines and channels is not a distributed system. You will at least have to start multiple processes. And then you can’t use tools like channles to communicate between nodes since such tools don’t cross the process boundary.

You will have to do networking of some kind. Yes, ZeroMQ could be uses, you could also use a message broker or low level TCP/IP.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.