[erlang-questions] Problems Writing a Scalable Shared Data Structure

Robert Raschke <>
Mon Jul 7 11:58:44 CEST 2008


Hi Fuad,

On 7/7/08, Fuad Tabba <> wrote:
> Thanks Robert,
>
> Yes I am familiar with Amdahl's law. That said, it's not true that all
> writes need to be serialized; it's a binary tree, and unless the
> modifications happen to be to the same node, there's no reason why they need
> to be serialized.
>
> A database would solve the problem kinda; but that's like using a
> steamroller to crack a nut. What I'm looking for a lightweight option that
> could temporarily store data shared between threads, and would scale well as
> the number of threads accessing/modifying this structure increases. I know
> how to solve this problem in C (writing a concurrent binary search tree that
> scales well), but since I'm new to Erlang I was unsuccessful trying to solve
> this problem in Erlang.

OK, I see.

So, if I read your code correctly, your rpcInserts() and rpcDeletes()
return quick, because your request is trickling down the tree on its
own. Its the rpcContains() that need to wait for a proper result.

It might be interesting to test the individual operations on their
own, and then combinations thereof. That might give a quicker insight
into what is causing the lack of speedup. My (uneducated) hunch is
that the rpcContains() calls are where your "threads" are getting
stuck (due in part to all the inserts and deletes clogging up the
tree).

Very unscientific, sorry.

Robby



More information about the erlang-questions mailing list