node.js 자바스크립트로 서버사이드 개발하기
DESCRIPTION
2011. 7.2 KSUG 번개 세미나에서 발표한 발표자료TRANSCRIPT
자바스크립트로����������� ������������������
서버사이드����������� ������������������ 개발하기
2011.07.02Outsider����������� ������������������ at����������� ������������������ KSUG
:
짧은����������� ������������������ 역사
2009년����������� ������������������ 2월����������� ������������������ 9일
“V8을����������� ������������������ 이용한����������� ������������������ 프로젝트에����������� ������������������ 대한����������� ������������������ 아이디어가����������� ������������������ 있어”����������� ������������������ by����������� ������������������ ryan
Ryan Dahl
2009년����������� ������������������ 11월����������� ������������������ 8일
JSConf.eu����������� ������������������ 2009
node.js����������� ������������������ 발표버전����������� ������������������ 0.1.16
인기를����������� ������������������ 얻다
Popular����������� ������������������ watched3위
watched
7632
1830http://nithub.duostack.net/
모듈
npm����������� ������������������ 기준
메인����������� ������������������ 스폰서����������� ������������������ 되다����������� ������������������
현재����������� ������������������ 버전����������� ������������������
v0.4.9
윈도우����������� ������������������ 지원����������� ������������������ 예정
는����������� ������������������ 무엇인가?
Server-sideJavaScript
Live����������� ������������������ wire
GWTLive����������� ������������������ wir
e
Rhino
GWTLive����������� ������������������ wir
e
Rhino
GWT
<script����������� ������������������ runat=”server”>
Live����������� ������������������ wire
이번엔����������� ������������������ 진짜서버사이드자바스크립트
컨셉
“동시성을����������� ������������������ 해결하는����������� ������������������ 가장����������� ������������������ 좋은����������� ������������������ 방법이����������� ������������������ 뭔지����������� ������������������ 알아요?동시성을����������� ������������������ 사용하지����������� ������������������ 않는거에요”
맹수
“We’re����������� ������������������ doing����������� ������������������ it����������� ������������������ wrong”-����������� ������������������ Ryan����������� ������������������ Dahl
싱글쓰레드
쓰레드는����������� ������������������ 싸지����������� ������������������ 않다
멀티태스킹하지만����������� ������������������ 한번에����������� ������������������ 하나씩만!!!
이벤트기반
작업을����������� ������������������ 요청하고����������� ������������������
완료되면����������� ������������������ 돌려받는다
0
3,000
6,000
9,000
12,000
0 500 1000 1500 2000 2500 3000 3500 4000
nginx
apache
http://blog.webfaction.com/a-little-holiday-present
동시접속수에����������� ������������������ 따른����������� ������������������ 초당����������� ������������������ 리퀘스트����������� ������������������ 처리수
동시접속수
초당����������� ������������������ 리퀘스트
0
10
20
30
40
0 500 1000 1500 2000 2500 3000 3500 4000
nginx
apache
http://blog.webfaction.com/a-little-holiday-present
동시접속수에����������� ������������������ 따른����������� ������������������ 메모리����������� ������������������ 사용량
동시접속수
MB
non-blocking����������� ������������������ I/O
var����������� ������������������ result����������� ������������������ =����������� ������������������ db.query('select����������� ������������������ *����������� ������������������ from����������� ������������������ A')//����������� ������������������ use����������� ������������������ result
var����������� ������������������ result����������� ������������������ =����������� ������������������ db.query('select����������� ������������������ *����������� ������������������ from����������� ������������������ A')//����������� ������������������ use����������� ������������������ result
블락킹
L1
L2
RAM
DISK
Internet
I/O����������� ������������������ latency
80,000,000ns
13,700,000ns
83ns
4.7ns
1ns
http://duartes.org/gustavo/blog/post/what-your-computer-does-while-you-wait
db.query('select����������� ������������������ *����������� ������������������ from����������� ������������������ A',����������� ������������������ ����������� ������������������ ����������� ������������������ function(result)����������� ������������������ {����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ use����������� ������������������ result});
비동기����������� ������������������ I/O
유니버셜����������� ������������������ 랭귀지
자바스크립트
V8
CommonJS
require(‘모듈명’)
//����������� ������������������ app.jsvar����������� ������������������ app����������� ������������������ =����������� ������������������ module.exports����������� ������������������ =����������� ������������������ {};
//����������� ������������������ another.jsvar����������� ������������������ another����������� ������������������ =����������� ������������������ require(‘./app’)
Events
Events HTTP
Events HTTPHTTPS
Events HTTP
File����������� ������������������ SystemHTTPS
Events HTTP
File����������� ������������������ System
Net
HTTPS
Events HTTP
File����������� ������������������ System
Net
HTTPS
URL
Events HTTP
File����������� ������������������ System
Net
HTTPS
DNSURL
Events HTTP
File����������� ������������������ System
Net
HTTPS
DNSURLChild����������� ������������������ Process
node.js는����������� ������������������
V8위에서����������� ������������������ 돌아가는����������� ������������������
자바스크립트����������� ������������������ 런타임
직접����������� ������������������ 보자!!!
로����������� ������������������ 무엇을����������� ������������������ 할����������� ������������������ 수����������� ������������������ 있는가?
email����������� ������������������ :����������� ������������������ [email protected]
Twitter����������� ������������������ :����������� ������������������ @outsideris
Blog����������� ������������������ :����������� ������������������ http://blog.outsider.ne.kr
Question???
http://www.flickr.com/photos/franksvalli/5163229095/
http://www.flickr.com/photos/jasonbain/5871759941/
http://www.flickr.com/photos/australianshepherds/5715698150/
http://www.flickr.com/photos/soldiersmediacenter/2759042525/
http://www.flickr.com/photos/dslrninja/446737429/
http://www.flickr.com/photos/ncc_badiey/4932200417/
http://www.flickr.com/photos/laughingsquid/390803227/
http://www.flickr.com/photos/nirazilla/3484465952/
이미지����������� ������������������ 출처