SlideShare a Scribd company logo
1 of 105
Download to read offline
12년	 6월	 23일	 토요일
Go together node.js
                             Node.js Happy Hacking




                                  @nanhapark


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
About Presentation.




12년	 6월	 23일	 토요일
About Presentation.

                    취지
                    Node.js 를 재미있게 표현하여 조금이나마 알리
                    자는 목적으로 제작
                    목차
                    Node.js 실무여정
                    Node.js Black Edition && Nodeman 제작과정
                    Node.js Module 컴파일 과정
                    Node.js Module을 빌드시점에 Native Module로
                    Builtin 방법

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js 실무여정




12년	 6월	 23일	 토요일
냐 ?
        거 아
     미 친




        Node.js 실무여정




12년	 6월	 23일	 토요일
괜찮다. 이럴때 시작해보자
                    냐 ?
        거 아
     미 친




        Node.js 실무여정




12년	 6월	 23일	 토요일
괜찮다. 이럴때 시작해보자
                    냐 ?
        거 아
     미 친                   팀장님에
                                  게 이번
                          Node.js         프로젝트
                                 로 진행해         는
                                          보겠습니
                                   m(_ _)m     다.



        Node.js 실무여정




12년	 6월	 23일	 토요일
괜찮다. 이럴때 시작해보자
                    냐 ?
        거 아
     미 친                   팀장님에
                                  게 이번
                          Node.js         프로젝트
                                 로 진행해         는
                                          보겠습니
                                   m(_ _)m     다.



        Node.js 실무여정
                                     내
                                      가
                                          총
                                           대
                                              를
                                                  매
                                                    보
                                                      자
                                                        .

12년	 6월	 23일	 토요일
괜찮다. 이럴때 시작해보자
                    냐 ?
        거 아
     미 친                   팀장님에
                                  게 이번
                          Node.js         프로젝트
                                 로 진행해         는
                                          보겠습니
                                   m(_ _)m     다.



        Node.js 실무여정
                                     내
                                      가
                                          총
                                           대
                                              를
                                                  매
                                                    보
                                          후덜덜
                                                      자
                                                        .

12년	 6월	 23일	 토요일
괜찮다. 이럴때 시작해보자
                     냐 ?
        거 아
     미 친                       팀장님에
                                      게 이번
                              Node.js         프로젝트
                                     로 진행해         는
                                              보겠습니
                                       m(_ _)m     다.



        Node.js 실무여정
                                         내
                                          가
                                              총
                                               대
                                                  를
                                                      매
                                                        보
                                   보자
                                              후덜덜
                                                          자
                               가 되                          .
                           서 최고
                    민 국에
          대한
12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js 장단점




12년	 6월	 23일	 토요일
Node.js 장단점

            장점

                    Memory 11MB / 1 process
                      but, apache httpd 33MB / 1 process
                    Javascript API
            단점

                    callback style (CPS)
                    Process를 띄우는 즉시 개발자 자신의 책임


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js 실무작업 목록




12년	 6월	 23일	 토요일
Node.js 실무작업 목록

            그룹웨어 Chatting Server 프로젝트
                    OAuth, Socket.io

                    HAProxy, Stunnel, Redis

            CloudBuild 프로젝트
                    API 서버, 아카이브 업로드서버, 인증키 업로드서버

                    ALS API (Sendmail) 프로젝트

            기타 개인적인 홈페이지 nodeqa, naggomsu



12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
한번 해볼까?! 고고고고




12년	 6월	 23일	 토요일
한번 해볼까?! 고고고고


            openapi 를 호출하여 무언가 해보자

            작업시작 !! 유후~~ 재밌겠다.

            음.. http native module이 있군.

            var http = require(‘http’); 그 다음..

            createClient, request, parameters, callbacks.....




12년	 6월	 23일	 토요일
한번 해볼까?! 고고고고


            openapi 를 호출하여 무언가 해보자

            작업시작 !! 유후~~ 재밌겠다.

            음.. http native module이 있군.

            var http = require(‘http’); 그 다음..

            createClient, request, parameters, callbacks.....




12년	 6월	 23일	 토요일
한번 해볼까?! 고고고고


            openapi 를 호출하여 무언가 해보자

            작업시작 !! 유후~~ 재밌겠다.

            음.. http native module이 있군.

            var http = require(‘http’); 그 다음..

            createClient, request, parameters, callbacks.....




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
작업 과정에서 느꼈던 아쉬운 점들




12년	 6월	 23일	 토요일
작업 과정에서 느꼈던 아쉬운 점들

            TIP 공유 커뮤니티 부족

            인터페이스 수준의 API 제공

                    제공되는 API를 사용하여 작업하기 어렵다.

            원하는 결과를 얻기 위해 적지 않은 코딩을 해야한다.

                    Meta Programming 시대에 왠말인가.....

            해결방법

                    신들린 구글링 -> 시간소요 ;; project deadline ....;;

                    3rd party module name을 알아야 하고, github 소스를 분석 / 삽
                    질 시작

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
3rd party module keyword 중요성 증대




12년	 6월	 23일	 토요일
3rd party module keyword 중요성 증대

            제공되는 API를 이용하여 작업하는데 소비하는 비용이
            크다.

            restler or request 라는 키워드만 알고 있어도 확실한
            도움이 될 것이다.

            하지만, 키워드를 알아도 사용방법을 브라우져를 열고
            검색해서 알아내야 하고, 대중적인 사용방법 또한 익
            혀야 한다.

                    더 빠르고, 직관된 검색을 유도하자. 즉, linux man
                    과 같은것을 만들어보자.

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
자 그럼 3rd party module 찾아서...




12년	 6월	 23일	 토요일
자 그럼 3rd party module 찾아서...




                    Jungle


12년	 6월	 23일	 토요일
자 그럼 3rd party module 찾아서...




12년	 6월	 23일	 토요일
자 그럼 3rd party module 찾아서...

            File System - byline | fileutils | glob | graceful-fs |
            minimatch | mkdirp |
            Control Flow - async | fibers | fibrous | step |
            jsdom, request, restler, mongoose, node-static, ejs,
            jade, xml2js, js2xml, socket.io, commander, optimist,
            uuid, underscore, moment, emailjs, express, jade,
            mocha, ejs
            etc ...., 너무 많다...... 같은 종류의 모듈이 많고, 어떤
            모듈이 대중화된지 모르겠다.

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js Black Edition
        && Nodeman Project Start



12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Roadmap




12년	 6월	 23일	 토요일
Roadmap

            유용하고 검증된 3rd party module을 Native Module
            으로 컴파일하자.

            대중성 있는 Module이 무엇일까?

                    Most Depend on, http://search.npmjs.org/
            실무에서 진행중인 프로젝트에 적용해보자

            작업중에 모듈의 사용성에 불편함을 없애보자.

            http://black.nodeman.org
            http://nodeman.org
12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
디렉토리 구성




12년	 6월	 23일	 토요일
디렉토리 구성
            /benchmark
            /deps: opensources
               /http_parser / openssl / libuv
               /v8
               /zlib
            /doc: 문서
            /lib: 네이티브 모듈 (*. js)
            /out: 빌드 디렉토리
            /src: core + 기본 모듈 (node_ *. cc)
            /test: 테스트 스크립트
            /tools: 빌드 도구 (js2c)
12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
v8 util JS2C




12년	 6월	 23일	 토요일
v8 util JS2C

                    Native Module (http, fs ..) 를 v8에 compile하기 위한
                    도구

                    Python, ./tools/js2c.py
                    WAF Build Script (wscript) 에서 import

                    Convert Javascript (lib/**) to C source (header)
                      src/node_javascript.cc 에서 header file load

                        ./out/Release/src/node_natives.h


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
JS2C Live Coding
        - console.js 컴파일 / 디컴파일 과정




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Native Module Require Step




12년	 6월	 23일	 토요일
Native Module Require Step

            default
                    javascript -> file load -> v8 compile
            hacking
                    javascript -> file load -> c -> v8 compile
                    not npm
                    3rd party module 찾아서 여행을 떠나지 않아도 된
                    다. 바로 require ! (이 기분 실무에서 정말 편함!!)


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Nodeman (Node.js Manual)




12년	 6월	 23일	 토요일
Nodeman (Node.js Manual)

            Node.js Black Edition Helper http://nodeman.org
            npm과 같이 설치시 빌트인 (wscript line 1013 포함)
            터미널에서 바로 Manual && Snippet code를 얻자.
                    Node.js 기본 API 를 비롯하여 유용한 3rd party module
                    manual 제공해보자.
                    약 50개의 대중적인 검증된 모듈 위주로 readme.md 내용을
                    COLORFUL 작업하여 집약시킴.
            usage: nodeman [modulename]
            builtin list: nodeman -b
                    카테고리별로 검증된 모듈목록을 확인할 수 있다.
            기본 API 포함, 약 40개 Native Module 작업완료. update ... ing...

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Nodeman Live Coding
        - 기본 사용방법
        - with npm install
          - wscript line 1013




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js Funny Structure.




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Node.js 언어 구성




12년	 6월	 23일	 토요일
Node.js 언어 구성


            Python: Build Script

            Javascript: API (native module)

            cpp: API, core (v8)

            c: opensource (libuv, libev, libeio, http_parser, zlib ...)




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Event Driven




12년	 6월	 23일	 토요일
Event Driven




12년	 6월	 23일	 토요일
Event Driven




12년	 6월	 23일	 토요일
Event Driven




12년	 6월	 23일	 토요일
Event Driven



          인생은 이벤트의 연속이다.
                휴;;



12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Event Loop && Opensources




12년	 6월	 23일	 토요일
Event Loop && Opensources




12년	 6월	 23일	 토요일
Event Loop && Opensources
             epoll/kqueue
                    당신은 이벤트를 달력에 등록하고

             libeio
                    그것을 실행하는 사람은 당신 혼자일 수도 있고, 여러
                    개의 이벤트를 각각의 이벤트업체나 친구들에게 맡겨
                    서 이벤트를 진행시킬 수 있다.

             libev, CPS Style
                    당신이 똑똑하고, 가정적이고, 실행능력이 뛰어나다면,
                    이벤트 실행은 별거 아니다.
12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 !




12년	 6월	 23일	 토요일
단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 !




                    I/O 처리
                      libeio



12년	 6월	 23일	 토요일
단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 !


                                 메인쓰레드만
                 메인쓰레드의
                  I/O 처리         단일쓰레드

                       V8
                    libeio
                                 file I/O
                                 max polling
               (google chrome)   count 10




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Architecture & I/O Flow (libeio)




12년	 6월	 23일	 토요일
Architecture & I/O Flow (libeio)




12년	 6월	 23일	 토요일
Architecture & I/O Flow (libeio)




                    http://nodeqa.com/nodejs_ref/6
12년	 6월	 23일	 토요일
Architecture & I/O Flow (libeio)




                    http://nodeqa.com/nodejs_ref/6
12년	 6월	 23일	 토요일
Architecture & I/O Flow (libeio)




                    http://nodeqa.com/nodejs_ref/6
12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Module Internal Binding




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
최초 $ Node 실행시 프롬프트 뜨기 전까지




12년	 6월	 23일	 토요일
최초 $ Node 실행시 프롬프트 뜨기 전까지


            제일 먼저 실행되는 파일 src/node_main.cc

                    int main....
            두번째로 실행되는 파일 src/node.cc LINE 2873, 2310

                    process 객체 생성 ex) process.binding, process API

            lib/**.js Native Modules v8 compile node_natives.h
                    src/node_javascript.cc LINE 36
            event loop start

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Javascript를 Native Module로... #1




12년	 6월	 23일	 토요일
Javascript를 Native Module로... #1


            very easy !!
                    lib 디렉토리에 넣으면 된다.
            lib/**.js 파일들의 기본취지
                    node.js API Programming
                      fs, http, console....
                    cpp module 을 API로 제공하기 위한 Bridge
                      process.binding 으로 cpp 불러들임.


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Javascript를 Native Module로... #2




12년	 6월	 23일	 토요일
Javascript를 Native Module로... #2

            lib/**.js 생성하기

                    ** 에 포함되는 dependency 존재할 시 **_sub.js 형태로
                    만들어서 require 하는것이 일반적. 서브디렉토리는 지원
                    하지 않음. 예) require “winston_transport.js”

                    fs, http ... 등 모두 1개의 javascript 파일로 이루어져 있으
                    며, process.binding 을 사용하여 cpp lib import

            WAF build tool 에 의하여 변경사항이 있을경우 rebuild

            make && make install


12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
process.binding()




12년	 6월	 23일	 토요일
process.binding()

            Node API 의 핵심역할

            cpp module을 javascript에서 불러들일 수 있도록 중개역할을
            한다.

                    FROM src/node_**.cc TO lib/**.js
                    ex) http (http_parser)
            binding을 lib/**.js 에서 사용할 수 있도록 API 형식으로 선언

                    src/node.cc LINE 1727, 2101
                    NODE_SET_METHOD (process, "binding", Binding);

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Native Module을 global Module로...




12년	 6월	 23일	 토요일
Native Module을 global Module로...



            not Require

            src/node.js line 47, 175

            require 없이 사용하고 싶다.

            javascript 를 사용하여 원하는 대로 hacking 가능하다.




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
cpp를 native module로 만들어보자.




12년	 6월	 23일	 토요일
cpp를 native module로 만들어보자.


            일반적인 방법 http://nodejs.org/api/addons.html

                    *.node 만들기 && require

            src/node_**.h (optinal), src/node_**.cc
            src/node_extension.h 추가

            lib/**.js 추가하고 process.binding 사용하여 import

            wscript 918 LINE 부분에 추가

            make && make install

12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
Native Module Live Coding
        - javascript
          - lib/*.js, nanhapark keyword
          - require
        - cpp
          - node_extend.cc[h], extend.js
          - vi src/node_extension.h +52
          - vi wscript +922
        - make 과정
          - 빌드파일 변경여부 판단
            - find 하여 포함된 여부
          - node -> out/Release/node
          - out/Release/ ... header.h
            - src/node_javascript.cc
        - wscript

        - base64
          - base64 diff




12년	 6월	 23일	 토요일
12년	 6월	 23일	 토요일
끝. 감사합니다. KIN플~




12년	 6월	 23일	 토요일

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

[Frends] go together with nodejs

  • 1. 12년 6월 23일 토요일
  • 2. Go together node.js Node.js Happy Hacking @nanhapark 12년 6월 23일 토요일
  • 3. 12년 6월 23일 토요일
  • 5. About Presentation. 취지 Node.js 를 재미있게 표현하여 조금이나마 알리 자는 목적으로 제작 목차 Node.js 실무여정 Node.js Black Edition && Nodeman 제작과정 Node.js Module 컴파일 과정 Node.js Module을 빌드시점에 Native Module로 Builtin 방법 12년 6월 23일 토요일
  • 6. 12년 6월 23일 토요일
  • 8. 냐 ? 거 아 미 친 Node.js 실무여정 12년 6월 23일 토요일
  • 9. 괜찮다. 이럴때 시작해보자 냐 ? 거 아 미 친 Node.js 실무여정 12년 6월 23일 토요일
  • 10. 괜찮다. 이럴때 시작해보자 냐 ? 거 아 미 친 팀장님에 게 이번 Node.js 프로젝트 로 진행해 는 보겠습니 m(_ _)m 다. Node.js 실무여정 12년 6월 23일 토요일
  • 11. 괜찮다. 이럴때 시작해보자 냐 ? 거 아 미 친 팀장님에 게 이번 Node.js 프로젝트 로 진행해 는 보겠습니 m(_ _)m 다. Node.js 실무여정 내 가 총 대 를 매 보 자 . 12년 6월 23일 토요일
  • 12. 괜찮다. 이럴때 시작해보자 냐 ? 거 아 미 친 팀장님에 게 이번 Node.js 프로젝트 로 진행해 는 보겠습니 m(_ _)m 다. Node.js 실무여정 내 가 총 대 를 매 보 후덜덜 자 . 12년 6월 23일 토요일
  • 13. 괜찮다. 이럴때 시작해보자 냐 ? 거 아 미 친 팀장님에 게 이번 Node.js 프로젝트 로 진행해 는 보겠습니 m(_ _)m 다. Node.js 실무여정 내 가 총 대 를 매 보 보자 후덜덜 자 가 되 . 서 최고 민 국에 대한 12년 6월 23일 토요일
  • 14. 12년 6월 23일 토요일
  • 15. Node.js 장단점 12년 6월 23일 토요일
  • 16. Node.js 장단점 장점 Memory 11MB / 1 process but, apache httpd 33MB / 1 process Javascript API 단점 callback style (CPS) Process를 띄우는 즉시 개발자 자신의 책임 12년 6월 23일 토요일
  • 17. 12년 6월 23일 토요일
  • 18. Node.js 실무작업 목록 12년 6월 23일 토요일
  • 19. Node.js 실무작업 목록 그룹웨어 Chatting Server 프로젝트 OAuth, Socket.io HAProxy, Stunnel, Redis CloudBuild 프로젝트 API 서버, 아카이브 업로드서버, 인증키 업로드서버 ALS API (Sendmail) 프로젝트 기타 개인적인 홈페이지 nodeqa, naggomsu 12년 6월 23일 토요일
  • 20. 12년 6월 23일 토요일
  • 22. 한번 해볼까?! 고고고고 openapi 를 호출하여 무언가 해보자 작업시작 !! 유후~~ 재밌겠다. 음.. http native module이 있군. var http = require(‘http’); 그 다음.. createClient, request, parameters, callbacks..... 12년 6월 23일 토요일
  • 23. 한번 해볼까?! 고고고고 openapi 를 호출하여 무언가 해보자 작업시작 !! 유후~~ 재밌겠다. 음.. http native module이 있군. var http = require(‘http’); 그 다음.. createClient, request, parameters, callbacks..... 12년 6월 23일 토요일
  • 24. 한번 해볼까?! 고고고고 openapi 를 호출하여 무언가 해보자 작업시작 !! 유후~~ 재밌겠다. 음.. http native module이 있군. var http = require(‘http’); 그 다음.. createClient, request, parameters, callbacks..... 12년 6월 23일 토요일
  • 25. 12년 6월 23일 토요일
  • 26. 작업 과정에서 느꼈던 아쉬운 점들 12년 6월 23일 토요일
  • 27. 작업 과정에서 느꼈던 아쉬운 점들 TIP 공유 커뮤니티 부족 인터페이스 수준의 API 제공 제공되는 API를 사용하여 작업하기 어렵다. 원하는 결과를 얻기 위해 적지 않은 코딩을 해야한다. Meta Programming 시대에 왠말인가..... 해결방법 신들린 구글링 -> 시간소요 ;; project deadline ....;; 3rd party module name을 알아야 하고, github 소스를 분석 / 삽 질 시작 12년 6월 23일 토요일
  • 28. 12년 6월 23일 토요일
  • 29. 3rd party module keyword 중요성 증대 12년 6월 23일 토요일
  • 30. 3rd party module keyword 중요성 증대 제공되는 API를 이용하여 작업하는데 소비하는 비용이 크다. restler or request 라는 키워드만 알고 있어도 확실한 도움이 될 것이다. 하지만, 키워드를 알아도 사용방법을 브라우져를 열고 검색해서 알아내야 하고, 대중적인 사용방법 또한 익 혀야 한다. 더 빠르고, 직관된 검색을 유도하자. 즉, linux man 과 같은것을 만들어보자. 12년 6월 23일 토요일
  • 31. 12년 6월 23일 토요일
  • 32. 자 그럼 3rd party module 찾아서... 12년 6월 23일 토요일
  • 33. 자 그럼 3rd party module 찾아서... Jungle 12년 6월 23일 토요일
  • 34. 자 그럼 3rd party module 찾아서... 12년 6월 23일 토요일
  • 35. 자 그럼 3rd party module 찾아서... File System - byline | fileutils | glob | graceful-fs | minimatch | mkdirp | Control Flow - async | fibers | fibrous | step | jsdom, request, restler, mongoose, node-static, ejs, jade, xml2js, js2xml, socket.io, commander, optimist, uuid, underscore, moment, emailjs, express, jade, mocha, ejs etc ...., 너무 많다...... 같은 종류의 모듈이 많고, 어떤 모듈이 대중화된지 모르겠다. 12년 6월 23일 토요일
  • 36. 12년 6월 23일 토요일
  • 37. Node.js Black Edition && Nodeman Project Start 12년 6월 23일 토요일
  • 38. 12년 6월 23일 토요일
  • 40. Roadmap 유용하고 검증된 3rd party module을 Native Module 으로 컴파일하자. 대중성 있는 Module이 무엇일까? Most Depend on, http://search.npmjs.org/ 실무에서 진행중인 프로젝트에 적용해보자 작업중에 모듈의 사용성에 불편함을 없애보자. http://black.nodeman.org http://nodeman.org 12년 6월 23일 토요일
  • 41. 12년 6월 23일 토요일
  • 43. 디렉토리 구성 /benchmark /deps: opensources /http_parser / openssl / libuv /v8 /zlib /doc: 문서 /lib: 네이티브 모듈 (*. js) /out: 빌드 디렉토리 /src: core + 기본 모듈 (node_ *. cc) /test: 테스트 스크립트 /tools: 빌드 도구 (js2c) 12년 6월 23일 토요일
  • 44. 12년 6월 23일 토요일
  • 45. v8 util JS2C 12년 6월 23일 토요일
  • 46. v8 util JS2C Native Module (http, fs ..) 를 v8에 compile하기 위한 도구 Python, ./tools/js2c.py WAF Build Script (wscript) 에서 import Convert Javascript (lib/**) to C source (header) src/node_javascript.cc 에서 header file load ./out/Release/src/node_natives.h 12년 6월 23일 토요일
  • 47. 12년 6월 23일 토요일
  • 48. JS2C Live Coding - console.js 컴파일 / 디컴파일 과정 12년 6월 23일 토요일
  • 49. 12년 6월 23일 토요일
  • 50. Native Module Require Step 12년 6월 23일 토요일
  • 51. Native Module Require Step default javascript -> file load -> v8 compile hacking javascript -> file load -> c -> v8 compile not npm 3rd party module 찾아서 여행을 떠나지 않아도 된 다. 바로 require ! (이 기분 실무에서 정말 편함!!) 12년 6월 23일 토요일
  • 52. 12년 6월 23일 토요일
  • 53. Nodeman (Node.js Manual) 12년 6월 23일 토요일
  • 54. Nodeman (Node.js Manual) Node.js Black Edition Helper http://nodeman.org npm과 같이 설치시 빌트인 (wscript line 1013 포함) 터미널에서 바로 Manual && Snippet code를 얻자. Node.js 기본 API 를 비롯하여 유용한 3rd party module manual 제공해보자. 약 50개의 대중적인 검증된 모듈 위주로 readme.md 내용을 COLORFUL 작업하여 집약시킴. usage: nodeman [modulename] builtin list: nodeman -b 카테고리별로 검증된 모듈목록을 확인할 수 있다. 기본 API 포함, 약 40개 Native Module 작업완료. update ... ing... 12년 6월 23일 토요일
  • 55. 12년 6월 23일 토요일
  • 56. Nodeman Live Coding - 기본 사용방법 - with npm install - wscript line 1013 12년 6월 23일 토요일
  • 57. 12년 6월 23일 토요일
  • 58. Node.js Funny Structure. 12년 6월 23일 토요일
  • 59. 12년 6월 23일 토요일
  • 60. Node.js 언어 구성 12년 6월 23일 토요일
  • 61. Node.js 언어 구성 Python: Build Script Javascript: API (native module) cpp: API, core (v8) c: opensource (libuv, libev, libeio, http_parser, zlib ...) 12년 6월 23일 토요일
  • 62. 12년 6월 23일 토요일
  • 63. Event Driven 12년 6월 23일 토요일
  • 64. Event Driven 12년 6월 23일 토요일
  • 65. Event Driven 12년 6월 23일 토요일
  • 66. Event Driven 12년 6월 23일 토요일
  • 67. Event Driven 인생은 이벤트의 연속이다. 휴;; 12년 6월 23일 토요일
  • 68. 12년 6월 23일 토요일
  • 69. Event Loop && Opensources 12년 6월 23일 토요일
  • 70. Event Loop && Opensources 12년 6월 23일 토요일
  • 71. Event Loop && Opensources epoll/kqueue 당신은 이벤트를 달력에 등록하고 libeio 그것을 실행하는 사람은 당신 혼자일 수도 있고, 여러 개의 이벤트를 각각의 이벤트업체나 친구들에게 맡겨 서 이벤트를 진행시킬 수 있다. libev, CPS Style 당신이 똑똑하고, 가정적이고, 실행능력이 뛰어나다면, 이벤트 실행은 별거 아니다. 12년 6월 23일 토요일
  • 72. 12년 6월 23일 토요일
  • 73. 단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 ! 12년 6월 23일 토요일
  • 74. 단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 ! I/O 처리 libeio 12년 6월 23일 토요일
  • 75. 단일쓰레드 ? 웃기셔. 메인쓰레드만 단일 ! 메인쓰레드만 메인쓰레드의 I/O 처리 단일쓰레드 V8 libeio file I/O max polling (google chrome) count 10 12년 6월 23일 토요일
  • 76. 12년 6월 23일 토요일
  • 77. Architecture & I/O Flow (libeio) 12년 6월 23일 토요일
  • 78. Architecture & I/O Flow (libeio) 12년 6월 23일 토요일
  • 79. Architecture & I/O Flow (libeio) http://nodeqa.com/nodejs_ref/6 12년 6월 23일 토요일
  • 80. Architecture & I/O Flow (libeio) http://nodeqa.com/nodejs_ref/6 12년 6월 23일 토요일
  • 81. Architecture & I/O Flow (libeio) http://nodeqa.com/nodejs_ref/6 12년 6월 23일 토요일
  • 82. 12년 6월 23일 토요일
  • 83. Module Internal Binding 12년 6월 23일 토요일
  • 84. 12년 6월 23일 토요일
  • 85. 최초 $ Node 실행시 프롬프트 뜨기 전까지 12년 6월 23일 토요일
  • 86. 최초 $ Node 실행시 프롬프트 뜨기 전까지 제일 먼저 실행되는 파일 src/node_main.cc int main.... 두번째로 실행되는 파일 src/node.cc LINE 2873, 2310 process 객체 생성 ex) process.binding, process API lib/**.js Native Modules v8 compile node_natives.h src/node_javascript.cc LINE 36 event loop start 12년 6월 23일 토요일
  • 87. 12년 6월 23일 토요일
  • 88. Javascript를 Native Module로... #1 12년 6월 23일 토요일
  • 89. Javascript를 Native Module로... #1 very easy !! lib 디렉토리에 넣으면 된다. lib/**.js 파일들의 기본취지 node.js API Programming fs, http, console.... cpp module 을 API로 제공하기 위한 Bridge process.binding 으로 cpp 불러들임. 12년 6월 23일 토요일
  • 90. 12년 6월 23일 토요일
  • 91. Javascript를 Native Module로... #2 12년 6월 23일 토요일
  • 92. Javascript를 Native Module로... #2 lib/**.js 생성하기 ** 에 포함되는 dependency 존재할 시 **_sub.js 형태로 만들어서 require 하는것이 일반적. 서브디렉토리는 지원 하지 않음. 예) require “winston_transport.js” fs, http ... 등 모두 1개의 javascript 파일로 이루어져 있으 며, process.binding 을 사용하여 cpp lib import WAF build tool 에 의하여 변경사항이 있을경우 rebuild make && make install 12년 6월 23일 토요일
  • 93. 12년 6월 23일 토요일
  • 95. process.binding() Node API 의 핵심역할 cpp module을 javascript에서 불러들일 수 있도록 중개역할을 한다. FROM src/node_**.cc TO lib/**.js ex) http (http_parser) binding을 lib/**.js 에서 사용할 수 있도록 API 형식으로 선언 src/node.cc LINE 1727, 2101 NODE_SET_METHOD (process, "binding", Binding); 12년 6월 23일 토요일
  • 96. 12년 6월 23일 토요일
  • 97. Native Module을 global Module로... 12년 6월 23일 토요일
  • 98. Native Module을 global Module로... not Require src/node.js line 47, 175 require 없이 사용하고 싶다. javascript 를 사용하여 원하는 대로 hacking 가능하다. 12년 6월 23일 토요일
  • 99. 12년 6월 23일 토요일
  • 100. cpp를 native module로 만들어보자. 12년 6월 23일 토요일
  • 101. cpp를 native module로 만들어보자. 일반적인 방법 http://nodejs.org/api/addons.html *.node 만들기 && require src/node_**.h (optinal), src/node_**.cc src/node_extension.h 추가 lib/**.js 추가하고 process.binding 사용하여 import wscript 918 LINE 부분에 추가 make && make install 12년 6월 23일 토요일
  • 102. 12년 6월 23일 토요일
  • 103. Native Module Live Coding - javascript - lib/*.js, nanhapark keyword - require - cpp - node_extend.cc[h], extend.js - vi src/node_extension.h +52 - vi wscript +922 - make 과정 - 빌드파일 변경여부 판단 - find 하여 포함된 여부 - node -> out/Release/node - out/Release/ ... header.h - src/node_javascript.cc - wscript - base64 - base64 diff 12년 6월 23일 토요일
  • 104. 12년 6월 23일 토요일
  • 105. 끝. 감사합니다. KIN플~ 12년 6월 23일 토요일