English 中文(简体)
Erlang Ets tables between Nodes
原标题:

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.

最佳回答

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.

问题回答

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.





相关问题
How big can Erlang DETS be and what to do if its too small?

All I need is a large persistent lookup table in Erlang and dets seems like just the thing though I need a definative answer to: just how big the total size of the binaries in the table can be. how ...

passing events from erlang to Clojure

I m looking for a way to pass events back and forth between Clojure and erlang. has someone done this before? how should I encode the (immutable) messages in a flaxable general way? Should IPC be ...

How to send a push notification using Erlang?

I m trying to send a push notification to APNs using Erlang. This is the code I came up with so far: -module(apnstest2). -export([connect/0]). connect() -> application:start(ssl), ssl:...

How do I build a DNS Query record in Erlang?

I am building a native Bonjour / Zeroconf library and need to build DNS query records to broadcast off to the other machines. I have tried looking thru the Erlang source code but as I am relatively ...

AccessViolation when calling unmanaged dll

When calling an unmanaged Dll from a c# application I get an AccessViolationException. The strange thing is that the exported function has no arguments, so the problem is not in the Marshalling of ...

How to enable active sockets in a Mochiweb application?

Does anyone know how to enable active instead of passive sockets in a Mochiweb application. Specifically, I am trying to adapt http://www.metabrew.com/article/a-million-user-comet-application-with-...

How to convert numbers to words in Erlang?

I found this interesting question about converting numbers into "words": Code Golf: Number to Words I would really like to see how you would implement this efficiently in Erlang.

热门标签