Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

ActionCable, WebSocket and Scalability ݾࢵਘ

Slide 3

Slide 3 text

ᛔ౯Օᕨ • Ruby China ᐒ܄ᓕቘާ • RubyConf China य़տᕟᕢᘏ • Teahour.FM Ԇඎ • ংᇁ @lgn21st [email protected]

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

౯ጱੜᆽঅ

Slide 6

Slide 6 text

ᬯฎӞӻӸᘾጱದ๞य़տ

Slide 7

Slide 7 text

ಅզ౯ᥝ्กᛔ૩ጱᒈ࣋

Slide 8

Slide 8 text

ٿฎᚙᐶ࣋ว᧨ದ๞᮷ฎᘓၞ࿇

Slide 9

Slide 9 text

What’s New in Rails 5?

Slide 10

Slide 10 text

Rails API

Slide 11

Slide 11 text

Turbolinks 3

Slide 12

Slide 12 text

ActionCable

Slide 13

Slide 13 text

Real-time Web

Slide 14

Slide 14 text

Real-time Web ԏ᪠ • Polling • Long Polling / Comet • Server-Sent Event (SSE) • XMPP҅Flash҅etc…

Slide 15

Slide 15 text

Polling

Slide 16

Slide 16 text

message_bus

Slide 17

Slide 17 text

Server-Sent Event

Slide 18

Slide 18 text

Server-Sent Event

Slide 19

Slide 19 text

Long Polling / Comet

Slide 20

Slide 20 text

WebSocket Protocol • W3C • පሲ

Slide 21

Slide 21 text

handshake over HTTP

Slide 22

Slide 22 text

GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade

Slide 23

Slide 23 text

පሲ҅පሲ҅ᬮฎ™පሲ

Slide 24

Slide 24 text

Ruby and WebSockets • Third-party Service / pusher.com • Stand-alone server / Slanger • EventMachine + em-websocket • Faye

Slide 25

Slide 25 text

@igrigorik Author of em-websocket

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

faye-websocket • websocket-driver • eventmachine

Slide 28

Slide 28 text

em-websocket V.S. websocket-driver

Slide 29

Slide 29 text

ActionCable

Slide 30

Slide 30 text

"If you can make WebSockets even less work than polling, why wouldn't you do it?” @DHH

Slide 31

Slide 31 text

Seamlessly integration with Rails

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

actioncable-examples

Slide 34

Slide 34 text

ActionCable Server • faye-websocket • Redis / em-hiredis • Celluloid

Slide 35

Slide 35 text

Under the hood • Authorization (Signed Cookie) • API • Connection • Channel • Broadcast • PubSub

Slide 36

Slide 36 text

ActionCable Client Library • Create Consumer • Subscription • ConnectionMonitor

Slide 37

Slide 37 text

EventMachine or Celluloid

Slide 38

Slide 38 text

EventMachine ጱੴᴴ • ಅํጱ୑ྍձۓ᮷ׁᩢ EM.reactor_running • դᎱ஗ሾ્ॺ҅ᵙ᧛҅ᵙٟ҅ᵙ᧣ᦶ • ྋᏟጱֵአ Defer ੒᨝

Slide 39

Slide 39 text

Celluloid

Slide 40

Slide 40 text

Tony Arcieri Author of Celluloid

Slide 41

Slide 41 text

Celluloid • Created at 2011 • Actor Model • Ecosystem • Celluloid::IO • Reel::IO • DCell • Sidekiq

Slide 42

Slide 42 text

Threading is Hard

Slide 43

Slide 43 text

Scalability

Slide 44

Slide 44 text

࣋ว

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Single Server • TCP/IP parameters • Maximum Number Of FD • Memory / Network • Concurrent Model

Slide 47

Slide 47 text

One More Pit

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

೗ᘷଠޞ • Rubyist / ڹᒒ / ᑏۖᒒ / HR • ᓌܲ᧗ݎ [email protected]

Slide 50

Slide 50 text

ᨀᨀय़ਹ

Slide 51

Slide 51 text

ဌࠨଗᨵ ᥝӧߕڦ Q&A ԧމҘ