3 ms·
The simple answer: supervision trees. And fault-tolerance usually means that the failing process would be restarted. It would not handle stuff like netsplits or
by octacat 3y ago
The simple answer: supervision trees. And fault-tolerance usually means that the failing process would be restarted. It would not handle stuff like netsplits or node going down though.
Check code of cowboy, ejabberd, MongooseIM, RabbitMQ for examples.
There are many factors on decision when to make a new process. Data locality, the pattern of interaction with other processes, performance considerations.
Good idea is to have one process per TCP connection, but not one process per each routed message. And be careful with blocking gen_server calls - these could block or fail.
- roeles 3y agoThanks! Will check those projects out.
- mingusrude 3y agoIt's been a while since I worked actively with Erlang but I remember reading the cowboy-source code was educational.
- plugin-baby 3y ago> Check code of cowboy, ejabberd, MongooseIM, RabbitMQ for examples. + CouchDB?
- cmdrk 3y agoJust to add to this, there are some implementations of things like consensus algorithms in Erlang such as Ra: https://github.com/rabbitmq/ra https://github.com/rabbitmq/ra
- octacat 3y agoRa is pretty cool. Making cluster fault tolerant is an art on its own in Erlang ;) Riak Core is extremely cool, but Riak is dead by now. It was a child of the times when NoSQL was cool. Still, basho code is interesting to read. (https://github.com/basho/riak_core https://github.com/basho/riak_core) Self-ads: we've tried to remove Mnesia from our project, HN post incoming, once the library is prettified and tested hard (https://github.com/esl/cets https://github.com/esl/cets).