Building queues on distributed data stores is hard, and long been considered an antipattern. However, with careful consideration and tactics, it is possible to do. CassieQ is an implementation of a distributed queue on Cassandra which supports easy installation, massive data ingest, authentication, a simple to use HTTP based API, and no dependencies other than your already existing Cassandra environment.
About the Speakers
Anton Kropp Senior Software Engineer, Curalate
Anton Kropp is a senior engineer with over 8 years experience building distributed and fault tolerant systems. He has worked at companies big and small (Godaddy, PracticeFusion), and enjoys building frameworks and tooling to make life easier with a penchant for dockerized containers and simple API's. When he's not messing around on his computer he's drinking local Seattle beers, zipping around the city on his electric bike, and hanging out with his wife and dog.
20. All 3 pointers point to monotonic id value, potentially in different
buckets
1 2 3 4 5
InvisPointer ReaderPointer
RepairPointer
Pointers to Buckets
25. 1 2 ? 4 5
Buckets… complications
• Once a monoton is generated, it is taken
• Even if a message fails to insert the monoton is taken
• Buckets are now partially filled!
• How to resolve?
26. 1 2 ? 4 5 6
Bucket 2Bucket 1
Reader
Message 3
missing
When to move off a bucket?
1. All known messages in the bucket have been delivered at least once
2. All new messages being written in future buckets
27. 1 2 ? 4 5 6 7 …
Bucket 2Bucket 1
Reader @
bucket 2
Message 3
missing
Tombstone
When to move off a bucket?
• Tombstoning (not cassandra tombstoning, naming is hard!)
• Bucket is sealed, no more writes
• Reader tombstones bucket after its reached
40. The happy path
• Client consumes message
• Message is marked as “invisible” with a “re-visibility” timestamp
• Client gets pop receipt encapsulating metadata (including version)
• Client acks within timeframe
• Message marked as consumed if version is the same
41. The unhappy path :(
• Client doesn’t ack within timeframe
• Message needs to be redelivered
• Subsequent reads checks the invis pointer for visibility
• If max delivers exceeded, push to optional DLQ
• Else redeliver!
45. Long term invisibility is bad
• InvisPointer WILL NOT move past a unacked message
• Invisible messages can block other invisible messages
• Possible to starve future messages