[erlang-questions] Writers Readers problem

Gianfranco Alongi <>
Mon Jan 30 22:21:22 CET 2012


Okay, so here goes some of my immediate thoughts,

First - I would write some wrapper that abstracts away from the
implementation of the storage,
this way you should be able to try out some of your ideas quickly
without being punished too much.

If you need access across multiple nodes, I would go for a simple
mnesia implementation.
If you get too much lock contention - distribute the tokens over a
deterministic key space using hashes or whatever you need.
Mnesia is also nice since you get redundancy and persistency - once
your system comes up again, it's all there
and you can start chugging along.

If this is too slow for you  and you don't need redundancy or
persistency - try it out with ets tables.

/G

On Mon, Jan 30, 2012 at 10:07 PM, Roberto Majadas Lopez
<> wrote:
> 2012/1/30 Gianfranco Alongi <>
>>
>> Some questions that can help us give you an accurate answer
>>
>> 1) How frequent does this happen?
>>    Once a second?
>>    Once a minute?
>>    Once an hour?
>
>
> less than a second
>
>>
>>
>> 2) How large is the token?
>>    1 byte?
>>    1 Kbyte?
>>    1 Mbyte?
>
>
>
> probably 10-20 chars
>
>>
>>
>> 3) Do you need the storage to scale dynamically with more added nodes?
>
>
> could be ok, but i think is not required
>
>>
>>
>> 4) What more do you expect of the storage?
>>    - Automatic signaling on add/delete?
>>    - Triggers?
>
>
> not required
>
> Thanks :)
>
>>
>>   etc
>>
>> Cheers
>> G
>>
>> On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez
>> <> wrote:
>> > Hello everyone:
>> >
>> > I'm writting a erlang app and i've the next scenario:
>> >
>> > The app has n process that writes tokens in "somewhere" and there are m
>> > process that reads one of those tokens and remove it.
>> >
>> > Which is the best way to store this tokens ?
>> >  * global ets
>> >  * a gen_server + ets
>> >  * mnesia
>> >  * ...
>> >
>> > thanks in advance
>> >
>> > Roberto
>> >
>> > _______________________________________________
>> > erlang-questions mailing list
>> > 
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> >
>
>



More information about the erlang-questions mailing list