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
240
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
230
Capistrano iliti kako Rubyem deployati PHP kod
gjuric
0
200
Other Decks in Programming
See All in Programming
為醫療加裝Python的引擎
cclai999
0
270
Pythonによるイベントソーシングへの挑戦と現状に対する考察 / Challenging Event Sourcing with Python and Reflections on the Current State
nrslib
3
850
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
180
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
0
130
sqlcを利用してsqlに型付けを
kamiyam
0
220
CSC509 Lecture 01
javiergs
PRO
1
200
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
2
170
CDKを活用した 大規模コンテナ移行 プロジェクトの紹介
yoyoyopg
0
230
Cloud Adoption Frameworkにみる組織とクラウド導入戦略(縮小版)
tomokusaba
1
120
Go製CLIツールGatling Commanderによる負荷試験実施の自動化
okmtz
3
640
Composing an API the *right* way (Droidcon New York 2024)
zsmb
2
540
Compose Multiplatform과 Ktor로 플랫폼의 경계를 넘어보자
kwakeuijin
0
200
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
450k
Designing for Performance
lara
604
68k
Designing the Hi-DPI Web
ddemaree
279
34k
Designing for humans not robots
tammielis
249
25k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.5k
Code Review Best Practice
trishagee
62
16k
A better future with KSS
kneath
235
17k
How GitHub (no longer) Works
holman
310
140k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
230
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
No one is an island. Learnings from fostering a developers community.
thoeni
19
2.9k
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