[erlang-questions] Passing records vs Mnesia lookups
Amit Murthy
amit.murthy@REDACTED
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 <masse@REDACTED> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090427/f98916de/attachment.htm>
More information about the erlang-questions
mailing list