Design: Social Graph Storage System
Design focuses on storage and query of social graph connections. User authentication, UI, and recommendation algorithms are out of scope.
Functional Requirements
FR1: Store user profiles and their connections (friends, followers).
FR2: Support adding and removing connections between users.
FR3: Efficiently query direct connections of a user.
FR4: Support querying mutual connections between two users.
FR5: Handle up to 100 million users and 10 billion connections.
FR6: Provide low latency queries (p99 < 100ms) for connection lookups.
FR7: Ensure data consistency for connection updates.
FR8: Support eventual consistency for large-scale replication.
Non-Functional Requirements
NFR1: Scale to 100 million users and 10 billion edges.
NFR2: API response latency p99 under 100ms for read queries.
NFR3: Availability target 99.9% uptime (about 8.77 hours downtime/year).
NFR4: Data storage must be cost-effective and scalable.
NFR5: Support horizontal scaling for both reads and writes.
