Node js quick-tour_v2

1,182 views

Published on

common JS

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,182
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Node js quick-tour_v2

  1. 1. Server-Side JavaScript Developement Node.JS Quick Tour q3boy <q3boy1@gmail.com> from http://cnodejs.org/
  2. 2. Server-Side JavaScript Development
  3. 3. Aptana Jaxer (SpiderMonkey) Helma (Rhino)
  4. 4. ••
  5. 5. Revelutions in 2009• CommonJS (ServerJS), by Dangoor• JSConf, by Chris Williams & Iterative Designs• Node, by Ray Dahl.
  6. 6. Nodes goal is to provide an easyway to build scalable networkprograms -- nodejs.org
  7. 7. Ray Dahl
  8. 8. • 1/5/2009 Ryah Dahl• 2/15/2009• 5/31/2009• ......• 11/16/2010 v0.3.1
  9. 9. • wiki 600 module• 20•
  10. 10. • libev (event loop)• libeio (nonblocked posix, thread pool)• v8 (javascript engine by google)
  11. 11. •••
  12. 12. ioio
  13. 13. ioio
  14. 14. -•••
  15. 15. -• cpu•
  16. 16. - Web Worker
  17. 17. • AMD Opteron 2200 , 4G RAM• socket client 20,000+ qps• socket server 17,000 qps• http server 4,400 qps• 30~40m• see more. <http://nodejs.kongwu.net/blog/? p=8>
  18. 18. • SSL• Windows• 1G (by v8)
  19. 19. • Web•• Spider
  20. 20. Digg in the node
  21. 21. $ git clone git://github.com/ry/node.git$ cd node$ ./configure --prefix=$HOME/node$ make install
  22. 22. Hello World!Familiar & Simple
  23. 23. $ node singleThread.js1234
  24. 24. CommonJS$ node CommonJS.jsfoobar
  25. 25. io$ node nonblocking.jsReading my.txt ...my.txtHere is contents in "my.txt".
  26. 26. HTTP
  27. 27. TCP $ node tcpServer.js & $ telnet locahost 1234 Welcome! > Node is so Cooool. Node is so Cooool. >
  28. 28. $ node watchFile.js &$ sleep 3; touch my.txtthe current mtime is: 1292594780000the previous mtime was: 1292594752000
  29. 29. $ node childProcess.jshelloworld
  30. 30. String vs Buffer String•• node v8 String , socket memcopy• v8 gc
  31. 31. String vs Buffer With String
  32. 32. String vs Buffer With Buffer
  33. 33. With String
  34. 34. With Buffer
  35. 35. Want to see more?
  36. 36. • PHP: pear• Python: PyPI, setuptools• Ruby: Gems• Node:
  37. 37. $ cat >>~/.npmrc <<NPMRCroot = ~/.node_librariesbinroot = ~/binmanroot = ~/share/manNPMRC$ curl http://npmjs.org/install.sh | sh$ npm ls$ npm install package_name$ npm update
  38. 38. IDE base on node http://www.cloud9ide.com/
  39. 39. Links• http://www.commonjs.org/• http://nodejs.org/• http://howtonode.org/• https://github.com/ry/node/wiki• https://github.com/ry/node/wiki/modules• https://github.com/isaacs/npm
  40. 40. Node in Taobao• UED • nodejs-kissy by <bachi@taobao.com>• EDP • http://cnodejs.org/ ( node , coming soon) • node-reverse-proxy ( , , coming soon) • node-myfox (mysql 2011 Q1) • node-glider ( 2011 Q2) • node-kvproxy (key-value 2011 Q2)

×