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
660
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
94
Go で Cloud Logging を 使いこなすための slog 活用法
nownabe
1
1.3k
Other Decks in Technology
See All in Technology
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
310
LINEヤフーにおけるPrerender技術の導入とその効果
narirou
1
160
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
270
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
日経電子版のStoreKit2フルリニューアル
shimastripe
1
150
Taming you application's environments
salaboy
0
200
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
180
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
120
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.6k
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
複雑なState管理からの脱却
sansantech
PRO
1
160
Featured
See All Featured
Scaling GitHub
holman
458
140k
Git: the NoSQL Database
bkeepers
PRO
427
64k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Adopting Sorbet at Scale
ufuk
73
9.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
We Have a Design System, Now What?
morganepeng
50
7.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
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ܦ༝Ͱͳ͘దࡐదॴʹʂʂ