[erlang-questions] Passing records vs Mnesia lookups
Mon Apr 27 12:58:56 CEST 2009
I don't need transactions, and all the data is only on one node, but as Ulf
pointed out, wouldn't an ets:lookup also result in a completely new copy of
the long record and hence, as far as CPU cycles spent in data copying is
concerned, will be the same as for message passing ?
On Mon, Apr 27, 2009 at 3:46 PM, mats cronqvist <> wrote:
> Amit Murthy <> writes:
> > Hi,
> > I have an optimization question. Consider the following scenario:
> > - I have, say around 40,000 long running processes. Each represents an
> > 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
> > in an mnesia RAM only table
> > So the question is
> > Is it better to read the record from mnesia once and send the complete
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions