[erlang-questions] Retrieving "semi-constant" data from a function versus Mnesia

Peter Johansson flexchap@REDACTED
Sat May 9 14:35:38 CEST 2015

Hi to all fellow Erlang-users out there !

I'm working with a web-application prototype, powered by Erlang, at the
current time .....
and is for the moment preoccupied with the choose of a suitable
implementation regarding in-memory storage of shared/"top-level"
configuration-data terms.

This configuration-data terms holds ejson-structures ( typically 5KB - 15KB
in size ) and will be consulted by the majority of the request-related
processes based on cookie-association & parameters.

Since this configuration-data relatively rarely will undergo updates but
still be read by almost every request-process I consider it's in-memory
implementation as highly significant for the process-efficiency over time &
shifting payload-situations.

In the case of Mnesia the configuration-terms have to be retrieved by the
means of transactions of table-records into the different process-heaps,
that means in-memory copy-operations which obviously will cause some
overhead in the environment during the occurrence of peak-like situations.

The other case (the function case) is to template the updated
ejson-structures (as the sole "return"-structures) into dedicated
each definition hold in it's own module, and then recompile & reload those
modules programmatically via special update-functions. The up to date
configuration-data can then be retrieved by common processes as simple
function-calls returning fixed data.

I assume/expect these sole ejson/"return"-structures to be stored into the
constant-pools of the modules when these becomes loaded in memory.
In such case the call to any such function into a variable-bound should
result in the creation of a memory-reference for that variable pointing to
the fixed structure in the module's constant-pool.

Retrieving the configuration-data in this later manner must be
significantly more efficient compare to the case of transactions from
Mnesia if considering
both the sizes of the data-structures & the frequency under which they will
be consulted/read.

Is this assumption of mine correct/true or have I missed/overlooked
something in my assessment of the situation ?

Sending my best regards to you erlangers reading this !  / Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150509/6c2407b4/attachment.htm>

More information about the erlang-questions mailing list