Successfully reported this slideshow.

[Node] Multiprocessing and runs continuously

3,094 views

Published on

  • Be the first to comment

  • Be the first to like this

[Node] Multiprocessing and runs continuously

  1. 1. Multiprocessing and runs continuously 2011-11-19 kumatch / Yosuke Kumakura11 11 19
  2. 2. • Yosuke Kumakura • @kumatch • Feedtailor inc.11 11 19
  3. 3. Agenda • Multiprocessing • Continue to run a script11 11 19
  4. 4. Today’s modules • Cluster (for Node 0.6) • forever11 11 19
  5. 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. 6. Worker process Network ports Worker process Master process11 11 19
  7. 7. Cluster APIs • fork() • isMaster • isWorker • “death” event for worker die11 11 19
  8. 8. Cluster usage • cluster.isMaster • cluster.fork() • cluster.isWorker • ex. http.Server()11 11 19
  9. 9. Cluster usage • Cluster worker is Child Process • using child_process.fork() • Built-in messaging channel11 11 19
  10. 10. Cluster for Node 0.4 • http://learnboost.github.com/cluster/11 11 19
  11. 11. forever • https://github.com/nodejitsu/forever • Run a script as a daemon • CLI tool (and module instance)11 11 19
  12. 12. $ [sudo] npm install -g forever $ forever start app.js11 11 19
  13. 13. forever daemon actions • start • stop • restart • list • and more...11 11 19
  14. 14. Node 0.6 + forever 0.7.2 = unstoppable !!! • start is available • list, stop and etc. don’t work11 11 19

×