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
710
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
230
Go で Cloud Logging を 使いこなすための slog 活用法
nownabe
1
2k
Other Decks in Technology
See All in Technology
やる気のない自分との向き合い方/How to Deal with Your Unmotivated Self
sanogemaru
0
440
Trust as Infrastructure
bcantrill
1
370
Adminaで実現するISMS/SOC2運用の効率化 〜 アカウント管理編 〜
shonansurvivors
4
420
Geospatialの世界最前線を探る [2025年版]
dayjournal
0
180
Optuna DashboardにおけるPLaMo2連携機能の紹介 / PFN LLM セミナー
pfn
PRO
2
930
セキュアな認可付きリモートMCPサーバーをAWSマネージドサービスでつくろう! / Let's build an OAuth protected remote MCP server based on AWS managed services
kaminashi
3
240
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
230
リーダーになったら未来を語れるようになろう/Speak the Future
sanogemaru
0
360
Vibe Coding Year in Review. From Karpathy to Real-World Agents by Niels Rolland, CEO Paatch
vcoisne
0
110
【Kaigi on Rails 事後勉強会LT】MeはどうしてGirlsに? 私とRubyを繋いだRail(s)
joyfrommasara
0
200
許しとアジャイル
jnuank
1
140
Findy Team+のSOC2取得までの道のり
rvirus0817
0
500
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
How GitHub (no longer) Works
holman
315
140k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Producing Creativity
orderedlist
PRO
347
40k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Being A Developer After 40
akosma
91
590k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
590
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Optimizing for Happiness
mojombo
379
70k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
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ܦ༝Ͱͳ͘దࡐదॴʹʂʂ