CloudFoundry
transports{[‘websocket’]}

         2011/12/14(wed)
          Node      3
•                             (@komasshu)

•             html5

•   WebSocket

•   Google API Expert (HTML5)

•   Microsoft Valuable Professional (IE)
111214 node conf
CloudFoundry
WebSocket

                 ...
about
Cloud Foundry
Cloud Foundry                         ?

• VMWare
   PaaS




     https://github.com/cloudfoundry
easy demo

   just push apps

$ vmc push hogehoge


                      http://cloudfoundry.com/
Heroku


• private PaaS
•
• CloudFoundry     PaaS

  • Active State
  • AppFog
  • Joyent
Architecture of
        Cloud Foundry




http://www.slideshare.net/derekcollison/design-of-cloud-foundry
•
    •   Cloud Controller

    •   router

    •   DEA

    •   ...

•                          NATS

    •
hoge.com         3000            app0
                                       (3000)
       fuga.com         3001

                    router
hoge.com                                app1
                                       (3001)       DEA

                  register
                                                deploy
                                 cloud
                               controller



                                   push
about
websocket
WebSocket

• HTML5   API/Protocol

• Web
 •
• Web(port=80)   VPN


 •   SSL-VPN
111214 node conf
111214 node conf
111214 node conf
Handshake
Handshake
Handshake




Frames
HTTP
GET
200
GET
200
GET
200
HTTP
GET
200
GET
200
GET
200
point : Upgrade
Request Header (client => server)
          GET /chat HTTP/1.1
          Host: server.example.com
          Upgrade: websocket

Response Header (server => client)
        HTTP/1.1 101 Switching Protocols
        Upgrade: websocket
        Connection: Upgrade

        Upgrade           HTTP WebSocket
HTTP Compatible

•           VPN

    • FW, Proxy
        •         HTTP/1.1

    •
        •   Web        VPN
http://www.ericom.com/html5_client_vmware_view.asp
                                                     http://www.publickey1.jp/blog/11/webhtml5.html
WebSocket
     on
Cloud Foundry
CloudFoundry
  WebSocket                   orz
• why?
 • nginx                  2
 • router      HTTP/1.1

                                rails

                               sinatra
            nginx    router
                               node.js
                               DEA
• nginx
 • zip      Access log        HTTPS

• router
 • URL routing
                                    URL routing


                    unix domain
                                       tcp socket
                       socket                        rails
                 (tcp socket    )
      80/443                                        sinatra
               nginx          router
                                                    node.js
                                                    DEA
2
       socket.io
           +
transports{‘xhr-polling’}
WebSocket
                     nginx


    • Request     HTTP                  (502)

      •   tcp_proxy Patch

      •
https://github.com/yaoweibin/nginx_tcp_proxy_module
nginx.conf
tcp {
   upstream vcap_router {
     server unix:/tmp/router.sock;
# server 127.0.0.1:2222;
# check interval=3000 rise=2 fall=5 timeout=1000;
   }

    tcp_nodelay       off;

    server {
     listen 80;
     server_name _;

        proxy_read_timeout 200000;
        proxy_send_timeout 200000;
        proxy_pass vcap_router;
    }
}
WebSocket
                router
•   HTTP Request/Response
     HTTP

•   WebSocket
       Frames

•                           HTTP
dialog of router.rb
       request
  Header

                                    router     request/sec         Router

                    on_headers
                    _complete()
         unix           module                  module                        node.js
nginx   domain                                                   TCP socket
        socket     ClientConnection          AppConnection
                                               on_headers
                                               _complete()


                                                      response
                                                  Header

                 response latency
WebSocket
Upgrade: websocket


WebsocketConnection
                                   router

                                               module       TCP socket    node.js
                       on_headers           AppConnection
                       _complete()            on_headers
             unix          module             _complete()
    nginx   domain
            socket    ClientConnection


                                             module
                                         WebsocketConne      TCP socket
                                                                          node.js
                                              ction                        WS
client_connection.rb
def on_headers_complete(headers)
  ....

   # [kom] Check connection mode(websocket or not)
   @is_websocket = (headers[UPGRADE_HEADER] == WEBSOCKET) ? true : false
   Router.log.info "@is_websocket : #{@is_websocket}"

 ....
 if (@is_websocket)
    host, port = @droplet[:host], @droplet[:port]
    @bound_app_conn = EM.connect(host, port, WebsocketConnection, self,
@headers, @droplet)
    return
 end

  ....
end
websocket_connection.rb
module WebsocketConnection
 def initialize client, header, droplet
  @client, @header, @droplet = client, header, droplet
 end

 def connection_completed
  send_data(@header)
 end

 def receive_data(data)
  @client.send_data(data)
 end


 def terminate
 end
                                                         orz
end
111214 node conf
socket.io
           +
transports{‘websocket’}
           :)
move
forward
timeline
• cloud foundry
• websocket
• orz
• code reading
•                       ←
next step

•
    •   pull request

•                      brush up
problem
•         vps ... Cent OS, 512MB plan

• Cloud Foundry
    •   1GB memory

    •   Ubuntu10.04.2

•
router                                                        ( ∀ )




http://www.slideshare.net/derekcollison/design-of-cloud-foundry
•           NATS



• routing
config/routing.yml
demo
git clone




https://github.com/KensakuKOMATSU/cf_router
$ cd bin
$ ./router
I love BDD
 Benkyo-kai Driven
 Development
Thank you!!
http://twitter.com/komasshu

More Related Content

KEY
Router と WebSocket
PPTX
Installation Openstack Swift
PPT
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
PDF
Acus08 Advanced Load Balancing Apache2.2
PDF
青云CoreOS虚拟机部署kubernetes
PDF
Nginx Internals
KEY
Apache httpd 2.4 Reverse Proxy
PDF
Defeating The Network Security Infrastructure V1.0
Router と WebSocket
Installation Openstack Swift
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Acus08 Advanced Load Balancing Apache2.2
青云CoreOS虚拟机部署kubernetes
Nginx Internals
Apache httpd 2.4 Reverse Proxy
Defeating The Network Security Infrastructure V1.0

What's hot (20)

PDF
Docker 1.12 networking deep dive
PDF
Understanding docker networking
PPTX
Docker networking
PDF
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
PPTX
Docker Networking with New Ipvlan and Macvlan Drivers
PDF
Kubernetes networking - basics
PDF
Apache httpd reverse proxy and Tomcat
PPTX
Seamless migration from nova network to neutron in e bay production
PDF
Docker network
PDF
Docker-OVS
PDF
[2018.10.19] Andrew Kong - Tunnel without tunnel (Seminar at OpenStack Korea ...
PDF
Docker and Fargate
PPTX
Docker Networking - Current Status and goals of Experimental Networking
PDF
Web scale infrastructures with kubernetes and flannel
PPTX
KEY
Making Your Capistrano Recipe Book
PDF
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ODP
Docker Network Overview and legacy "--link"
PPTX
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
PDF
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
Docker 1.12 networking deep dive
Understanding docker networking
Docker networking
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
Docker Networking with New Ipvlan and Macvlan Drivers
Kubernetes networking - basics
Apache httpd reverse proxy and Tomcat
Seamless migration from nova network to neutron in e bay production
Docker network
Docker-OVS
[2018.10.19] Andrew Kong - Tunnel without tunnel (Seminar at OpenStack Korea ...
Docker and Fargate
Docker Networking - Current Status and goals of Experimental Networking
Web scale infrastructures with kubernetes and flannel
Making Your Capistrano Recipe Book
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Docker Network Overview and legacy "--link"
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
Ad

Similar to 111214 node conf (20)

PDF
Websocket shanon
PPTX
WebSocket protocol
PPTX
PDF
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
PDF
110828recruit agent ws
PPTX
Building WebSocket and Server Side Events Applications using Atmosphere
PDF
WebSocket Server - Jul 2010
PDF
HTML5 Websockets and Java - Arun Gupta
KEY
Insidrrr Day 1: Simon Tiffert - Real Time Web
PDF
Websocket 1.0
ZIP
Websockets at tossug
PDF
Intro to WebSockets and Comet
KEY
Socket.io
PDF
Introduction to WebSockets
PDF
Nuts and Bolts of WebSocket Devoxx 2014
KEY
Pushing the web — WebSockets
PDF
Socket programming using java
PDF
A Network Architecture for the Web of Things
PDF
IoT Day 2013 - Madrid
KEY
Realtime rocks
Websocket shanon
WebSocket protocol
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
110828recruit agent ws
Building WebSocket and Server Side Events Applications using Atmosphere
WebSocket Server - Jul 2010
HTML5 Websockets and Java - Arun Gupta
Insidrrr Day 1: Simon Tiffert - Real Time Web
Websocket 1.0
Websockets at tossug
Intro to WebSockets and Comet
Socket.io
Introduction to WebSockets
Nuts and Bolts of WebSocket Devoxx 2014
Pushing the web — WebSockets
Socket programming using java
A Network Architecture for the Web of Things
IoT Day 2013 - Madrid
Realtime rocks
Ad

More from Kensaku Komatsu (20)

PPTX
Media processing with serverless architecture
PPTX
Boxdev lt-09082016
PPTX
a pattern for PWA, PRPL
PPTX
Full Matrix Auto Test Framework for WebRTC
PPTX
WebRTC 101
PDF
04122016 web rtc_globalsummit
PPTX
02172016 web rtc_conf_komasshu
PDF
SkyWay国内唯一のCPaaS
PDF
ラズパイでWebRTC ヾ(*´∀`*)ノキャッキャ uv4l-webrtc 軽くハックしてみたよ!
PDF
ビデオ通話・P2Pがコモディティ化する世界 WebRTCによるこれからを探る
PDF
最新Web 通信系API総まくり!WebRTC, Streams, Push api etc.
PPTX
FirefoxでgetStats()
PPT
14th apr2015 リックテレコ勉強会
PPTX
WebRTCが拓く 新たなWebビジネスの世界
PPTX
Web of Thingsの現状とWebRTC活用の可能性
PPTX
25th nov2014 52thhtml5j
PPTX
知ってると得するかもしれないConstraintsたち
PPTX
WebRTCにより可視化されるリアルタイムクラウド。求められるAPI
PPTX
エフサミ2014 web rtcの傾向と対策
PPTX
HTML5 Night 2014 Web x Network Technology ( WebRTC )
Media processing with serverless architecture
Boxdev lt-09082016
a pattern for PWA, PRPL
Full Matrix Auto Test Framework for WebRTC
WebRTC 101
04122016 web rtc_globalsummit
02172016 web rtc_conf_komasshu
SkyWay国内唯一のCPaaS
ラズパイでWebRTC ヾ(*´∀`*)ノキャッキャ uv4l-webrtc 軽くハックしてみたよ!
ビデオ通話・P2Pがコモディティ化する世界 WebRTCによるこれからを探る
最新Web 通信系API総まくり!WebRTC, Streams, Push api etc.
FirefoxでgetStats()
14th apr2015 リックテレコ勉強会
WebRTCが拓く 新たなWebビジネスの世界
Web of Thingsの現状とWebRTC活用の可能性
25th nov2014 52thhtml5j
知ってると得するかもしれないConstraintsたち
WebRTCにより可視化されるリアルタイムクラウド。求められるAPI
エフサミ2014 web rtcの傾向と対策
HTML5 Night 2014 Web x Network Technology ( WebRTC )

Recently uploaded (20)

PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
The various Industrial Revolutions .pptx
PPT
Geologic Time for studying geology for geologist
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
Modernising the Digital Integration Hub
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Hybrid model detection and classification of lung cancer
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
CloudStack 4.21: First Look Webinar slides
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Final SEM Unit 1 for mit wpu at pune .pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
The various Industrial Revolutions .pptx
Geologic Time for studying geology for geologist
sustainability-14-14877-v2.pddhzftheheeeee
Hindi spoken digit analysis for native and non-native speakers
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Modernising the Digital Integration Hub
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
Hybrid model detection and classification of lung cancer
A novel scalable deep ensemble learning framework for big data classification...
Module 1.ppt Iot fundamentals and Architecture
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
O2C Customer Invoices to Receipt V15A.pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
CloudStack 4.21: First Look Webinar slides
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network

111214 node conf

Editor's Notes