vert.x 소개 및 개발 실습

2,279 views

Published on

동영상 - https://vimeo.com/88997603
소스 - https://github.com/JohnKim/url-shortener

1 Comment
9 Likes
Statistics
Notes
  • 동영상을 함께 보셔야 할거에요.. 발표 장표에는 별 내용이 없어서요... ^^;
    Happy hack & nerd life !!!!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,279
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
48
Comments
1
Likes
9
Embeds 0
No embeds

No notes for slide

vert.x 소개 및 개발 실습

  1. 1. vert.x로개발하기 -김요한 yohany@gmail.com ! 2013.03.11 ServerSideArchitectGroup
  2. 2. vert.x특징은? 하지만, 직접만들어봐야알지! ! 오늘중요한건, 개.발.해.보.기
  3. 3. justintimeprogramming ! 1. 지원되는module로staticwebserver실해하기 2. mongodb를활용한모듈개발하고모듈단위테스트하기 3. API서버모듈개발하고EventBus사용하기 4. script로모듈디플로이해서실행하기 5. auto-deploy로쉽게테스트하기 6. cluster설정하여구성하기
  4. 4. Asynchronous Modularity Polyglot vert.x 의 특징 중 3가지만,
  5. 5. 非同期(non-blocking) 8 threadsocket JavaVM threadsocket threadsocket threadsocket Traditional AP Server Vert.x threadsocket JavaVM socket socket socket socket:thread = 1:1 socket:thread = N:1 EventDispatcher Asynchronous
  6. 6. 高効率(Efficiency) 9 socket Vert.x Runtime(JVM) socket socket socket CPU Core CPU Core CPU Core CPU Core Event Loop (thread) Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle EventDispatcher Verticle Instances Asynchronous
  7. 7. スケーラブル 10 socket Vert.x Runtime(JVM) socket socket socket Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle EventDispatcher socket Vert.x Runtime(JVM) socket socket socket Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle EventDispatcher socket Vert.x Runtime(JVM) socket socket socket Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle EventDispatcher socket Vert.x Runtime(JVM) socket socket socket Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle Verticle EventDispatcher EventBus (BasedonHazelcast) Node#1 Node#2 Node#3 (*)デフォルトではイベントはnon-persistent Asynchronous http://www.slideshare.net/nobusue/gws-20131018-vertxhandson
  8. 8. Modularity
  9. 9. Modularity ClassLoader Main.class! library1.jar! library2.jar! library3.jar
  10. 10. Modularity ClassLoader ClassLoader ClassLoader Module1.class! library1.jar! library2.jar Module2.class! library1.jar! library2.jar Module2.class! library1.jar! library2.jar Module 1 Module 2 Module 3 EventBus (vert.x)
  11. 11. Polyglot “ Components + Scripts = Applications ” see John Ousterhout, IEEE Computer, March ’98 http://www.stanford.edu/~ouster/cgi-bin/papers/scripting.pdf Java, Javascript, CoffeeScript, Ruby, Python or Groovy...
  12. 12. http://vertx.io/
  13. 13. http://www.techempower.com/benchmarks/
  14. 14. URL Shortener 만들기 긴 URL 에 대한 Key
  15. 15. Server Verticle Persister Worker
 Verticle vert.x instance EventBus Starter Verticle
  16. 16. Server Verticle Persister Worker
 Verticle vert.x instance EventBus Starter Verticle Deploy script (javascript)" - 필요한 Module 을 Deploy 해주는 역할" - 서버 프로그램 로직은 없고, 설정값 셋팅과 모듈 실행을 명령하는 script
  17. 17. Server Verticle Persister Worker
 Verticle vert.x instance EventBus Starter Verticle HTTP API Server" - /url/ [LONG URL] : 긴 URL 을 받아서 Persister Worker 가 생성한 KEY 를 반환" - / [KEY] : KEY 를 받아서 Persister Worker 에서 가져온 긴 URL 로 redirect HTTP Request ( port : 8080 )
  18. 18. Server Verticle Persister Worker
 Verticle vert.x instance EventBus Starter Verticle mongoDB Persister" - create : mongodb 로 부터 sequence 를 가져와서 
 bijective algorithm 으로 short key 생성하고 다시 mongodb 에 URL 정보 저장. " - get : short Key 로 mongodb 로 부터 URL 가져오기. port : 27017
  19. 19. Server Verticle Persister Worker
 Verticle vert.x instance EventBus Starter Verticle [DB] url-shortener [COLLECTION] seq [COLLECTION] urls _id documents “urlShortener” {“seq” : 2311} _id documents “Ad23f” {“url” : “http://examp. . . . . . “} “Ad23g” {“url” : “http://examp. . . . . . “} “Ad23h” {“url” : “http://examp. . . . . . “} . . . . .
  20. 20. vert.x instance EventBus StarterVerticle ServerVerticle ServerVerticle ServerVerticle ServerVerticle PersisterWorker
 Verticle PersisterWorker
 Verticle PersisterWorker
 Verticle PersisterWorker
 Verticle PersisterWorker
 Verticle
  21. 21. EventBus
  22. 22. EventBus
  23. 23. sequence 로 short key 생성하기 encode(2147483647) -> cvuMLb 
 decode(“cvuMLb”) -> 2147483647
  24. 24. [DB] url-shortener [COLLECTION] seq [COLLECTION] urls _id documents “urlShortener” {“seq” : 2311230} _id documents “Ad23f” {“url” : “http://examp. . . . . . “} “Ad23g” {“url” : “http://examp. . . . . . “} “Ad23h” {“url” : “http://examp. . . . . . “} . . . . . create(long url) get(key) 1. seq 에서 시퀀스를 가져오고 increment !" 2. bijective 로 시퀀스를 문자 키로 변환" 3. urls 에 URL 정보 저장 1. key 로 urls 에서 URL 찾아서 반환 2311231 -> Ad23h
  25. 25. 준비 Spring Tool Suite™ http://spring.io/tools/sts http://www.oracle.com/technetwork/java/javase/downloads/index.htmlJDK 7 http://www.mongodb.org/downloadsmongoDB
  26. 26. just in time programming
  27. 27. 데모말고,라이브코딩
  28. 28. 아키텍트가뭐라고생각하세요?

×