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
SRE新規立ち上げ! Hubbleインフラのこれまでと展望
katsuya0515
0
190
Tableau API連携の罠!?脱スプシを夢見たはずが、逆に依存を深めた話
cuebic9bic
3
220
「AIと一緒にやる」が当たり前になるまでの奮闘記
kakehashi
PRO
3
120
20250807 Applied Engineer Open House
sakana_ai
PRO
0
110
Claude Codeが働くAI中心の業務システム構築の挑戦―AIエージェント中心の働き方を目指して
os1ma
9
2.5k
Claude Codeは仕様駆動の夢を見ない
gotalab555
23
6.3k
MCP認可の現在地と自律型エージェント対応に向けた課題 / MCP Authorization Today and Challenges to Support Autonomous Agents
yokawasa
5
2.2k
生成AIによるデータサイエンスの変革
taka_aki
0
2.9k
隙間時間で爆速開発! Claude Code × Vibe Coding で作るマニュアル自動生成サービス
akitomonam
3
260
Amazon S3 Vectorsは大規模ベクトル検索を低コスト化するサーバーレスなベクトルデータベースだ #jawsugsaga / S3 Vectors As A Serverless Vector Database
quiver
1
200
2025新卒研修・HTML/CSS #弁護士ドットコム
bengo4com
3
13k
AWS re:Inforce 2025 re:Cap Update Pickup & AWS Control Tower の運用における考慮ポイント
htan
1
230
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Typedesign – Prime Four
hannesfritz
42
2.7k
How STYLIGHT went responsive
nonsquared
100
5.7k
A Tale of Four Properties
chriscoyier
160
23k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
YesSQL, Process and Tooling at Scale
rocio
173
14k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.5k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Designing for Performance
lara
610
69k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
880
Transcript
None
ActionCable, WebSocket and Scalability ݾࢵਘ
ᛔ౯Օᕨ • Ruby China ᐒ܄ᓕቘާ • RubyConf China य़տᕟᕢᘏ •
Teahour.FM Ԇඎ • ংᇁ @lgn21st lgn21st@gmail.com
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 •
ᓌܲ᧗ݎ hr@baoquan.com
ᨀᨀय़ਹ
ဌࠨଗᨵ ᥝӧߕڦ Q&A ԧމҘ