Design CanvasOpen the canvas

Design a Contact Form

A busy site has a contact form. A visitor writes a message and presses send, and the site must email it to its staff. Sending email goes through an outside email provider, which takes a moment and sometimes fails. The visitor should not have to wait for the email to go, and every message must reach the staff once: not lost, and not sent twice. Now and then a campaign sends a surge of messages.

Constraints

  • The form must respond within 100 ms, however long the email takes
  • About 200 messages per second on a normal day, and up to about 5 times that during a campaign
  • Every message must be delivered once: not lost, and not sent twice, even if the provider fails and the send is tried again
  • The form keeps accepting messages when the email provider is down
  • Keep infrastructure under $1,600 a month

Scenarios to survive

Normal day

Messages arrive steadily.

Interviewer asks: Follow one message from the visitor to the staff's inbox. At which point does the visitor stop waiting?

A campaign (5x)

A campaign sends five times the usual messages for a while.

Interviewer asks: Five times as many messages arrive. Which part of your design has to keep up with them, and which part can fall behind for a while?

The email provider stops answering

The outside email provider is unavailable.

Interviewer asks: The provider is down. What does a visitor see when they press send, and what happens to the message?

What a good design must do

  • The form responds within the latency target on a normal day
  • The form copes with a campaign
  • Messages are still accepted when the email provider is down
  • Total monthly cost stays within $1,600
  • Accepting a message does not wait for it to be delivered
  • Something delivers each message by email
  • The design explains what happens to a message when the provider fails, and how a retry avoids sending it twice