Your SlideShare is downloading. ×
What is nodejs
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

What is nodejs

17,884
views

Published on

봄싹 스웨거에서 발표한 node.js 발표자료

봄싹 스웨거에서 발표한 node.js 발표자료

Published in: Technology

2 Comments
19 Likes
Statistics
Notes
No Downloads
Views
Total Views
17,884
On Slideshare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
220
Comments
2
Likes
19
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. W ha tis SpringSproutSwagger 2011.01.29 Outsider
  • 2. node.jsisServer-sideJavaScript
  • 3. “노드가아직은서버사이드자바스크립트의개념을취한많은것들중하나로보이지만 ” 그것들보다훨씬흥미롭다. SimonWillison http://simonwillison.net/2009/Nov/23/node/
  • 4. Motivation
  • 5. I/O는다르게수행되어야한다.
  • 6. varresult=db.query(select*fromA)//useresult
  • 7. varresult=db.query(select*fromA)//useresult 왜기다려야하는가?
  • 8. I/Olatency L1 1ns L2 4.7ns RAM 83ns DISK 13,700,000nsInternet 80,000,000ns http://duartes.org/gustavo/blog/post/what-your-computer-does-while-you-wait
  • 9. 싱글쓰레드를이용한EventLoop가 더낫다
  • 10. db.query(select*fromA,function(result){//useresult});
  • 11. 동시접속수에따른초당리퀘스트처리수초당리퀘스트12,000 nginx 9,000 6,000 apache 3,000 0 0 500 1000 1500 2000 2500 3000 3500 4000 동시접속수 http://blog.webfaction.com/a-little-holiday-present
  • 12. 동시접속수에따른메모리사용량MB 40 apache 30 20 10 nginx 0 0 500 1000 1500 2000 2500 3000 3500 4000 동시접속수 http://blog.webfaction.com/a-little-holiday-present
  • 13. 왜모두EventLoop를 사용하지않는가?
  • 14. 문화적인이유
  • 15. 우리가I/O를그렇게배웠다
  • 16. puts(이름을입력하세요:);varneme=gets();puts(이름:+name);
  • 17. puts(이름을입력하세요:);gets(function(name){puts(이름:+name);}); 어렵다어려워
  • 18. 인프라적인이유
  • 19. SingleThreadEventLoop는non-blockingI/O가필요하다.
  • 20. 대부분의라이브러리가non-blockingI/O를지원하지않았다
  • 21. 현재는많은인프라가 갖추어져있다. 예:Twisted,eventmachine
  • 22. 블락킹I/O와넌블락킹I/O를 섞어서사용하는것이 어렵다
  • 23. EventLoop와non-blockingI/O에대한 전문지식이필요하다
  • 24. JavaScript
  • 25. 유니버셜랭귀지
  • 26. EventLoop를 사용하도록디자인되었다
  • 27. 성능을위한경쟁이붙었다
  • 28. 이제다시....
  • 29. RyanDahl09.02.09V8에기반한프로젝트아이디어에대한글을올림09.02.15Github에프로젝트시작09.11.08JSConf.eu2009발표(v0.1.16)11.01현재-v0.2.6,0.3.7
  • 30. CommonJS기반
  • 31. JavaScript는더이상브라우저를위한것이아니다. CommonJS기반
  • 32. KevinDangoor가만든 웹브라우저이외의환경에서JavaScript를사용하기위한스펙 Modules,System,Filesystem,UnitTesting CommonJS기반
  • 33. node.js CouchDB RingoJSSproutCore CommonJS기반
  • 34. 에서  동작V 8위
  • 35. C/C++애드온
  • 36. 직접짠코드외에는 모두비동기
  • 37. 모두non-blockingI/O
  • 38. 단하나의쓰레드 단하나의스택
  • 39. index.html페이지요청 nodeexecution stack ev_loop()
  • 40. index.html페이지요청 socket_readable(1) nodeexecution stack ev_loop()
  • 41. index.html페이지요청 http_parse(1) socket_readable(1) nodeexecution stack ev_loop()
  • 42. index.html페이지요청 load(“index.html”) http_parse(1) socket_readable(1) nodeexecution stack ev_loop()
  • 43. index.html페이지요청 http_parse(1) socket_readable(1) nodeexecution stack ev_loop()
  • 44. index.html페이지요청 socket_readable(1) nodeexecution stack ev_loop()
  • 45. index.html페이지요청 nodeexecution stack ev_loop()
  • 46. 메모리에대한두번째요청 nodeexecution stack ev_loop()
  • 47. 메모리에대한두번째요청 socket_readable(2) nodeexecution stack ev_loop()
  • 48. 메모리에대한두번째요청 http_parse(2) socket_readable(2) nodeexecution stack ev_loop()
  • 49. 메모리에대한두번째요청 http_respond(2) http_parse(2) socket_readable(2) nodeexecution stack ev_loop()
  • 50. 메모리에대한두번째요청 http_parse(2) socket_readable(2) nodeexecution stack ev_loop()
  • 51. 메모리에대한두번째요청 socket_readable(2) nodeexecution stack ev_loop()
  • 52. 메모리에대한두번째요청 nodeexecution stack ev_loop()
  • 53. index.html요청에대한응답 nodeexecution stack ev_loop()
  • 54. index.html요청에대한응답 file_loaded() nodeexecution stack ev_loop()
  • 55. index.html요청에대한응답 http_respond(1) file_loaded() nodeexecution stack ev_loop()
  • 56. index.html요청에대한응답 file_loaded() nodeexecution stack ev_loop()
  • 57. index.html요청에대한응답 nodeexecution stack ev_loop()
  • 58. 은가 ? 엇이 좋무
  • 59. 이좋 고 빠르다성능
  • 60. RealtimeApp에좋다
  • 61. 100동시접속에1MB응답node822req/secnginx708req/secthin85req/secmongrel4req/sec (클수록좋다) http://chetansurpur.com/blog/2010/10/why-node-js-is-totally-awesome.html
  • 62. 다른기술과함께쓸수있다
  • 63. 가쉽 다 작 하 기시
  • 64. “ node.js는내가똑똑한것처럼 ”느끼게만들어준다 TobieLagel http://twitter.com/#!/tobie/status/8975802142031872
  • 65. 단점은?
  • 66. 아직어리다
  • 67. 멀티CPU/데이터센터간의 확장성문제
  • 68. 간단한예제들 fromryan node.jsv0.2.6
  • 69. //helloworld.jsvarsys=require(sys)setTimeout(function(){sys.puts(world);},2000);sys.puts(hello);
  • 70. //forever_helloworld.jsvarputs=require(sys).puts;setInterval(function(){puts(hello);},500);process.on(SIGINT,function(){puts(good-bye);process.exit(0);});
  • 71. //tcp.jsvartcp=require(net);varserver=tcp.createServer();server.on(connection,function(e){e.write(hello!n);e.end();});server.listen(8000);
  • 72. //fileio.jsvarstat=require(fs).stat,puts=require(sys).puts;stat(/etc/passwd,function(err,data){if(err)throwerr;puts(modified:+data.mtime);});
  • 73. //streamhttp.jsvarhttp=require(http);http.createServer(function(req,res){res.writeHead(200,{Content-Type:text/html});res.write(Hellon);setTimeout(function(){res.write(world!n);res.end();},2000);}).listen(8000);
  • 74. //watchfile.jsvarfs=require(fs),puts=require(sys).puts;fs.watchFile(./test.txt,function(){puts(파일을바꾸셨군요.);process.exit(0);});
  • 75. node.js는서비스할 준비가되었는가?
  • 76. “node.js는무시하기에는너무쿨하다 DustinMcQuay ”http://www.synchrosinteractive.com/blog/9-nodejs/22-nodejs-has-a-bright-future
  • 77. Questions...?Blog:http://blog.outsider.ne.krTwitter:@outsider__email:outsideris@gmail.com
  • 78. 사진출처(underCCL) http://www.flickr.com/photos/41534655@N00/220318384/ http://www.flickr.com/photos/blank22763/4089949526/ http://www.flickr.com/photos/arthurjohnpicton/4383221264/ http://www.flickr.com/photos/75898532@N00/3110092806/ http://www.flickr.com/photos/f-l-e-x/3092386087/ http://www.flickr.com/photos/chefranden/4596604619/ http://www.flickr.com/photos/tjook/5111553020/ http://www.flickr.com/photos/franksvalli/5163205409/ http://www.flickr.com/photos/rawryder/5086090931/ http://www.flickr.com/photos/elvinj/4487097018/ http://www.flickr.com/photos/ramdac/373881476/ http://www.flickr.com/photos/gregw/3592153959/