[node] multiprocessing and runs continuously

14
Multiprocessing and runs continuously 2011-11-19 kumatch / Yosuke Kumakura 111119日土曜日

Upload: kumatch-kumatch

Post on 15-Jul-2015

2.794 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: [Node] Multiprocessing and runs continuously

Multiprocessing andruns continuously

2011-11-19kumatch / Yosuke Kumakura

11年11月19日土曜日

Page 2: [Node] Multiprocessing and runs continuously

• Yosuke Kumakura

• @kumatch

• Feedtailor inc.

11年11月19日土曜日

Page 3: [Node] Multiprocessing and runs continuously

Agenda

• Multiprocessing

• Continue to run a script

11年11月19日土曜日

Page 4: [Node] Multiprocessing and runs continuously

Today’s modules

• Cluster (for Node 0.6)

• forever

11年11月19日土曜日

Page 5: [Node] Multiprocessing and runs continuously

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日土曜日

Page 6: [Node] Multiprocessing and runs continuously

Master process

Workerprocess

Workerprocess

Networkports

11年11月19日土曜日

Page 7: [Node] Multiprocessing and runs continuously

Cluster APIs

• fork()

• isMaster

• isWorker

• “death” event for worker die

11年11月19日土曜日

Page 8: [Node] Multiprocessing and runs continuously

Cluster usage

• cluster.isMaster

• cluster.fork()

• cluster.isWorker

• ex. http.Server()

11年11月19日土曜日

Page 9: [Node] Multiprocessing and runs continuously

Cluster usage

• Cluster worker is Child Process

• using child_process.fork()

• Built-in messaging channel

11年11月19日土曜日

Page 10: [Node] Multiprocessing and runs continuously

Cluster for Node 0.4

• http://learnboost.github.com/cluster/

11年11月19日土曜日

Page 11: [Node] Multiprocessing and runs continuously

forever

• https://github.com/nodejitsu/forever

• Run a script as a daemon

• CLI tool (and module instance)

11年11月19日土曜日

Page 12: [Node] Multiprocessing and runs continuously

$ [sudo] npm install -g forever

$ forever start app.js

11年11月19日土曜日

Page 13: [Node] Multiprocessing and runs continuously

forever daemon actions

• start

• stop

• restart

• list

• and more...

11年11月19日土曜日

Page 14: [Node] Multiprocessing and runs continuously

Node 0.6 + forever 0.7.2 = unstoppable !!!

• start is available

• list, stop and etc. don’t work

11年11月19日土曜日