In this talk, we will discuss Happn's war story about migrating a Cassandra 2.1 cluster containing more than 68 Billion records in a counter table to ScyllaDB Open Source.
To watch all of the recordings hosted during Scylla Summit 2022 visit our website here: https://www.scylladb.com/summit.
What Are The Drone Anti-jamming Systems Technology?
Scylla Summit 2022: How to Migrate a Counter Table for 68 Billion Records
1. How to Migrate a
Counter Table for 68
Billion Records
Robert Czupioł
Senior Platform Engineer
YOUR COMPANY
LOGO HERE
2. Robert Czupioł
■ Cassandra Certified Expert since 2015
■ Introduce/Manage C*/Scylla in different companies
■ Attendee at first Scylla Summit 2016
■ and 2017, 2018… :)
Senior Platform Engineer
YOUR
COMPANY
LOGO HERE
YOUR
PHOTO
GOES HERE
3. ■ Dating App
■ Top-3 in West Europe
■ +100M Customers
■ 9 Scylla Clusters (in past 16 Cassandra)
■ +200TB Data
■ avg 300k req/sec
Find the people you've crossed paths with
4. Decision
In May 2021, let migrate to ScyllaDB
■ Targets
• TCO
• Technical dept
• Data volumen
• Latency
• Monitoring
9. Different strategies
■ CSV
• CQLSH/DSBULK (Writetime issue)
■ SSTable
• SStableLoader (cluster stress)
• Nodetool refresh (imo best with Network Disks)
■ Dual Connect
• Scylla migrator (spark cluster)
• Own application
10. Counter table
■ Out of Idempotent rule
■ Only update
■ Weird delete approach
■ Different implementation in past (local and remote shards)
■ Without USING Timestamp
■ Without TTL
■ Not accurate
12. How counter works
■ Create dedicated node-counter-id (shard) for each node [RF=2]
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 0 0
B_1 1 1
NODE A
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 0 0
B_1 1 1
NODE B
13. Update operation
■ On node B increment by 2
■ Read the previous shard value
■ Generate the newest logical clock
■ Save new value and send to replica
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 0 0
B_1 2 3
NODE A
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 0 0
B_1 2 3
NODE B
Node B increment by 2
14. Update operations
■ On node A decrement by 5
■ Read the previous shard value
■ Generate the newest logical clock
■ Save new value and send to replica
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 1 -5
B_1 2 3
NODE A
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 1 -5
B_1 2 3
NODE B
Node A decrement by 5
15. Update operations
■ On node A decrement by 5
■ Read the previous shard value
■ Generate the newest logical clock
■ Save new value and send to replica
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 1 -5
B_1 2 3
NODE A
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 1 -5
B_1 2 3
NODE B
Node A decrement by 5
16. Read operations
■ While reading nodes merge the value from each shards
Value = 3 + (-5) = -2
Node
counter id
Shard’s
logical clock
Shard’s
value
A_1 1 -5
B_1 2 3
23. Counter-migrator
■ Java
• All ųs were written in that language
• Well known
■ Spread token ring
• 6144 ranges
• select * from table where token(a) >= ? and token(a) < ?
■ Compare and set