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
Skaliranje distribuiranih aplikacija uz pomoć A...
Search
Goran Jurić
October 26, 2013
Programming
0
250
Skaliranje distribuiranih aplikacija uz pomoć AMQP-a
Goran Jurić
October 26, 2013
Tweet
Share
More Decks by Goran Jurić
See All by Goran Jurić
HAProxy
gjuric
0
1.3k
Doctrine 2
gjuric
0
240
Capistrano iliti kako Rubyem deployati PHP kod
gjuric
0
210
Other Decks in Programming
See All in Programming
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Zoneless Testing
rainerhahnekamp
0
120
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
ドメインイベント増えすぎ問題
h0r15h0
1
120
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.4k
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
layerx_20241129.pdf
kyoheig3
2
290
Featured
See All Featured
Scaling GitHub
holman
458
140k
BBQ
matthewcrist
85
9.4k
Optimising Largest Contentful Paint
csswizardry
33
3k
Building Your Own Lightsaber
phodgson
103
6.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Visualization
eitanlees
146
15k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
KATA
mclloyd
29
14k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
Skaliranje distribuiranih aplikacija uz pomoć AMQP-‐a Goran
Jurić Webcamp, Zagreb, 2013.
Problem • razmjena podataka između različitih sustava i platformi
• deseci tisuća poruka / sekundi • asinkrono (fire & forget)
Riješenje? • SOAP, REST ? – Ne postoji nativni queing
mehanizam – Zahtijeva poslužitelj na svakoj strani koja prima poruke – Tko odlučuje gdje pojedina poruka mora završiti? – blocking – Što s djelomično isporučenim porukama?
Alternative • Push vs pull • Job queueovi (dostupnost
klijenata, nedostatak naprednih mogućnosti) – Gearman – Resque – Celery – ...
AMQP • Advanced Message Queuing Protocol • Protokol za
razmjenu i queueing poruka • Otvoren standard • OASIS (v1.0)
Tko koristi AMQP • Njemačka burza • JPMorgan •
NASA • RedHat • VMWare • Mozilla • AT&T • NASA • Openstack • Google
Software • Serveri – SwiftMQ – Apache QPID – Apache ActiveMQ – RabbitMQ
RabbitMQ • Erlang aplikacija • Klijenti dostupni u svim
poznatijim programskim jezicima • Web GUI plugin
Nomenklatura • Poruka • Producer • Consumer • Broker
(AMQP server)
Arhitektura
Arhitektura • Connection (TCP) – Jedna konekcija prema brokeru •
Channel – Više kanala prema Exchange-u
Broker • Exchange – Mjesto dostave poruka – Svaka poruka ima
routing ključ • Bindings – Povezuju Echange i Qeue preko binding ključa • Queue – Odredište poruka – Consumer subscribe
Exchange types • Direct • Default • Fanout •
Topic • Header
Direct Exchange • Svaka poruka ima routing ključ •
Queue X se binda na exchange koristeći ključ K • Poruka se dostavlja u Queue X ukoliko je dostavljena na zadani exchange i ima routing ključ K
Default Exchange • Default exchange nema ime • Svaki
kreirani queue je bindan na defaultni exchange preko imena queuea
Fanout Exchange • Poruka se dostavlja u svaki bindani
queue • Ignorira se routing ključ • Idealno za broadcast
Topic Exchange • Dostavlja poruku u jedan ili više
queuova u ovisnosti o routing ključu • Binding ključ – * jedna riječ – # nula ili više riječi – Bez * i # kao Direct exchange
Topic Exchange
RPC • reploy_to header • Client – Privremeni, anonimni i
ekskluzivni queue – Bez exchangea – Routing ključ = ime queue
RPC
Durability • Exchange durability • Queue durability • Message
persistence
Oprez! • Uvijek declareati exchange i queue prije slanja
ili primanja poruka • Persistentcija poruka – Klasična – Transakcijska !!! – Publisher confirm
Priprema
Publisher
Consumer
Enkodiranje poruka • binary blob • serijalizacija • JSON
• MsgPack • XML • Protocol Buffers
Ostalo • Virtual hosts • Visualiser plugin • HTTP
API • HA clustering • Flow control – Per connection – Memory – Disk
Web GUI
Alternativa AMQP-u • ZeroMQ – Low level alternativa – Web scale
(50-100x brži) – TCP sockets na steroidima
Osobna iskustva • 185 poslužitelja • ~ milijardu poruka
u zadnjih 10 mjeseci • 0 crashes • 0 downtime • 0 lost messages
Kontakt •
[email protected]
• @goran_juric