More Related Content
Similar to [Node] Multiprocessing and runs continuously
Similar to [Node] Multiprocessing and runs continuously (20)
More from kumatch kumatch
More from kumatch kumatch (7)
[Node] Multiprocessing and runs continuously
- 3. Agenda
• Multiprocessing
• Continue to run a script
11 11 19
- 5. Cluster
• Includes version 0.5.10
• committed on Oct. 12, 2011
• adds CLI option first.
• Shift to module (Oct. 27, 2011)
• removed CLI option.
• Bump v 0.6.0 (Nov. 4, 2011)
11 11 19
- 6. Worker
process
Network
ports
Worker
process
Master process
11 11 19
- 7. Cluster APIs
• fork()
• isMaster
• isWorker
• “death” event for worker die
11 11 19
- 8. Cluster usage
• cluster.isMaster
• cluster.fork()
• cluster.isWorker
• ex. http.Server()
11 11 19
- 9. Cluster usage
• Cluster worker is Child Process
• using child_process.fork()
• Built-in messaging channel
11 11 19
- 11. forever
• https://github.com/nodejitsu/forever
• Run a script as a daemon
• CLI tool (and module instance)
11 11 19
- 12. $ [sudo] npm install -g
forever
$ forever start app.js
11 11 19
- 14. Node 0.6 + forever 0.7.2
= unstoppable !!!
• start is available
• list, stop and etc. don’t work
11 11 19