Card 08/ 09
Practice: Choosing a Transport for Five Applications
A game's position updates, a file upload, a log shipper, a voice call and a payment; choose and say why.
Choosing a transport means asking what a late or lost packet costs each application. A team is designing five pieces of a new product and asks which transport each should use. For each, choose TCP or UDP and give the reason in one sentence.
- A multiplayer game sends every player's position to the others 20 times a second.
- Users upload photos of up to 20 MB.
- A log shipper sends every server's audit logs to a central store, where each line is kept for compliance.
- The product adds voice calls between users.
- A checkout service sends a payment request to a payment provider.
Show the answers
| Application | Transport | Reason |
|---|---|---|
| Game positions | UDP | A newer position arrives 50 ms later, so a lost one is better skipped than waited for. |
| Photo upload | TCP | A file with a missing piece is corrupt, and a short wait costs nothing. |
| Audit log shipper | TCP | Every line must arrive, and logs are not time critical. |
| Voice calls | UDP | A late sound sample is useless, and waiting for it freezes the call. |
| Payment request | TCP | A missing or reordered byte changes the request, and the cost of a delay is small. |
The two UDP choices share one property: new data replaces old. Everything else needs every byte, so TCP's waiting is a price worth paying. Some log shippers do use UDP and accept loss, which is fine for debugging logs and wrong for logs kept for compliance.
← → move through sections and cards