Pinterest: Bipartite Graph Sharding, PinJoin Realtime Feeds & Zen Graph Storage
How Pinterest models hundreds of billions of user pins and boards across Zen graph clusters, executing low-latency bipartite graph traversals for personalized image discovery.
Pinterest organizes its graph into Users, Pins, and Boards using Zen, an in-memory graph cache layered over sharded MySQL, paired with PinJoin for distributed graph-based candidate retrieval.
Bipartite Graph Partitioning by Board ID
300+ billion saved pins and 500M+ active visual search usersTraversing user-to-board and board-to-pin edges across hundreds of millions of nodes without multi-hop network round trips.
Shard the graph strictly by Board ID, co-locating all pin associations for a given board within the same storage shard and RAM cache partition.
Popular boards create hotspots that require secondary replication caching, but 98% of neighborhood traversals execute in a single local memory lookup.
When designing graph systems, choose a sharding key that co-locates the most frequent traversal query on a single shard.
Pinterest Engineering • 2022
Ready to Practice Pinterest-Style Systems?
Start with foundational networking, compute, and storage, and build up to complex distributed consensus.