[erlang-questions] Workflow process model
Thu Oct 31 00:03:04 CET 2013
I am very grateful to the individuals that responded to my post. There were several good ideas and some pointers to things I need to become more familiar with. Originally in my career, many years ago now, I programmed in Lisp. Coming back to a functional programming language after spending so long in the Tower of Babel that is OO is very refreshing. Cheers and thanks.
On Oct 30, 2013, at 2:27 AM, Motiejus Jakštys <desired.mta@REDACTED> wrote:
> 2013.10.29 20:02, Charles Irvine rašė:
>> I’ve considered making each such workflow instance a process but I
>> hesitate to do this since a process may have a relatively long
>> lifetime and there might be a long duration between significant
>> events. For example, a defect might not get fixed for weeks or months
>> and a long time could elapse between the time the defect is reported
>> and the time that someone starts working on it.
>> A little nudge or two from folks more skilled than me at this would
>> be much appreciated.
> I (together with a few people in this mailing list) created a tool to manage number portability database (when you migrate your phone number from one operator to another, some entity has to mediate it) on national scale. A single process is responsible for a single transaction, which includes a range of numbers. Transactions can last from 1 day to years. A process is a state machine which just sends messages to operators according to some rules.
> One transaction is an erlang process, which, if does not receive a message for 60 minutes, hibernates. When you hibernate, you do not worry about the number of processes. We also had distribution, so there was no practical ceiling.
> For recovery and audit purposes you can log every incoming/outgoing message. That will let you reply all transactions and return to the state before crash (we did it wrong way, but later realized that this should have been done instead).
> So in short, stick to the process model and, if you are worried about number of them, hibernate. I just tried running 1M hibernated processes on a 64bit laptop. Takes 866M residential memory. Of course, yours will take more depending on size of your state. But still it's cheap.
More information about the erlang-questions