views:

233

answers:

2

I've got an ejabberd server with a good amount of custom modules running. I have several mnesia tables and I know these can be easily copied between nodes without any change to the code at all. I was wondering if there's a similar way with ets tables?

Ideally it'd be nice to be able to have several machines running with exactly the same mnesia and ets data, without having to convert my ets tables into mnesia tables. (And thus rewriting a good amount of code.)

One though I had was doing an rpc:call on the ets tables for each node, but I was unsure about the impact this would have on performance.

If anyone has any answers please let me know. Thanks in advance!

+7  A: 

No, ets table contents can not be replicated for you.

Replication (and transaction safety) is the feature that the mnesia database application introduce, its implementation uses ets for ram_only tables.

Christian
Agreed, this is exactly what mnesia is for and a big reason to use mnesia instead of ets.
psyeugenic
+3  A: 

You could rpc:call on the ets tables on the distant node.

But the whole point of mnesia is fixing the kind of problem you're running into : replication

Converting your code to mnesia is a good investment for the future. And while risky, you could always use mnesia:ets() for minimizing code change.

cstar