Server-Side JavaScript Developement - Node.JS Quick Tour

19,932 views

Published on

Server-Side JavaScript Developement - Node.JS Quick Tour

Published in: Technology
1 Comment
25 Likes
Statistics
Notes
  • cool
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
19,932
On SlideShare
0
From Embeds
0
Number of Embeds
11,600
Actions
Shares
0
Downloads
342
Comments
1
Likes
25
Embeds 0
No embeds

No notes for slide

Server-Side JavaScript Developement - Node.JS Quick Tour

  1. 1. Server-Side JavaScript Developement Node.JS Quick Tour q3boy <q3boy1@gmail.com>
  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 main.js foobar
  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

×