Database rows vs object storage for images
A database row that holds image bytes makes every read use database CPU and network. Object storage behind edge caches serves the bytes without the database. At 200 images/s of 1 MB, rows give p99 over 10 s and 29 percent errors. Object storage gives p99 81 ms for 5,864 USD/mo.
5 MB/s · logs kept on the host · disk full in 33 minutes
100 images/s · 1,600 of 1,000 Mbps · it does not fit
Case 1
200 images/s of 1 MB each. The images need no joins, and their metadata stays in the app database. p99 must stay below 300 ms and cost below 10,000 USD/mo.
| Measure | Goal | Image bytes in database rows | Object storage behind a CDN |
|---|---|---|---|
| p99 latency | under 300 ms | 10.1 s Fail | 81 ms Pass |
| Monthly cost | 16 USD/mo | 5,864 USD/mo | |
| Error rate | 29.3% | 0% |