Design a local activity counter service
Company: Stripe
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design a system that counts local application activities and operations per user, device, and region with high write throughput and near-real-time reads. Define APIs such as increment(key, timestamp), getCount(key), getCount(key, timeWindow), and getUniqueActors(key, window). Address idempotency and deduplication, exactly-once vs at-least-once tradeoffs, time-windowed aggregations (sliding and tumbling), hot-key sharding, storage choices (e.g., write-optimized store plus aggregation layers), offline client buffering and sync, retention and TTL, backfill and reprocessing, privacy considerations, and monitoring and alerting. Provide a capacity estimate and describe failure modes and mitigations.
Quick Answer: This question evaluates a candidate's skills in designing large-scale distributed systems, focusing on near-real-time ingestion and aggregation, idempotency/deduplication, time-windowed (tumbling and sliding) analytics, hot-key sharding, storage and backfill strategies, and operational concerns including monitoring and privacy.