Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Ataleofqueuesfrom ActiveMQ over Hazelcast to Disque
Philipp Krenn @xeraa
Vienna
Vienna
Vienna
ViennaDB
Papers We Love Vienna
Electronic Data Interchange EDI
Automotive
Retail
Transmission&messageflow
AS2, X.400, OFTP2, FTP, SMTP, IMAP,
web services,...
Documentformat
EDIFACT, X12, ODETTE, VDA,...
Architecture
+--------+
| | +----+
| +--------+ | |
| | | | | |
| | +--------+ v +
| | | | | | +------------> Processing
+...
Flow
Camel component / protocol implementation
+ ^
| |
| |
v +
Camel routing
+ ^
| |
| |
v +
Queue
+ ^
| |
| |
v +
Process...
Queues
Decoupling producer and consumer
Networkedmessagequeueslike
ActiveMQ,RabbitMQ,ZeroMQ,anda
hostofotherJavainspiredsoftware
tumorsarecrutchesofsystemsdesign....
"TheBlockingConsumer"
"CollectingDatafor
OfflineProcessing"
"EverybodyLovesSystem
Complexity"
Thereareonlytwohardproblemsin
distributedsystems:
2.Exactly-oncedelivery
1.Guaranteedorderofmessages
2.Exactly-oncedeliver...
Order
It works like it would on a single
machine
http://book.mixu.net/distsys/time.html
Exactlyonce
Removal/ACK
Before processing: at-most-once
A!er processing: at-least-once
At-most-once
Requires strict consistency with
communication overhead
Replicated messages and liveness
Network split — majo...
At-least-once
Easier to distribute
Idempotent consumption
Timeout tuning
http://antirez.com/news/78
antirez 430 days ago
Cheating
Order
Cheating
1. Receive
2a. Persist in RDS (MySQL)
2b. Camel routing + queue
3. Acknowledge
Goals
Reliability
Liveness
At-most-once
Machines
Wait
Retry
AmazonSimpleQueue
Service(SQS)
Fast, reliable, scalable, and fully
managed
But...
At-least-once
64KB (now 256KB) payload
MasterSlave
Shared file system
JDBC
Replicated LevelDB
+ ZooKeeper
<bean id="mysql-ds" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass"...
RDSdown!
In-memorydatagridSet, list, map, queue, topic, lock,
atomic long,...
Query, aggregate, MapReduce
Hibernate 2nd level cache...
Eierlegende
Wollmilchsau
"egg-layingwool-
milk-sow"
Great
Does everything for Java apps
Multi-master HA
Fast
Badfeeling
Very few queue users
Bugs with IP / DNS changes
Painful upgrades
Currentlyouractionistocreate
bugforthesescenariosandtryto
ensureexactly-once.
— Enes Akar, https://groups.google.com/forum...
Kafka
Real-time focus
At-least-once
https://cwiki.apache.org/confluence/display/KAFKA/Idempotent
+Producer
Kestrel
Dead !
RabbitMQ
Too much middleware
Intheeventofnetworkfailure
(oranodecrashing),messages
canbeduplicated,andconsumers
mustbepreparedtohandlethem.
— https://w...
[...]noonetrytouseNRedis
independentnodesandthe
offeredprimitivesasabuilding
blockforadistributedsystem[...]
— Salvatore S...
Disque,anin-memory,
distributedjobqueue
— https://github.com/antirez/disque
Great
Documentation
Does one thing
Multi-master HA
Configurable ACK
Similar to Redis
Driver:Spinach
"A scalable Java Disque client" based
on lettuce, "A scalable Java Redis
client"
!!
Some teething problems
CurrentconfigurationPer message
Replication factor: 1
Retry time: 0
No persistence
Currentuse
Billing since 07/2015
Full ActiveMQ replacement soon?
WARNING:ThisisalphacodeNOT
suitableforproduction.
— https://github.com/antirez/disque
Nobodylikesqueues
Thankyou!
Questions?!
@xeraa
ImageCredit
· Schnitzel https://flic.kr/p/9m27wm
· Architecture https://flic.kr/p/6dwCAe
· Conchita https://flic.kr/p/nBqS...
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
Nächste SlideShare
Wird geladen in …5
×

A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn

1.549 Aufrufe

Veröffentlicht am

After all the attention databases have been getting over the last years, it is high time to give some thought to queues. We will kick off with some considerations why you need queues in distributed systems and what their limitations are — in particular the at-least-once and at-most-once decision. Next we discuss our specific use case and why * we started off with ActiveMQ, * it's working ok for us, * we are looking for a better solution. While looking for a better solution, we considered Amazon SQS and RabbitMQ, but finally selected Hazelcast — which seemed to do everything for us. After the initial phase of enchantment, we came to realize that Hazelcast is actually not the right tool for us and why we do not want to fully rely on it. Luckily, Disque has just been released and looks really promising. And we have already started migrating to it, even though it's currently marked as alpha code.

Veröffentlicht in: Daten & Analysen
  • Als Erste(r) kommentieren

A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn

  1. 1. Ataleofqueuesfrom ActiveMQ over Hazelcast to Disque Philipp Krenn @xeraa
  2. 2. Vienna
  3. 3. Vienna
  4. 4. Vienna
  5. 5. ViennaDB Papers We Love Vienna
  6. 6. Electronic Data Interchange EDI
  7. 7. Automotive Retail
  8. 8. Transmission&messageflow AS2, X.400, OFTP2, FTP, SMTP, IMAP, web services,... Documentformat EDIFACT, X12, ODETTE, VDA,...
  9. 9. Architecture +--------+ | | +----+ | +--------+ | | | | | | | | | | +--------+ v + | | | | | | +------------> Processing +-|-|----+ | | + | | | | | +-|------+ | | | | <--------------+ +--------+ Connectors
  10. 10. Flow Camel component / protocol implementation + ^ | | | | v + Camel routing + ^ | | | | v + Queue + ^ | | | | v + Processing
  11. 11. Queues Decoupling producer and consumer
  12. 12. Networkedmessagequeueslike ActiveMQ,RabbitMQ,ZeroMQ,anda hostofotherJavainspiredsoftware tumorsarecrutchesofsystemsdesign. — Ted Dziuba, http://widgetsandshit.com/teddziuba/2011/02/the-case- against-queues.html
  13. 13. "TheBlockingConsumer"
  14. 14. "CollectingDatafor OfflineProcessing"
  15. 15. "EverybodyLovesSystem Complexity"
  16. 16. Thereareonlytwohardproblemsin distributedsystems: 2.Exactly-oncedelivery 1.Guaranteedorderofmessages 2.Exactly-oncedelivery — Mathias Verraes, https://twitter.com/mathiasverraes/status/ 632260618599403520
  17. 17. Order It works like it would on a single machine http://book.mixu.net/distsys/time.html
  18. 18. Exactlyonce
  19. 19. Removal/ACK Before processing: at-most-once A!er processing: at-least-once
  20. 20. At-most-once Requires strict consistency with communication overhead Replicated messages and liveness Network split — majority
  21. 21. At-least-once Easier to distribute Idempotent consumption Timeout tuning
  22. 22. http://antirez.com/news/78 antirez 430 days ago
  23. 23. Cheating Order
  24. 24. Cheating 1. Receive 2a. Persist in RDS (MySQL) 2b. Camel routing + queue 3. Acknowledge
  25. 25. Goals Reliability Liveness At-most-once
  26. 26. Machines Wait Retry
  27. 27. AmazonSimpleQueue Service(SQS) Fast, reliable, scalable, and fully managed
  28. 28. But... At-least-once 64KB (now 256KB) payload
  29. 29. MasterSlave Shared file system JDBC Replicated LevelDB + ZooKeeper
  30. 30. <bean id="mysql-ds" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://{{rds_hostname}}: 3306/{{rds.activemq.database}}?relaxAutoCommit=true"/> <property name="user" value="{{rds.activemq.user}}"/> <property name="password" value="{{rds.activemq.pass}}"/> <property name="acquireRetryAttempts" value="100"/> <property name="testConnectionOnCheckout" value="true"/> <property name="testConnectionOnCheckin" value="false"/> <property name="idleConnectionTestPeriod" value="3600"/> <property name="maxStatements" value="0"/> <property name="minPoolSize" value="2"/> <property name="maxPoolSize" value="20"/> <property name="maxIdleTimeExcessConnections" value="600"/> <property name="numHelperThreads" value="6"/> <property name="acquireRetryDelay" value="5000"/> <property name="maxConnectionAge" value="10800"/> <property name="preferredTestQuery" value="SELECT 1;"/> </bean>
  31. 31. RDSdown!
  32. 32. In-memorydatagridSet, list, map, queue, topic, lock, atomic long,... Query, aggregate, MapReduce Hibernate 2nd level cache, session replication
  33. 33. Eierlegende Wollmilchsau
  34. 34. "egg-layingwool- milk-sow"
  35. 35. Great Does everything for Java apps Multi-master HA Fast
  36. 36. Badfeeling Very few queue users Bugs with IP / DNS changes Painful upgrades
  37. 37. Currentlyouractionistocreate bugforthesescenariosandtryto ensureexactly-once. — Enes Akar, https://groups.google.com/forum/#!msg/hazelcast/ u_KLHVnvT_U/Qx5Km8COk_oJ
  38. 38. Kafka Real-time focus At-least-once https://cwiki.apache.org/confluence/display/KAFKA/Idempotent +Producer
  39. 39. Kestrel Dead !
  40. 40. RabbitMQ Too much middleware
  41. 41. Intheeventofnetworkfailure (oranodecrashing),messages canbeduplicated,andconsumers mustbepreparedtohandlethem. — https://www.rabbitmq.com/reliability.html
  42. 42. [...]noonetrytouseNRedis independentnodesandthe offeredprimitivesasabuilding blockforadistributedsystem[...] — Salvatore Sanfilippo, http://antirez.com/news/78
  43. 43. Disque,anin-memory, distributedjobqueue — https://github.com/antirez/disque
  44. 44. Great Documentation Does one thing Multi-master HA Configurable ACK Similar to Redis
  45. 45. Driver:Spinach "A scalable Java Disque client" based on lettuce, "A scalable Java Redis client"
  46. 46. !! Some teething problems
  47. 47. CurrentconfigurationPer message Replication factor: 1 Retry time: 0 No persistence
  48. 48. Currentuse Billing since 07/2015 Full ActiveMQ replacement soon?
  49. 49. WARNING:ThisisalphacodeNOT suitableforproduction. — https://github.com/antirez/disque
  50. 50. Nobodylikesqueues
  51. 51. Thankyou! Questions?! @xeraa
  52. 52. ImageCredit · Schnitzel https://flic.kr/p/9m27wm · Architecture https://flic.kr/p/6dwCAe · Conchita https://flic.kr/p/nBqSHT · Paper https://flic.kr/p/83thLf · Airli! https://commons.wikimedia.org/wiki/File:C-54landingattemplehof.jpg · Beer https://flic.kr/p/aBSmtY · Gum https://flic.kr/p/ALQ3b · Eierlegende Wollmilchsau https://flic.kr/p/GzQTT · British https://flic.kr/p/hzxLvw

×