[erlang-questions] Passing records vs Mnesia lookups

Amit Murthy <>
Sun Apr 26 18:57:31 CEST 2009


Hi,

I have an optimization question. Consider the following scenario:

- I have, say around 40,000 long running processes. Each represents an
online user and keeps some user related data in the process dictionary.
- I need each of the processes to perform some computation against a long
record that I'll send as a message.
- The long record (around 40 fields, mostly short strings) is also available
in an mnesia RAM only table

So the question is

Is it better to read the record from mnesia once and send the complete
record to each of the 40,000 processes

or

Is it better to just send the key in the message and have each of the
processes do an mnesia lookup

The reason, I ask this is because the Efficiency Guide explicitly states
that

"All data in messages between Erlang processes is copied, with the exception
of refc binaries on the same Erlang node."

Regards,
  Amit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090426/39bac8d3/attachment.html>


More information about the erlang-questions mailing list