Design a Global Marketing Email Platform
StubHubSoftware Engineer · OnsiteLast updated
This problem tests your ability to design a high-throughput, fault-tolerant email delivery system that handles scheduling across time zones, manages email templates, and provides basic analytics.
Scenario
Design a global marketing email platform for a large-scale ticket marketplace. The platform must be capable of sending millions of emails daily, ensuring that users receive promotional content at an appropriate local time, supporting A/B testing for email subjects/templates, and tracking basic metrics (opens and clicks).
Requirements
Functional
- Schedule emails to be sent at specific local times for users in different time zones.
- Support dynamic content injection based on user data.
- Track open rates and link clicks.
- Provide A/B testing capabilities for different email versions.
Non-Functional
- High Availability: The system should not lose email requests.
- Scalability: Support sending 10 million emails per day, with spikes during event announcements.
- Low Latency: Tracking clicks should not negatively impact the user experience.
Discussion Points
- Define the high-level architecture including the API layer, scheduling service, and delivery workers.
- Describe the data model for storing email templates, user preferences, and tracking logs.
- Explain how you would handle failures (e.g., third-party SMTP provider downtime) and prevent duplicate sends.
- Detail the strategy for handling A/B test routing and analytical aggregation.
Hints
Hint 1
Consider using a distributed message queue to decouple the scheduling of an email from the actual delivery process.
Hint 2
For global time-zone scheduling, store user preferences with an offset and use a bucketing strategy to batch work for the delivery workers.
Hint 3
Use a tracking pixel or unique URL redirects to capture email opens and link clicks without burdening the primary application database.
Follow-up questions
- How would you ensure that a user who has unsubscribed does not receive emails even if they were scheduled previously?
- If the third-party email service provider is rate-limiting your requests during a spike, how would you implement a back-off mechanism?
- How would you store and query the analytics data to provide a dashboard showing the effectiveness of A/B tests in real-time?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.