Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
620
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
400
Other Decks in Technology
See All in Technology
Kiro を用いたペアプロのススメ
taikis
2
570
AI駆動開発における設計思想 認知負荷を下げるフロントエンドアーキテクチャ/ 20251211 Teppei Hanai
shift_evolve
PRO
2
430
SQLだけでマイグレーションしたい!
makki_d
0
1.1k
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
1
530
WordPress は終わったのか ~今のWordPress の制作手法ってなにがあんねん?~ / Is WordPress Over? How We Build with WordPress Today
tbshiki
2
840
OCI Oracle Database Services新機能アップデート(2025/09-2025/11)
oracle4engineer
PRO
1
210
AWS運用を効率化する!AWS Organizationsを軸にした一元管理の実践/nikkei-tech-talk-202512
nikkei_engineer_recruiting
0
120
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1k
Reinforcement Fine-tuning 基礎〜実践まで
ch6noota
0
190
MLflowダイエット大作戦
lycorptech_jp
PRO
1
140
re:Invent2025 コンテナ系アップデート振り返り(+CloudWatchログのアップデート紹介)
masukawa
0
390
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
920
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
45
BBQ
matthewcrist
89
9.9k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
160
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
57
37k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
110
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.1k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
310
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
29
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandezseo
1
1.3k
Designing Experiences People Love
moore
143
24k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
250
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 ԧމҘ