<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Each actor is isolated and independent. This is why using sqlite is completely scalable. I thought it would be quite clear that it fits your ideas well. So let me expand more on your questions.</div><div><br></div><div><br></div><div><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite"><font class="Apple-style-span" color="#000000"><br></font></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">1. So far, I haven't seen anything that actually looks like an "actor-oriented database."  Document databases implemented in Erlang, yes (e.g., CouchDB), but every example I find ultimately pushes persistent data into files or a more conventional database of some sort.  Can anybody point to an example of something that looks more like "storing actors in a database?"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- It strikes me that the core issues with doing so have to do with maintaining "aliveness" - i.e., dealing with addressability, routing messages to a stored actor, waking up after a timeout (i.e., the equivalent of triggers)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></div></blockquote><div><br></div><div>Storing the actor state in an sql database gives you the most flexible data model. All the issues you listed are something actordb deals with.</div><br><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">2. One obvious (if simplistic) thought: Does one really need to think in terms of a "database" at all - or might this problem be approached simply by creating each document as an Erlang process, and keeping it around forever?  Most of what I've seen built in Erlang focuses on relatively short-lived actors - I'd be really interested in comments on:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- limitations/issues in persisting 100s of 1000s, or maybe millions of actors, for extended periods of time (years, or decades)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- are there any tools/models for migrating (swapping?) inactive processes dynamically to/from disk storage<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></div></blockquote><div><br></div><div>ActorDB will keep an actor open while it is doing something. Once it stops doing stuff it is closed and remains untouched on disk until it is used again.</div><br><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">3. What about backup for the state of a process?  'Let it crash' is great for servers supporting a reliable protocol, not so great for an actor that has  internal state that has to be preserved (like a simulated tank, or a "smart document"). Pushing into a database is obvious, but...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- are there any good models for saving/restoring state within a tree of supervised processes?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- what about models for synchronizing state across replicated copies of processes running on different nodes?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- what about backup/restore of entire Erlang VMs (including anything that might be swapped out onto disk)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></div></blockquote><div><br></div><div>ActorDB will replicate state to multiple servers.</div><br><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">4. For communications between/among actors:  Erlang is obviously excellent for writing pub-sub engines (RabbitMQ and ejabberd come to mind), but what about pub-sub or multicast/broadcast models or messaging between Erlang processes?  Are there any good libraries for defining/managing process groups, and doing multicast or broadcast messaging to/among a group of processes.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></div></blockquote><div><br></div><div>This is where a separation of code and data comes in. A use case that ActorDB could easily be expanded to do (without a lot of work). ActorDB handles the storage and persistence of state. The application programer implements his program logic in his own code.</div><div><br></div><div>ActorDB could provide "triggers". For instance you have an actor (some gen_server) running on a node:</div><div>- When it wants to store the result of some work, it stores it in his actor in ActorDB. </div><div>- If it wants to send a message to one or many actors, he would create a write transaction to multiple actors. The transaction would do an insert to their "events" table. ActorDB would then callback your own code for every one of those actors and tell them there is work for them to do. This way no event is ever lost.</div><div>- If you just want to send non-persistent messages to erlang processes you can use pg or pg2 modules and sidestep ActorDB. Or maybe it makes sense to support sending non-persistent messages through ActorDB and rely on it to route those messages to the right processes on the right nodes.</div><div><br></div><div>Callbacks could be directly within erlang or externally connected with http or zeromq. So your app logic can be implemented in anything.</div><div><br></div><div><br></div><div>Sergej</div></div><br></body></html>