Engineering Decisions · Junior · Question 7 of 12
Users upload avatars of up to 5 MB. The app runs on several instances behind a load balancer. Where do you store the files?
- 1On the local disk of the instance that took the upload
- 2As binary columns inside the main database
- 3In object storage, keeping the URL in the database
Show the answer
Correct answer: In object storage, keeping the URL in the database
Explanation
Object storage is reachable from every instance, is cheap, and keeps files out of database backups. A local disk fits a single server, but behind a load balancer other instances wouldn't see the file. Binary columns fit a few small files that must stay transactional with their row, but avatars for many users would bloat the database and its backups.