retrystorm · Learn · Interview practice · Glossary · Components

Home › Interview practice › Attachments

Attachments

Writers attach files to their notes. The database's network card fills up, and plain notes slow down with it. Give it the bandwidth it needs.

Writers can now attach pictures and files to their notes, about 300 KB each. Every attachment someone opens leaves the database through its network card, and since attachments launched, plain notes have slowed down too. The database's CPU is barely busy.

What it does

  • Read: a user opens a note (2 KB) or an attachment (about 300 KB).
  • Write: a user saves a note or uploads an attachment.

Workload

Two kinds of traffic, 4 000 rps in all for 15 seconds: notes, 70% of requests at 2 KB each, and attachments, 30% at about 300 KB each. Mostly reads, against 10 000 notes.

How to build it

The app tier is fixed: four medium replicas behind a load balancer. You choose the database: its tier and its read replicas. Each node's network card sends:

TierBandwidth per nodePrice per node
Small1 Gbps$0.12/h
Medium2.5 Gbps$0.30/h
Large5 Gbps$0.70/h
XLarge10 Gbps$1.50/h
  1. Connect both clients to the load balancer, then the app servers, then the database. Run it as it is.
  2. How many bits a second do the attachments need? Compare that with the database's card.
  3. Give the reads enough bandwidth, for as little as you can.

Part of Chapter 17: Bandwidth.

About · Contact · Privacy · Terms of use