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
Scalable Architecture with RabbitMQ
Search
nownabe
November 24, 2015
Technology
2
720
Scalable Architecture with RabbitMQ
IDCFクラウドのバックエンドをMicroservicesで作って、各コンポーネント間の通信にRabbitMQを使っているという話。
nownabe
November 24, 2015
Tweet
Share
More Decks by nownabe
See All by nownabe
ナレッジワークの成長を加速する Platform Engineering 戦略
nownabe
0
260
Go で Cloud Logging を 使いこなすための slog 活用法
nownabe
1
2.2k
Other Decks in Technology
See All in Technology
What happened to RubyGems and what can we learn?
mikemcquaid
0
300
超初心者からでも大丈夫!オープンソース半導体の楽しみ方〜今こそ!オレオレチップをつくろう〜
keropiyo
0
110
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
260
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
470
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.5k
Frontier Agents (Kiro autonomous agent / AWS Security Agent / AWS DevOps Agent) の紹介
msysh
3
180
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
450
【Ubie】AIを活用した広告アセット「爆速」生成事例 | AI_Ops_Community_Vol.2
yoshiki_0316
1
110
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
190
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
BBQ
matthewcrist
89
10k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
320
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
54
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
240
Code Reviewing Like a Champion
maltzj
527
40k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
WCS-LA-2024
lcolladotor
0
450
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
70
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
120
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
Transcript
Scalable Architecture with RabbitMQ IDCϑϩϯςΟΞ UX։ൃ෦ ᬑঘޗ 2015/11/24
Slides’ URI https://speakerdeck.com/nownabe/scalable- architecture-with-rabbitmq
Who? ᬑঘޗ @nownabe Programmer Drummer
History 20134݄ IDCFೖࣾ 20137݄ ΧελϚʔαʔϏεຊ෦ϓϥοτϑΥʔϜαʔϏε෦Ϋϥυάϧʔϓ • Ϋϥυج൫ӡ༻ɾݕূ • αόϑΣε্ཱͪ͛ •
MBaaSαʔϏε։ൃ 20144݄ ٕज़։ൃຊ෦R&Dࣨ • MBaaSαʔϏε։ൃ • RDBαʔϏε։ൃ 20151݄ ٕज़։ൃຊ෦UX։ൃ෦ • RDBαʔϏε։ൃ • ϩʔυόϥϯαʔαʔϏε։ൃ (now!)
Favorites Ruby Itamae Ruboty React esa Daemon Chain Drive (double)
Aquiles Priester
Scalable Architecture with RabbitMQ
Γͷ Publish / Subscribe ͱ Microservices ͬͯΈͨ
Which service? ݱࡏ։ൃத IDCF Cloudͷ৽αʔϏε ϩʔυόϥϯαʔαʔϏεͷόοΫΤϯυ ͦΖͦΖʁϦϦʔε༧ఆ
What service? 7. 7. 7. … 4DBMBCMF #BDLFOE -# -#
… *%$'$MPVE $MPVE4UBDL ࡞ͬͨΓফͨ͠Γ ૿ͨ͠ΓݮΒͨ͠Γ ࢹͨ͠Γम෮ͨ͠Γ
8PSLFS … $POUSPMMFS … "1* … .POJUPS … -#OPEF -#OPEF
……… Scalable architecture
8PSLFS … $POUSPMMFS … "1* … .POJUPS … -#OPEF -#OPEF
……… Scalable architecture 3&45"1*ड͚Δͭ ࢹɾ՝ۚ͢Δͭ ࡞ͬͨΓফͨ͠Γ͢Δͭ ϩʔυόϥϯαʔຊମ ͍Ζ͍ΖΔͭ
Development style Ruby Github Qiita:Team Slack
Today’s topics ͢ RabbitMQ (Publish / Subscribe) Microservices ͞ͳ͍ RabbitMQͷෛՙࢄ/Խ
Monitoring (Sensu)
RabbitMQ
What is RabbitMQ? ϝοηʔδͷड৴ͱ৴ Advanced Message Queuing Protocol OSS࣮ Erlang
Why RabbitMQ? MicroservicesԽͰશ෦REST API͖͍ͭ ߴػೳ ୯ମͰಈ࡞͢Δ υΩϡϝϯτ͕ॆ࣮ͯͨ͠
Publish / Subscribe Producer (Publisher) Queueʹ৴ Consumer (Subscriber) Queue͔Βߪಡ Queue
✉ ✉ ✉ ✉ ✉ ✉ ✉ ✉ ✉
Exchange ϝοηʔδΛQueueʹୡ͢Δਓ ͍ͭ͜ͷ͓͔͛Ͱ৴ܦ࿏͕ॊೈ
Example: Fanout ✉ ✉ ✉ ✉ ✉ &YDIBOHF ✉ ඥͮͯ͘͢ͷ
Queueʹୡ
Example: Roundrobin ✉ &YDIBOHF ✉ ✉ ✉ ✉ ✉ ʮՋͳਓʹ৴ʯՄ
Example: RPC ✉ ✉ Request/Response (Exchangeলུ) ฦ৴༻Queue
More complecated routings ͔ͳΓෳࡶͳϧʔςΟϯάՄೳ
Microservices
8PSLFS … $POUSPMMFS … "1* … .POJUPS … -#OPEF -#OPEF
……… Components 3&45"1*ड͚Δͭ ࢹɾ՝ۚ͢Δͭ ࡞ͬͨΓফͨ͠Γ͢Δͭ ϩʔυόϥϯαʔຊମ ͍Ζ͍ΖΔͭ
Why microservices? ScalableͳઃܭΛٻΊΒΕͨ • CloudStack͕ҰຕؠͰεέʔϧ͠ʹ͍͘ઃܭ ֤ίϯϙʔωϯτͷׂׂ͕໌֬ͩͬͨ • ͋ΔఔͲ͏͚Ε͏·͍͖ͦ͘͏͔͔͍ͬͯͨ ΞδϟΠϧʹ׳Ε͍ͯͳ͍ •
ΥʔλʔϑΥʔϧͬΆ͘ॎׂΓ։ൃ
Our Microservices
API gateway ֎෦ϦΫΤετΛ࠷ॳʹॲཧ͢Δड REST APIΛఏڙ Ϣʔβͷೝূ ControllerʹϦΫΤετΛ͑Δ
Controller ͍Ζ͍Ζஅͯ͠ࢦࣔΛग़͢Ϙε ϝΠϯDBͱΓͱΓͰ͖Δ
Worker ࣮ࡍʹಇ͘࿑ಇऀ Controller͔ΒͷࢦࣔͰಇ͘ ඇಉظͰ͕͔͔࣌ؒΔॲཧΛ͜ͳ͢ ऴΘͬͨΒControllerʹใࠂ
Node agent LB nodeʹજΉΤʔδΣϯτ LB nodeͷॳظઃఆ Worker͔ΒͷࢦࣔͰίϚϯυΛ࣮ߦ ֤छϝτϦΫεΛMonitorʹใࠂ
Monitor ࢹ՝ۚॲཧΛߦ͏ݟுΓ Agent͔ΒͷϝτϦΫεΛूܭ Կ͔͋ΕControllerʹใࠂ
Via RabbitMQ શίϯϙʔωϯτ͕RabbitMQܦ༝ͰΓͱΓ 8PSLFS $POUSPMMFS /PEFBHFOU ࢦࣔ ࢦࣔ/ใࠂ ใࠂ ඇಉظ
ಉظ
Good
Scalable! εέʔϧΞτ͕؆୯ • ৽͍͠ίϯϙʔωϯτ͕ͭͳ͗ʹ͍͚ͩ͘ RabbitMQ͕ϘτϧωοΫʹͳΓಘΔʁ • ͠Β͘৺ͳͦ͞͏
RabbitMQ is nice ϧʔςΟϯά͕ॊೈ ͱָͯ: Pub/Subඇಉظॲཧ ͱָͯ: ෛՙࢄ • Producer/ConsumerࣗͰͭͳ͗ʹ͘Δ
• LBͰࢄ͠Α͏ͱ͢Δͱ…
Nice microservices ྑ͍ײ͡ʹίϯϙʔωϯτׂͰ͖ͨ • ׂෛՙ ֤୲ऀͰҰؾʹฒߦ։ൃͰ͖ͨ 1ڞ௨ͷRabbitMQ͕͋Ε݁߹ςετ؆୯ • ϩʔΧϧͱϩʔΧϧΛ؆୯ʹͭͳ͛Δ
Sensu ·͞ʹΫϥυ࣌ͷࢹπʔϧ ͍ͭ͜RabbitMQΛ͏ Pub/SubͰࢹ
Not Good
Bad microservices ͏·͘Θ͚ΒΕͳ͔ͬͨ෦ • MonitorͱControllerͰಉ͡DBΈͯΔ ίϯϙʔωϯτԣஅͰΈΔͱDRY͡Όͳ͍ ΠϯϑϥίετͰ͔͍ • ࣍ίϯςφԽ͍ͨ͠
RPC is not good RPC͍ͬͺ͍ͬͯΔ RabbitMQຊདྷRPC͢Δͷ͡Όͳ͍ ͦΕREST APIͰͰ͖ͳ͍ͷʁ • ͍ɺͰ͖·͢
Insufficient information ใ͕গͳ͍ ެࣜυΩϡϝϯτॆ࣮ • ӳޠΦϯϦʔ
Summary MicroservicesͱPub/SubͰScalableʹʂ✨ MicroservicesͱPub/Subͷ૬ੑΠΠʂ શ෦RabbitMQܦ༝Ͱͳ͘దࡐదॴʹʂʂ
Thank you for your attention MicroservicesͱPub/SubͰScalableʹʂ✨ MicroservicesͱPub/Subͷ૬ੑΠΠʂ શ෦RabbitMQܦ༝Ͱͳ͘దࡐదॴʹʂʂ