Concurrency Orientated Design question

Marcel Meyer marcel.meyer@REDACTED
Mon Feb 7 19:29:23 CET 2011

Hi there,

Let's say I have a hierarchical data resource, like a directory structure. I
have a server that expose typical functions on such a tree, like "get me the
children of this node", and typical traffic constitutes of a lot more reads
than updates.
Given I have cheap processes, can I compose the processing like this?
(Analysis of the kinds of operations I can do on these trees show that
operations complete within microseconds)

Scenario 1:
Spawn a process per tree and route all requests to that process for
The good:
Since this is essentially a synchronous processor, no race conditions.
The bad:
Its synchronous.

Scenario 2:
Spawn an "owner" tree processor, and on all "read-like" operations, spawn a
new process to deal with that request.
The good:
Better scaling
The bad:
Spawning a new process with the existing state might be expensive (ito
memory and time), as these trees could be large (4Mb max, usually < 200kb).
Updating the tree will become hairy, unless updates are only done by the
owner, like when you spawn an ets table as private.

I hope the general idea of the problem is clear: do I spawn new processes
for each request (and then tear it down afterwords)?

Kind regards,

More information about the erlang-questions mailing list