[erlang-questions] Is a process necessary in front of mnesia?

Evans, Matthew <>
Fri Oct 15 15:33:06 CEST 2010


In our particular case read requests are processed immediately, while write requests are subjected to a token bucket mechanism within the gen_server to avoid overloading mnesia.

Writes can, up to a certain limit, be queued if the token bucket denies the request, otherwise back-pressure is used to hold off the senders. Of course, this approach won't work in all cases but in our deployment it works just fine.

Matt

________________________________________
From: David Mercer []
Sent: Friday, October 15, 2010 9:17 AM
To: Evans, Matthew; 'Woody Peterson'; 'Erlang-Questions Questions'
Subject: RE: [erlang-questions] Is a process necessary in front of mnesia?

On Thursday, October 14, 2010, Evans, Matthew wrote:

> Another thing I use a gen_server intermediately for is to prioritize
> certain operations over others. In one case we are supposed to process
> many writes as a low-priority task that doesn't affect the read rate.
> Having a gen_server in the way lets us do that.

For task prioritization, gen_server does not immediately leap out at me as
the solution, since gen_servers normally process their requests in FIFO
order.  I would think something that utilized selective receive might be
more appropriate.  What is the solution pattern you use to adapt the
gen_server to this purpose?

Thanks,

DBM



More information about the erlang-questions mailing list