Social comment consistency across replicas

DesignHard45 minMeta style

Your task

Design the comment + reply system for a social network where a user must always see their own newly posted reply immediately, and must never see a reply to a comment before seeing the comment it replies to. Scale: 500M DAU, reads 100x writes, comments served from geo-distributed read replicas with replication lag up to several seconds. Strong global consistency is too expensive. Which consistency model do you pick, and how do you enforce it end to end?

It covers

  • Causal consistency
  • Read your writes
  • Session guarantees