The Image Service That Made Every Origin Server Sweat
Your photo-sharing app serves user-uploaded images directly from an origin fleet of 20 EC2 instances backed by S3, with no CDN in front -- every image view is a fresh request to your origin, even though the same popular photos (profile pictures, viral posts) are viewed thousands of times without changing. At peak, the origin fleet handles 45,000 image requests/second, 70% of which are for the same ~2,000 "trending" images being viewed repeatedly by different users, and most requests originate from users 3,000-9,000 miles from your single us-east-1 region, adding 150-300ms of pure network latency before your origin even starts processing. You're asked to put a CDN in front of image delivery to cut both origin load and end-user latency, and to specifically address how the CDN serves users close to them while still reflecting an image update (a user replacing a bad photo) within a reasonable time, not tomorrow.