[node] multiprocessing and runs continuously
TRANSCRIPT
Multiprocessing andruns continuously
2011-11-19kumatch / Yosuke Kumakura
11年11月19日土曜日
• Yosuke Kumakura
• @kumatch
• Feedtailor inc.
11年11月19日土曜日
Agenda
• Multiprocessing
• Continue to run a script
11年11月19日土曜日
Today’s modules
• Cluster (for Node 0.6)
• forever
11年11月19日土曜日
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日土曜日
Master process
Workerprocess
Workerprocess
Networkports
11年11月19日土曜日
Cluster APIs
• fork()
• isMaster
• isWorker
• “death” event for worker die
11年11月19日土曜日
Cluster usage
• cluster.isMaster
• cluster.fork()
• cluster.isWorker
• ex. http.Server()
11年11月19日土曜日
Cluster usage
• Cluster worker is Child Process
• using child_process.fork()
• Built-in messaging channel
11年11月19日土曜日
Cluster for Node 0.4
• http://learnboost.github.com/cluster/
11年11月19日土曜日
forever
• https://github.com/nodejitsu/forever
• Run a script as a daemon
• CLI tool (and module instance)
11年11月19日土曜日
$ [sudo] npm install -g forever
$ forever start app.js
11年11月19日土曜日
forever daemon actions
• start
• stop
• restart
• list
• and more...
11年11月19日土曜日
Node 0.6 + forever 0.7.2 = unstoppable !!!
• start is available
• list, stop and etc. don’t work
11年11月19日土曜日