[erlang-questions] Retrieving "semi-constant" data from a function versus Mnesia
Wed May 13 09:07:55 CEST 2015
What prevents you using
It is just one more step of indirection. It can be a viable way in the case
when write operations are very rare.
On Mon, May 11, 2015 at 8:02 PM, Jay Nelson <> wrote:
> (Edited previous posts for relevance, including only Joe’s comments
> interspersed with my responses.)
> > If it's small you could define this in a module and not use a database
> > or process at all.
> > -module(global_data).
> > -export(...)
> > data_one() ->
> > ....
> > Then dynamically change and recompile the module. Any call
> > global_data:data_one() will pick up the value from the "latest version"
> > /Joe
> This is exactly the approach I was taking, but I assumed that there would
> various implementations so I used a behaviour to identify the specific
> The data set is quite small as it is normal app configuration data.
> I implemented in the most straightforward obvious way:
> It turns out the Config_Module:fn(…) is the killer of performance. This
> approach is much more performant if you are ever faced with a similar
> (example from some code I was browsing recently):
> > Making a module containing all the config data
> > and recompiling when necessary is certainly the fastest way
> > to access the data -this has very fast reads but very slow writes - you could think of a
> > module as a database optimized for reads but not writes :-)
> So I thought as well, but you *must* call it with a compiled module name or
> eliminate the performance benefit. I mostly wanted to guarantee distributed
> lock-free code access for many concurrent readers to avoid contention, but
> it proved the slowest of the 3 approaches when using a behaviour.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions