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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
620
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
940
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
4
1.3k
Digitization部 紹介資料
sansan33
PRO
1
6.8k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
140
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
170
~Everything as Codeを諦めない~ 後からCDK
mu7889yoon
3
380
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.5k
生成AIを活用した音声文字起こしシステムの2つの構築パターンについて
miu_crescent
PRO
2
200
SREチームをどう作り、どう育てるか ― Findy横断SREのマネジメント
rvirus0817
0
260
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1.1k
A Soul's Torment
seathinner
5
2.3k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
330
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Amusing Abliteration
ianozsvald
0
100
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
Fireside Chat
paigeccino
41
3.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
76
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
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 ԧމҘ