Problem
Coinbase has grouped users by shared attributes since 2015. The first system kept about 150 million precomputed clusters in a NoSQL database, some with over 50,000 nodes. Every attribute change, such as a user adding or removing a bank account, forced a create, merge or delete on clusters. The workload is write-heavy, so precomputation cost more than it saved. Performance dropped, storage grew, and workers hit race conditions that left clusters inconsistent. Each team also needed its own definition of "similar", which meant new precomputed clusters and onboarding work.
Example from the article: one service clustered users by IP address, SSN and phone number, while another used SSN, phone number and payment methods.
Solution in brief
Stop storing clusters. Store users and their attributes as a graph and compute the related users at query time, for whichever attributes the caller names. A change to an attribute touches one edge instead of rewriting clusters, and any new definition of similarity is just a different query.
Questions this case answers
- How to group entities by shared identifiers when the identifiers change often and each consumer defines similarity differently, so precomputed groups need constant merges and splits
- How to make the reason for a link between two entities visible to an investigator who has to debug a decision
- How to find accounts that share a bank account, SSN, phone number or address with a given account?
- How to let several teams define 'related users' differently without precomputing a cluster set for each definition?
Tools and methods
- Graph database (Amazon Neptune) — stores users and attributes as nodes and "has-attribute" relations as edges.
- get-related-users API — runs a runtime query for users who share an attribute value with a source user.
- Graph visualization — shows an analyst which attributes link a group of users.
- Event-driven ingestion — a data ingestor consumes events from domain services and updates the graph.
Google or a one-time email code. No password.