[erlang-questions] Retrieving "semi-constant" data from a function versus Mnesia
Sun May 10 22:23:11 CEST 2015
How large is the total data?
If it's small you could define this in a module and not use a database
or process at all.
Then dynamically change and recompile the module. Any call
global_data:data_one() will pick up the value from the "latest version"
On Sat, May 9, 2015 at 2:35 PM, Peter Johansson <> wrote:
> 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
> 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
> erlang-questions mailing list
More information about the erlang-questions