[erlang-questions] Mnesia reads with multiple table copies

Gleb Peregud <>
Wed Nov 11 15:24:56 CET 2009


Here's my answer to the complementing question on StackOverflow:

http://stackoverflow.com/questions/722665/in-a-mnesia-cluster-which-node-is-queried/726318#726318

On Wed, Nov 11, 2009 at 11:48, Ulf Wiger
<> wrote:
> Garrett Smith wrote:
>>
>> WIth Mnesia's location transparency, what is the scheme used to select
>> a source for reads when there are multiple table copies? The factors
>> that I imagine would be considered are:
>>
>> * local vs remote
>> * ram vs disk
>> * running vs stopped nodes
>
> Yes, this is how it works.
>
> At table load time, mnesia stores a where_to_read value
> for each table in the mnesia_gvar table (an internal ets table).
> This value is updated dynamically as conditions change. Local
> reads are definitely favoured over remote, and RAM copies are
> favoured over disc_only. The preference logic is in mnesia_lib.erl
>
> BR,
> Ulf W
> --
> Ulf Wiger
> CTO, Erlang Training & Consulting Ltd
> http://www.erlang-consulting.com
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list