[erlang-questions] Effectiveness of "selective receive"

Avinash Dhumane nistrigunya@REDACTED
Fri Jul 31 17:13:25 CEST 2015


I have a need to lookup a tuple based on a 32-bit integer key and remove it
from a set after it is found. The set is shared by 2 processes - one
inserts the tuple and the other performs a lookup followed by a delete.

So, I am considering ETS versus selective receive. Consideration for
selective receive because I need the lookup call to block until the tuple
becomes available in the set.

I suppose selective receive will not be able to lookup in constant time
whereas set-ETS will! But, I favour the selective receive because it makes
the code so simple and intuitive.

So, my question is this - till what point, in terms of number of tuples in
the set, the selective receive will be effective. The insertion in the set
is capped at 400 tuples per second, but the lookup (followed by a delete)
will be considerably slower (by 20 to 70%) than the rate of inserts.

Please advise on considerations that apply in this situation in order to
employ a suitable scheme.

Thanks
Avinash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150731/7af69d5e/attachment.htm>


More information about the erlang-questions mailing list