I was testing different approach to implement actors:
Fork: (child_process.fork) each actor as a new process
Pros: was isolation, if the actor crash just fork it again.
Cons: memory, each process are about 20mb.
Require: (just require every actor when needed) ie:
require('./actors/my_actor')(message, callback)
Pros: memory, required about 8.7 millions and only 150mb used (just dummy
actors but stored in an array so it will not be removed from memory).
Cons: maybe if an fatal error occur the entire app will crash.
Lets say then I'm happy with the "require" approach, but also I think maybe
can be implemented in a mixed way (not tested yet). With maybe will have
those modules:
- Kernel (part of the module): it will have the responsibility to fork a
new process for every supervisor (its also an actor but will act only as
supervisor) and pass the message to the corresponding supervisor
- Supervisor (part of the module): will listen the messages from the kernel
and "require" each actor (when the actor finished just remove it from
memory), surround by try catch the entire actor require and their callback
so the supervisor not crash with the actor.
- Actor (user custom code): this will be the my custom code, process the
message and send back if needed (but always call the callback method).
All of this I made only for learning, because I learn better when coding
than read a lot of stuff, seems boring to me and always got distracted xD
Regards
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.