[erlang-questions] Passing records vs Mnesia lookups

mats cronqvist masse@REDACTED
Mon Apr 27 12:16:03 CEST 2009


Amit Murthy <amit.murthy@REDACTED> writes:

> 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

  if you don't need transaction semantics, AND you really need the CPU
  cycles, doing an ets:lookup in the mnesia RAM only table is a good
  option.

  mats



More information about the erlang-questions mailing list