Proper use of mnesia bag table

Rick Pettit <>
Tue Jun 27 19:49:51 CEST 2006


I have a situation in which a collection of distributed agents need to record
events which are to be processed at a later time. All events for a given
task (distributed across the network) will share an ID with which events can
be stored and later retrieved.

I could have a process (FSM or otherwise) for each distributed task which
collects events for that task from various distributed agents, or I could have
the distributed agents simply store their events in a mnesia bag table keyed on
the task ID.

Is this a good fit for mnesia bag tables? That is, the storing (and subsequent
retrieval) of arbitrary amounts of data for a given key? In practice there
won't likely be more than 20 records (~1k each, usually less) for a given key.

It would be easier to have such data rendezvous in a mnesia bag table than to
have an FSM process for each task and a lookup service allowing distributed
agents to "discover" the right FSM process to hand their events to.

Any pointers would be greatly appreciated.

-Rick



More information about the erlang-questions mailing list