Email service
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many messages a second reach the SMTP edge?

      How many inbound MTA hosts do you need?

        How many bytes of new mail arrive in a year?

          How big is the metadata, and what sizes its fleet?

            Build-up · 5 steps

            Build the high-level design

            One functional requirement at a time, ending with an email service that works for one region at moderate traffic.

            Step 1 of 5

            Receive from anyone

            Senders find our inbound MTAs through MX records. The MTA checks the recipient, SPF, DKIM and DMARC, writes to a queue replicated across three zones, and only then says 250 OK.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “A bank’s server has sent Priya’s message and is waiting for your reply. When do you answer 250 OK?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “The internet sends more junk than mail, some of it pretending to be Priya’s bank. How do you keep it out?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “About 0.9 EB of new mail a year, read one user at a time and rarely deleted. How do you lay out storage?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “Priya gets “Re: Goa trip?” replies and “Invoice” emails from many different people. How do you group conversations?”

              Your move. Pick an approach:

            5. Deep dive 6 of 6

              Interviewer

              “You send 23,000 messages a second to tens of thousands of providers. One throttles you and another is down. What now?”

              Your move. Pick an approach:

            Build-up · 8 steps

            Follow one email in, then one out

            Mail enters and leaves through the SMTP edge, each user’s state lives in one partition, and one per-user change log drives push and search.

            Step 1 of 8

            Receive

            A sender finds our MX records and connects to an inbound MTA. It upgrades to TLS, checks recipient and quota at RCPT TO, verifies SPF, DKIM and DMARC, and rejects obvious junk inside the session.