“Node.js-Engined”
                      open source map service

                            - Node.js로 구현한 Open Source 맵 서비스



                                                 Doh Kyoung Tae




12년	 11월	 27일	 화
TOC

                   What? Node.js?

                   Why Node.js?

                   Yes! Node.js

                   NodeMap!

                   Benchmark Test




12년	 11월	 27일	 화
What? Node.js?




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript
                            Made by V8 Engine
                            (= Chrome Javascript Engine)




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript
                            Made by V8 Engine
                            (= Chrome Javascript Engine)
                                 vs Rhino, SpiderMonkey




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript
                            Made by V8 Engine
                            (= Chrome Javascript Engine)
                                 vs Rhino, SpiderMonkey


                            Common JS Spec.




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript
                            Made by V8 Engine
                            (= Chrome Javascript Engine)
                                 vs Rhino, SpiderMonkey


                            Common JS Spec.
                                 Modules 1.0 spec draft




12년	 11월	 27일	 화
What? Node.js?
                            Server-Side Javascript
                            Made by V8 Engine
                            (= Chrome Javascript Engine)
                                 vs Rhino, SpiderMonkey


                            Common JS Spec.
                                 Modules 1.0 spec draft

                            company, community, developer




12년	 11월	 27일	 화
Why? Node.js


                         ??




12년	 11월	 27일	 화
Why? Node.js
     1. Event Loop
         Apache Uses one thread/connection
         Nginx doesn’t use thread
         It uses event Loop


                                             thread vs event loop




12년	 11월	 27일	 화
Why? Node.js
     1. Event Loop
         Apache Uses one thread/connection
         Nginx doesn’t use thread
         It uses event Loop


                                             thread vs event loop




12년	 11월	 27일	 화
Why? Node.js
     2.Non-block I/O

                           synchronous block IO              asynchronous non-block IO




                                                  vs




                   http://www.ibm.com/developerworks/linux/library/l-async/

12년	 11월	 27일	 화
Why? Node.js
     2.Non-block I/O

                           synchronous block IO              asynchronous non-block IO




                                                  vs




                   http://www.ibm.com/developerworks/linux/library/l-async/

12년	 11월	 27일	 화
Why? Node.js
     2.Non-block I/O

                           synchronous block IO              asynchronous non-block IO




                                                  vs




                   http://www.ibm.com/developerworks/linux/library/l-async/

12년	 11월	 27일	 화
Why? Node.js
    2.Non-block I/O


          Blocking code




12년	 11월	 27일	 화
Why? Node.js
    2.Non-block I/O


          Blocking code




          Non - blocking code




12년	 11월	 27일	 화
Why? Node.js
    2.Non-block I/O


          Blocking code




          Non - blocking code




12년	 11월	 27일	 화
Yes! Node.js



12년	 11월	 27일	 화
Yes! Node.js
    Modules
                                                    java - maven
  /Users/dev/node.js> npm install                   Linux - rpm
                                    node.js - npm
  .....
                                                    homebrew - brew
  exports
  .defineFunction = function(){
          …….
  }

  var usingFunction =
  require(‘ModuleA’)
  .defineFunction;




12년	 11월	 27일	 화
Yes! Node.js
    NVM - Node.js Version Manager




                                    Preventing headache
                                    from Dependency Hell.




12년	 11월	 27일	 화
Yes! Node.js
    NVM - Node.js Version Manager   真っ白に燃え尽きたジョーは、どこか満足そう
                                    な顔をしている



                                         Preventing headache
                                         from Dependency Hell.




12년	 11월	 27일	 화
Node Map




                   •   Image Service
                   •   Vector Service
                   •   Tile Making
                   •   Using Canvas - Image Effect
12년	 11월	 27일	 화
Node Map
    1. DB Connector - pg                                           /Users/dev/node.js> npm install pg

              pg.connect(conString, function(err, client) {
              !      client.query("SELECT NOW() as when", function(err, result) {
              !      !     console.log("Row count: %d",result.rows.length); / 1
                                                                             /
              !      !     console.log("Current year: %d", result.rows[0].when.getYear());
              !      });
                   });




                                                         pg module



12년	 11월	 27일	 화
Node Map
    1. pg - Why not mongo?



                             •   Poor Spatial Index
                                 - Just Point support
                             •   Post GIS Limitation
                                 - Block I/O
                                 - So, DB can be bottle neck




                             •   Alternative Way
                                 - couch DB

12년	 11월	 27일	 화
Node Map
    2. Web module - express   /Users/dev/node.js> npm install express




                                        •   MVC Web Framework
                                             - jade support
                                             - like spring in java
                                        •   Always Top Module
                                             - npm registry




12년	 11월	 27일	 화
Node Map
    3. Image Processing - Node-Canvas    /Users/dev/node.js> npm install canvas




                                        var Canvas = require('canvas')
                                          , canvas = new Canvas(200,200)
                                          , ctx = canvas.getContext('2d');
                                        ctx.beginPath();
                                        ctx.lineTo(50, 102);
                                        ctx.lineTo(50 + te.width, 102);
                                        ctx.stroke();




12년	 11월	 27일	 화
At a glance




12년	 11월	 27일	 화
At a glance




12년	 11월	 27일	 화
Demo




12년	 11월	 27일	 화
Test - 20user
                   A corp. – C Engine   B corp. – JAVA Engine   NodeMap




12년	 11월	 27일	 화
Test - 20user
                   A corp. – C Engine         B corp. – JAVA Engine             NodeMap




                                        A product response time : AVG 770 ms
                                        B product response time : AVG 1363 ms
                                        NodeMap response time : AVG 536 ms




12년	 11월	 27일	 화
Test - 50user
                   A corp. – C Engine   B corp. – JAVA Engine   NodeMap




12년	 11월	 27일	 화
Test - 50user
                   A corp. – C Engine         B corp. – JAVA Engine              NodeMap




                                         A product response time : AVG 1955ms
                                        B product response time : AVG 20513 ms
                                         NodeMap response time : AVG 1351ms




12년	 11월	 27일	 화
Test - 100user
                   A corp. – C Engine   B corp. – JAVA Engine   NodeMap




12년	 11월	 27일	 화
Test - 100user
                   A corp. – C Engine        B corp. – JAVA Engine             NodeMap




                                        A product response time : AVG 3841ms
                                         B product response time : AVG - ms
                                        NodeMap response time : AVG 2635ms




12년	 11월	 27일	 화
Insight from Test


                          VS




12년	 11월	 27일	 화
Where? NodeMap!
                                       @iam_keen
                                       ehrudxo@gmail.com




                   https://github.com/ehrudxo/nodeMap


12년	 11월	 27일	 화
Beyond the border




                     Between Client & Server language


12년	 11월	 27일	 화
Thank You!
                      •   Q&A




12년	 11월	 27일	 화

Node map keynote -FOSS4G Osaka

  • 1.
    “Node.js-Engined” open source map service - Node.js로 구현한 Open Source 맵 서비스 Doh Kyoung Tae 12년 11월 27일 화
  • 2.
    TOC What? Node.js? Why Node.js? Yes! Node.js NodeMap! Benchmark Test 12년 11월 27일 화
  • 3.
  • 4.
    What? Node.js? Server-Side Javascript 12년 11월 27일 화
  • 5.
    What? Node.js? Server-Side Javascript Made by V8 Engine (= Chrome Javascript Engine) 12년 11월 27일 화
  • 6.
    What? Node.js? Server-Side Javascript Made by V8 Engine (= Chrome Javascript Engine) vs Rhino, SpiderMonkey 12년 11월 27일 화
  • 7.
    What? Node.js? Server-Side Javascript Made by V8 Engine (= Chrome Javascript Engine) vs Rhino, SpiderMonkey Common JS Spec. 12년 11월 27일 화
  • 8.
    What? Node.js? Server-Side Javascript Made by V8 Engine (= Chrome Javascript Engine) vs Rhino, SpiderMonkey Common JS Spec. Modules 1.0 spec draft 12년 11월 27일 화
  • 9.
    What? Node.js? Server-Side Javascript Made by V8 Engine (= Chrome Javascript Engine) vs Rhino, SpiderMonkey Common JS Spec. Modules 1.0 spec draft company, community, developer 12년 11월 27일 화
  • 10.
    Why? Node.js ?? 12년 11월 27일 화
  • 11.
    Why? Node.js 1. Event Loop Apache Uses one thread/connection Nginx doesn’t use thread It uses event Loop thread vs event loop 12년 11월 27일 화
  • 12.
    Why? Node.js 1. Event Loop Apache Uses one thread/connection Nginx doesn’t use thread It uses event Loop thread vs event loop 12년 11월 27일 화
  • 13.
    Why? Node.js 2.Non-block I/O synchronous block IO asynchronous non-block IO vs http://www.ibm.com/developerworks/linux/library/l-async/ 12년 11월 27일 화
  • 14.
    Why? Node.js 2.Non-block I/O synchronous block IO asynchronous non-block IO vs http://www.ibm.com/developerworks/linux/library/l-async/ 12년 11월 27일 화
  • 15.
    Why? Node.js 2.Non-block I/O synchronous block IO asynchronous non-block IO vs http://www.ibm.com/developerworks/linux/library/l-async/ 12년 11월 27일 화
  • 16.
    Why? Node.js 2.Non-block I/O Blocking code 12년 11월 27일 화
  • 17.
    Why? Node.js 2.Non-block I/O Blocking code Non - blocking code 12년 11월 27일 화
  • 18.
    Why? Node.js 2.Non-block I/O Blocking code Non - blocking code 12년 11월 27일 화
  • 19.
  • 20.
    Yes! Node.js Modules java - maven /Users/dev/node.js> npm install Linux - rpm node.js - npm ..... homebrew - brew exports .defineFunction = function(){ ……. } var usingFunction = require(‘ModuleA’) .defineFunction; 12년 11월 27일 화
  • 21.
    Yes! Node.js NVM - Node.js Version Manager Preventing headache from Dependency Hell. 12년 11월 27일 화
  • 22.
    Yes! Node.js NVM - Node.js Version Manager 真っ白に燃え尽きたジョーは、どこか満足そう な顔をしている Preventing headache from Dependency Hell. 12년 11월 27일 화
  • 23.
    Node Map • Image Service • Vector Service • Tile Making • Using Canvas - Image Effect 12년 11월 27일 화
  • 24.
    Node Map 1. DB Connector - pg /Users/dev/node.js> npm install pg pg.connect(conString, function(err, client) { ! client.query("SELECT NOW() as when", function(err, result) { ! ! console.log("Row count: %d",result.rows.length); / 1 / ! ! console.log("Current year: %d", result.rows[0].when.getYear()); ! }); }); pg module 12년 11월 27일 화
  • 25.
    Node Map 1. pg - Why not mongo? • Poor Spatial Index - Just Point support • Post GIS Limitation - Block I/O - So, DB can be bottle neck • Alternative Way - couch DB 12년 11월 27일 화
  • 26.
    Node Map 2. Web module - express /Users/dev/node.js> npm install express • MVC Web Framework - jade support - like spring in java • Always Top Module - npm registry 12년 11월 27일 화
  • 27.
    Node Map 3. Image Processing - Node-Canvas /Users/dev/node.js> npm install canvas var Canvas = require('canvas') , canvas = new Canvas(200,200) , ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.lineTo(50, 102); ctx.lineTo(50 + te.width, 102); ctx.stroke(); 12년 11월 27일 화
  • 28.
    At a glance 12년 11월 27일 화
  • 29.
    At a glance 12년 11월 27일 화
  • 30.
  • 31.
    Test - 20user A corp. – C Engine B corp. – JAVA Engine NodeMap 12년 11월 27일 화
  • 32.
    Test - 20user A corp. – C Engine B corp. – JAVA Engine NodeMap A product response time : AVG 770 ms B product response time : AVG 1363 ms NodeMap response time : AVG 536 ms 12년 11월 27일 화
  • 33.
    Test - 50user A corp. – C Engine B corp. – JAVA Engine NodeMap 12년 11월 27일 화
  • 34.
    Test - 50user A corp. – C Engine B corp. – JAVA Engine NodeMap A product response time : AVG 1955ms B product response time : AVG 20513 ms NodeMap response time : AVG 1351ms 12년 11월 27일 화
  • 35.
    Test - 100user A corp. – C Engine B corp. – JAVA Engine NodeMap 12년 11월 27일 화
  • 36.
    Test - 100user A corp. – C Engine B corp. – JAVA Engine NodeMap A product response time : AVG 3841ms B product response time : AVG - ms NodeMap response time : AVG 2635ms 12년 11월 27일 화
  • 37.
    Insight from Test VS 12년 11월 27일 화
  • 38.
    Where? NodeMap! @iam_keen ehrudxo@gmail.com https://github.com/ehrudxo/nodeMap 12년 11월 27일 화
  • 39.
    Beyond the border Between Client & Server language 12년 11월 27일 화
  • 40.
    Thank You! • Q&A 12년 11월 27일 화