Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ActionCable, WebSocket and Scalability
Search
Daniel Lv
October 11, 2015
Technology
3
610
ActionCable, WebSocket and Scalability
以 Rails 5.0 即将发布的 ActionCable 作为切入点,给大家介绍一下事实 WebSocket 的内部实现,以及在生产环境下如何去正确的水平扩展 WebSocket 服务。
Daniel Lv
October 11, 2015
Tweet
Share
More Decks by Daniel Lv
See All by Daniel Lv
Matz - Be a language designer
lgn21st
9
1.1k
Koz - 听我们的?
lgn21st
2
390
Other Decks in Technology
See All in Technology
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
1
380
Webアプリケーションにオブザーバビリティを実装するRust入門ガイド
nwiizo
7
870
まずはマネコンでちゃちゃっと作ってから、それをCDKにしてみよか。
yamada_r
2
120
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
120
これでもう迷わない!Jetpack Composeの書き方実践ガイド
zozotech
PRO
0
1k
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/06 - 2025/08
oracle4engineer
PRO
0
110
株式会社ログラス - 会社説明資料【エンジニア】/ Loglass Engineer
loglass2019
4
65k
Generative AI Japan 第一回生成AI実践研究会「AI駆動開発の現在地──ブレイクスルーの鍵を握るのはデータ領域」
shisyu_gaku
0
320
職種の壁を溶かして開発サイクルを高速に回す~情報透明性と職種越境から考えるAIフレンドリーな職種間連携~
daitasu
0
170
dbt開発 with Claude Codeのためのガードレール設計
10xinc
2
1.3k
LLMを搭載したプロダクトの品質保証の模索と学び
qa
0
1.1k
Claude Code でアプリ開発をオートパイロットにするためのTips集 Zennの場合 / Claude Code Tips in Zenn
wadayusuke
4
380
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Facilitating Awesome Meetings
lara
55
6.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Designing for humans not robots
tammielis
253
25k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Navigating Team Friction
lara
189
15k
A Tale of Four Properties
chriscoyier
160
23k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Transcript
None
ActionCable, WebSocket and Scalability ݾࢵਘ
ᛔ౯Օᕨ • Ruby China ᐒ܄ᓕቘާ • RubyConf China य़տᕟᕢᘏ •
Teahour.FM Ԇඎ • ংᇁ @lgn21st
[email protected]
None
౯ጱੜᆽঅ
ᬯฎӞӻӸᘾጱದय़տ
ಅզ౯ᥝ्กᛔ૩ጱᒈ࣋
ٿฎᚙᐶ࣋ว᧨ದ᮷ฎᘓၞ࿇
What’s New in Rails 5?
Rails API
Turbolinks 3
ActionCable
Real-time Web
Real-time Web ԏ᪠ • Polling • Long Polling / Comet
• Server-Sent Event (SSE) • XMPP҅Flash҅etc…
Polling
message_bus
Server-Sent Event
Server-Sent Event
Long Polling / Comet
WebSocket Protocol • W3C • පሲ
handshake over HTTP
GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade HTTP/1.1
101 Switching Protocols Upgrade: websocket Connection: Upgrade
පሲ҅පሲ҅ᬮฎ™පሲ
Ruby and WebSockets • Third-party Service / pusher.com • Stand-alone
server / Slanger • EventMachine + em-websocket • Faye
@igrigorik Author of em-websocket
None
faye-websocket • websocket-driver • eventmachine
em-websocket V.S. websocket-driver
ActionCable
"If you can make WebSockets even less work than polling,
why wouldn't you do it?” @DHH
Seamlessly integration with Rails
None
actioncable-examples
ActionCable Server • faye-websocket • Redis / em-hiredis • Celluloid
Under the hood • Authorization (Signed Cookie) • API •
Connection • Channel • Broadcast • PubSub
ActionCable Client Library • Create Consumer • Subscription • ConnectionMonitor
EventMachine or Celluloid
EventMachine ጱੴᴴ • ಅํጱྍձۓ᮷ׁᩢ EM.reactor_running • դᎱሾ્ॺ҅ᵙ҅ᵙٟ҅ᵙ᧣ᦶ • ྋᏟጱֵአ Defer
Celluloid
Tony Arcieri Author of Celluloid
Celluloid • Created at 2011 • Actor Model • Ecosystem
• Celluloid::IO • Reel::IO • DCell • Sidekiq
Threading is Hard
Scalability
࣋ว
None
Single Server • TCP/IP parameters • Maximum Number Of FD
• Memory / Network • Concurrent Model
One More Pit
None
ᘷଠޞ • Rubyist / ڹᒒ / ᑏۖᒒ / HR •
ᓌܲ᧗ݎ
[email protected]
ᨀᨀय़ਹ
ဌࠨଗᨵ ᥝӧߕڦ Q&A ԧމҘ