Slide 1

Slide 1 text

A tale of queues from ActiveMQ over Hazelcast to Disque Philipp Krenn̴̴̴̴̴̴̴̴̴̴@xeraa

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Infrastructure | Developer Advocate

Slide 6

Slide 6 text

ViennaDB Papers We Love Vienna

Slide 7

Slide 7 text

Electronic Data Interchange

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Automotive Retail

Slide 10

Slide 10 text

Transmission & Message Flow AS2, X.400, OFTP2, FTP, SMTP, IMAP, web services,...

Slide 11

Slide 11 text

Document format EDIFACT, X12, ODETTE, VDA,...

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Queues Decoupling producer and consumer

Slide 18

Slide 18 text

!

Slide 19

Slide 19 text

!

Slide 20

Slide 20 text

Networked message queues like ActiveMQ, RabbitMQ, ZeroMQ, and a host of other Java inspired software tumors are crutches of systems design. — Ted Dziuba, http://widgetsandshit.com/teddziuba/2011/02/the-case- against-queues.html

Slide 21

Slide 21 text

"The Blocking Consumer"

Slide 22

Slide 22 text

"Collecting Data for Offline Processing"

Slide 23

Slide 23 text

"Everybody Loves System Complexity"

Slide 24

Slide 24 text

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery — Mathias Verraes, https://twitter.com/mathiasverraes/status/632260618599403520

Slide 25

Slide 25 text

Order As if it was on a single machine http://book.mixu.net/distsys/time.html

Slide 26

Slide 26 text

http://blog.acolyer.org/2016/02/26/distributed-consistency-and- session-anomalies/

Slide 27

Slide 27 text

Exactly once

Slide 28

Slide 28 text

Removal / ACK Before processing: at-most-once A!er processing: at-least-once

Slide 29

Slide 29 text

At-most-once Requires strict consistency with communication overhead Network split — majority

Slide 30

Slide 30 text

At-least-once Easier to distribute Idempotent consumption Timeout tuning

Slide 31

Slide 31 text

Queues and databases Salvatore Sanfilippo 870 days ago, http://antirez.com/news/78

Slide 32

Slide 32 text

Cheating Order

Slide 33

Slide 33 text

Cheating 1. Receive 2a. Persist in RDS (MySQL) 2b. Camel routing + queue 3. Acknowledge

Slide 34

Slide 34 text

Goals Reliability Liveness At-most-once

Slide 35

Slide 35 text

Machines Wait Retry

Slide 36

Slide 36 text

Amazon Simple Queue Service (SQS) Fast, reliable, scalable, and fully managed

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

But At-least-once 64KB (now 256KB and 2GB on S3) payload

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Master Slave Shared file system JDBC Replicated LevelDB + ZooKeeper

Slide 41

Slide 41 text

true 10000 10000 true

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

RDS down !

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

In-memory data grid Set, list, map, queue, topic, lock, atomic long,... Query, aggregate, MapReduce Hibernate 2nd level cache, session replication

Slide 47

Slide 47 text

Eierlegende Wollmilchsau

Slide 48

Slide 48 text

"egg-laying wool- milk-sow"

Slide 49

Slide 49 text

Great Does everything for Java apps Multi-master HA Fast

Slide 50

Slide 50 text

Bad feeling Very few queue users Bugs with IP / DNS changes Painful upgrades

Slide 51

Slide 51 text

Currently our action is to create bug for these scenarios and try to ensure exactly-once. — Enes Akar, https://groups.google.com/forum/#!msg/hazelcast/ u_KLHVnvT_U/Qx5Km8COk_oJ

Slide 52

Slide 52 text

Kafka Real-time focus At-least-once https://cwiki.apache.org/confluence/display/KAFKA/ Idempotent+Producer

Slide 53

Slide 53 text

Kestrel Dead !

Slide 54

Slide 54 text

RabbitMQ Too much middleware

Slide 55

Slide 55 text

In the event of network failure (or a node crashing), messages can be duplicated, and consumers must be prepared to handle them. — https://www.rabbitmq.com/reliability.html

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

[...] no one try to use N Redis independent nodes and the offered primitives as a building block for a distributed system [...] — Salvatore Sanfilippo, http://antirez.com/news/78

Slide 58

Slide 58 text

Disque, an in-memory, distributed job queue — https://github.com/antirez/disque

Slide 59

Slide 59 text

Great Does one thing Multi-master HA Configurable ACK Similar to Redis

Slide 60

Slide 60 text

Driver: Spinach "A scalable Java Disque client" based on Lettuce, "A scalable Java Redis client"

Slide 61

Slide 61 text

Mark Paluch https://github.com/mp911de

Slide 62

Slide 62 text

!

Slide 63

Slide 63 text

Current configuration Per message Replication factor: 1 Retry time: 0 No persistence

Slide 64

Slide 64 text

WARNING: This is beta code and may not be suitable for production usage. — https://github.com/antirez/disque

Slide 65

Slide 65 text

Disque 1.0 RC1 is out! — Salvatore Sanfilippo 333 days ago, http://antirez.com/news/100

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Back to Redis?

Slide 69

Slide 69 text

Conclusion

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

Options Disque (Redis) ActiveMQ Kafka RabbitMQ Hazelcast SQS

Slide 76

Slide 76 text

Thank you! Questions?! @xeraa

Slide 77

Slide 77 text

Image Credit · Schnitzel https://flic.kr/p/9m27wm · Architektur https://flic.kr/p/6dwCAe · Conchita https://flic.kr/p/nBqSHT · Papier https://flic.kr/p/83thLf · Lu!brücke https://commons.wikimedia.org/wiki/File:C-54landingattemplehof.jpg · Bier https://flic.kr/p/aBSmtY · Gum https://flic.kr/p/ALQ3b · Eierlegende Wollmilchsau https://flic.kr/p/GzQTT · Li! https://flic.kr/p/iBNr9x