"Feature: Mnesia hooks" by k32

Quoting k32’s proposal to make Mnesia scale better from the Erlang mailing list (haven’t seen this mentioned here, and I think others would be interested in this topic as well).

k32 k32@REDACTED
Fri Jan 28 17:26:50 CET 2022

Hello, We’ve been experimenting with the ways to make large Mnesia clusters more viable. Our basic idea is to move away from full-mesh topology to a “mesh+star” topology: a small part of the cluster behaves like a regular mnesia cluster (we call it core cluster) connected in a full mesh, but the rest of the nodes are read-only; they passively and asynchronously replicate transactions from the core cluster over custom protocol, and delegate write operations to the core nodes via RPC, hence “star”. So far this approach looks quite promising, we’ve been able to achieve decent throughput in 20+ node clusters, so this may be a possible solution to the mnesia scalability challenge. But we had to patch mnesia a bit: mnesia: Add post-commit hook by k32 · Pull Request #16 · emqx/otp · GitHub (the initial idea to rely on the events alone proved to introduce too much overhead). Ideally, we would like to contribute this patch upstream, so we’re seeking the opinion from the OTP team. Hook API may be of use for other things too. Not sure if this is the right channel, though. – BR

Their blog is also a treasure trove of information on Mnesia internals with lots of diagrams and flow charts.

6 Likes