Concurrency Orientated Design question
Mon Feb 7 19:29:23 CET 2011
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
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)
Spawn a process per tree and route all requests to that process for
Since this is essentially a synchronous processor, no race conditions.
Spawn an "owner" tree processor, and on all "read-like" operations, spawn a
new process to deal with that request.
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)?
More information about the erlang-questions