[erlang-questions] Mnesia vs. timeouts

Igor Ribeiro Sucupira igorrs@REDACTED
Thu Sep 2 21:30:26 CEST 2010


On Thu, Sep 2, 2010 at 5:43 AM, Dan Gudmundsson <dangud@REDACTED> wrote:
> On Thu, Sep 2, 2010 at 7:24 AM, Igor Ribeiro Sucupira <igorrs@REDACTED> wrote:
>> My question is: how can I set a timeout for every Mnesia activity
>> (which may be distributed) and make sure that, after that time, no
>> operation related to that activity will be left hanging on any node?
>> By just killing the process that called mnesia:activity, am I
>> guaranteed to get that result?
>>
>
> Killing the process shall cleanup everything (eventually :-)), if not
> it is a bug.
>
> Most of the activity/transaction is driven from the client process in mnesia so
> it should work well.

Good to know that. Might be useful.

> But if you have long search times in dets on a remote node, a queued
> request will not be
> removed from the inbox of the dets process just because you killed the
> requester.

Well... sooner or later, grown-ups have to deal with the situation of
slow/overloaded servers. :-)
Basically, what has to be done is:
1) Avoid sending more load to a slow server.
2) Don't let a slow server create slowness in the others.

I understand this is difficult to achieve in the general case, so I'm
not expecting Mnesia to give it to me for free. What I'm planning to
do is:
1) For the dirty reads that constitute the majority of the operations
in my system, don't let Mnesia perform remote calls. Instead, make an
RPC to the node that holds the desired fragment and set a timeout. The
database operation will never be interrupted, but at least nobody but
the slow server will be waiting for it.
2) Wrap that RPC on a circuit breaker, keeping track of timeouts and
temporarily avoiding calls to slow servers.

Of course, there are other operations going on (including transactions
writing data), but they only account for about 10 per second for the
whole pool, which is nothing compared to the amount of those dirty
reads.

Can you see anything else that might help?

Thanks.
Igor.

> But you can't know if the data was commit'ed or not.
>
>
> /Dan

-- 
"The secret of joy in work is contained in one word - excellence. To
know how to do something well is to enjoy it." - Pearl S. Buck.


More information about the erlang-questions mailing list