Try
↑ ↓ move↵ openesc close

Interview prep / Chat system

Mid · Chat system · System design interview question

The server resends a message when it gets no ack. How do you avoid showing it twice?

Sketch your own answer first, then compare it with the one below.

A strong answer

The server cannot tell a lost message from a lost ack, so it resends in both cases. That is at-least-once delivery.

The client keeps the sequence numbers it has and drops a message it already holds. For messages the client sends, a client-made message id lets the server drop a repeat. The result looks like exactly once, built from at-least-once delivery and a duplicate check.

Sources

Learn it by running it

The design a chat system lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms