Node.js + Websocket 삽질기

  • View
    853

  • Download
    3

Embed Size (px)

Text of Node.js + Websocket 삽질기

PowerPoint Presentation

Node.js + Websocket

2016. 03. 11 /

|

. 2013 3 15 ____. , , HTML5 .

SBSCNBC ,LG R&D ,LG R&D , HTML5 , / : : ()00

2

. . . .. ( )

Super dynamic..what?, .~

| : SIMPLE IS THE BEST

Goal 12/31AWS EC2BrowserSocket.ioNode.jsNginXOracleSocket.ioHTML/CSS/JS/MediaFTP

| : MVP

Goal 12/31

https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter MVP . .

| : MVP

Goal 12/31 PC . PC VIEW VIEW PRESENTER( ) MODEL

..PC VIEW

|

Goal 12/31Ajax Long Polling HTTP

,

?

| Node.js

Goal 12/31() Node.js Node.js .

?

| Node.js + Socket.io

Goal 12/31 .Publish/Subscribe API Node.js

()

| Redis

Goal 12/31 ( ?)

Pub/Sub Channel Redis DB

?

Goal 12/31

?

Goal 12/31

, ...

Goal 12/31 ...

Goal 12/31AWS EC2Node.js

Socket.ioAWSLBS LBS WebSocket Sticky Session .| AMAZON LBSBrowserSocket.ioAWS EC2Node.js

Socket.io

Goal 12/31 (?) ..

Goal 12/31HAProxy

HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers.[2] It is written in C[3] and has a reputation for being fast and efficient (in terms of processor and memory usage).[4]

HAProxy is used by a number of high-profile websites including GitHub, Bitbucket,[5] Stack Overflow,[6] Reddit, Tumblr, Twitter[7][8] and Tuenti[9] and is used in the OpsWorks product from Amazon Web Services.[10]

https://en.wikipedia.org/wiki/HAProxy 1 ... | ! ! H.A.P.R.O.X.Y

Goal 12/31HAProxyHAProxy TCP StickySession .! ! x100BrowserSocket.ioAWS EC2Node.js

Socket.ioAWS EC2Node.js

Socket.io

| HAProxy

, ...

Goal 12/31 , .

Goal 12/31

. | Node.js

Goal 12/31 , Try catch

Node.js ,Java | Node.js _2

Goal 12/31 Node , Node.js Callback .

| Node.js _3

Goal 12/31 Callback !

, .AB

Event Loop2C2) B C1) A Try Catch3) C ExceptionD4) 1 C Exception . Node.js Domain .| Node.js asynchronous callback mechanism

Goal 12/31 .Node.js , | Node.js

Goal 12/31 , .

10 -

Goal 12/31

10 - ,

Goal 12/31

10 - 10 .

,

Goal 12/31

Requiem for Gaebalja

Goal 12/31- . . .

Goal 12/31 , Amazon SNS

()Publish/Subscribe Topic | OOO :

Goal 12/31 !| :

~

Goal 12/31| , , , .....

,

Goal 12/31

.

Goal 12/31RedisPreflightUpgrade| Socket.io, Redis, Node session module ()Socket.io Preflight(Ajax) ,Websocket . Node.js (Redis ..)BrowserSocket.ioNode.js

Socket.ioExpressMod.SessionStore

Goal 12/31

Socket.io . .

| NPM

Goal 12/31 _ : FkingSession , FantastickBurgerKingSession . . .| Trick or ThreatRedisonconnection

oncookieBrowserSocket.ioNode.js

Socket.ioExpress- document.cookie

Goal 12/31 20 .

!

Goal 12/31

Goal 12/31| 10

Goal 12/31 : callback, UI state_ UI _ _( ) , .. _ _ STATE

_Async _Callback chain

_

|

| 12.. 7

Goal 12/31

_ _ _ MVP ...

| : MVP

Goal 12/31

Interlude

Goal 12/31

| ?

Goal 12/31

_ _ ( ), _ _ 5~6 1~3 | :

Goal 12/31

Goal 12/31

12 23 _ email DM_1 4_

Goal 12/31

1 : Publish/Subscribe 2 : Node 3 : Subscribe

Node.js Subscribe (2~5MB) . .

Goal 12/31| Too much love will kill you

1 Payload , 5 25

_2vCPU EC2 _ Payload _Payload many servers with low connections

Goal 12/31| Payload

Payload _js UI freezing _ web worker

JSON Key _ Key , 20~30% _, _ Key Value _

,

Goal 12/31| 2 3

/ / / WebSocket Server Push Node.js Java-Spring REST API

Goal 12/31| Rest Server

Goal 12/31| REMIND :

AWS EC2BrowserSocket.ioNode.jsNginXOracleSocket.ioHTML/CSS/JS/MediaFTP

|

BrowserAjaxSocket.ioAWS EC2Node.jsNginXOracleSocket.ioHTML/CSS/JS/MediaFTPHAProxyAWS EC2Node.jsSocket.ioNode.js

Rest API

Goal 12/31

... 2 3 ...,

1. - REST ( )2. ( Module 1.11 )3. WebSocket Push 4. Ajax Long Polling

Goal 12/31

, ., ? , .

Goal 12/31

, ( )_ _ _ HAProxy

Goal 12/31

.