Scrivio Interview library
DesignIntermediate6 min read · updated 13 November 2026

An image service serves 50,000 thumbnail requests per second at an average of 40 KB through a CDN with a 95 percent hit ratio. One origin instance can serve about 1,500 requests per second at the target CPU.

Estimate the CDN egress bandwidth, the origin load and the number of origin instances, and say which case should set the origin size.

Egress is 50,000 times 40 KB, about 2 GB per second or roughly 16 Gbit per second at the edge. With a warm CDN, 5 percent misses send 2,500 requests per second and about 100 MB per second to the origin, which two instances could serve, three with redundancy. But after a purge, a new edge location or a CDN fault, misses can approach 100 percent, which is 50,000 requests per second and over 30 instances, so the origin should be sized for a realistic bad case, softened with an origin shield, cache warming and rate-limited fills, and the hit ratio and object size should be tracked as the assumptions that matter most.

Why this question is asked

A CDN, a content delivery network of caching servers close to users, hides most of the load from our own servers. That is exactly what makes origin sizing tricky: the number the origin sees is the small fraction the CDN misses, and that fraction can change suddenly. Interviewers use this question to check bandwidth arithmetic and, more importantly, whether we size for the average or for the failure case. In this answer, we will compute the edge bandwidth, the origin load with a warm cache, the origin load with a cold one, and decide which case should set the origin size and how to make the bad case less bad.

1A Quick Recap: CDN, Origin and Hit Ratio

When a user requests a thumbnail, the request goes to a nearby CDN edge server. If the edge has the image cached, it answers directly; that is a hit. If not, a miss, the edge fetches the image from our origin, the servers we run, stores it and returns it. The hit ratio is the fraction of requests answered from cache. At 95 percent, only 1 request in 20 reaches the origin.

Egress is the data the CDN sends out to users. It is what the CDN bills us for, and it is far larger than what the origin sends, because each cached object is served many times.

2Edge Egress Bandwidth

We multiply the request rate by the average object size and convert bytes to bits at the end, since network links are rated in bits per second.

Text
egress bytes = 50,000 req/s x 40 KB = 2,000,000 KB/s = about 2 GB/s
egress bits = 2 GB/s x 8 = about 16 Gbit/s at the edge
per month = 2 GB/s x 2.6 million s = about 5.2 PB/month (if the rate held all month)

16 Gbit per second spread over a CDN's many edge locations is routine. The monthly figure is an upper bound because traffic is not flat, but it shows why CDN pricing per gigabyte matters for a service like this.

3Origin Load With a Warm CDN

With a 95 percent hit ratio, 5 percent of 50,000 requests miss, so the origin sees 2,500 requests per second, about 100 MB per second or 800 Mbit per second. One origin instance serves about 1,500 requests per second at the target CPU, so two instances could carry the load. We would run at least three, spread across availability zones, so that losing one still leaves enough capacity. On this view, the origin looks tiny.

4Origin Load With a Cold CDN

The warm-cache number holds only while the caches are full. Several ordinary events empty them: a purge after we change how thumbnails are generated, a deploy that changes URLs, the CDN adding a new edge location, an edge failure that shifts users to a site whose cache does not have our objects, or a CDN incident. In those moments the hit ratio can drop towards zero for a while, and the origin suddenly sees most of the 50,000 requests per second.

At 1,500 requests per second per instance, that needs about 34 instances, more than ten times the warm-cache fleet. If the origin has three, it will overload, requests will time out, the CDN will retry, and the caches will refill slowly because misses fail. This is the classic thundering herd: many requests for the same objects arriving at once.

Origin load by cache state
CaseHit ratioOrigin RPSInstances at 1,500 each
Warm CDN95 percent2,5002, run 3 for redundancy
Partly cold after a regional shift70 percent15,00010
Cold after a full purgenear 0 percentup to 50,000about 34
Cold, with origin shield at 90 percent90 percent at shieldabout 5,0004, run 5 or 6

5Which Case Should Set the Origin Size?

Neither extreme is right on its own. Sizing for the warm average leaves the system one purge away from an outage. Sizing permanently for a full cold start means paying for 34 instances to handle a load that happens a few times a year. The practical answer is to size for a realistic bad case and then make the bad case smaller.

The main tool is an origin shield, also called tiered caching: instead of every edge location fetching from our origin, edges fetch from one or a few regional shield caches, which fetch from the origin. Because the shield is shared, each object is fetched from the origin roughly once, even when dozens of edges are cold. With a shield hit ratio of 90 percent during a cold period, the origin sees about 5,000 requests per second, which five or six instances can handle.

We add the remaining protections around it. We avoid full purges, purging only changed objects, and warm caches after a deliberate purge by requesting the most popular few thousand thumbnails through the shield. We enable request collapsing at the CDN so concurrent misses for the same object become one origin fetch. We rate-limit fills to the origin so overload produces slower misses rather than failures. And we autoscale the origin on request rate, knowing that scaling takes minutes and the shield must cover the gap.

Step throughThumbnail delivery with an origin shield
  1. Users50,000 requests per second
  2. CDN edge locations95 percent hit ratio when warm
  3. Origin shieldShared regional cache, collapses repeated misses
  4. Origin fleet5 to 6 instances, rate-limited fills, autoscaled
  5. Object storageThumbnails in S3

5 layers, from the top down. Step through them one at a time.

6Tracking the Assumptions That Change the Answer

Two assumptions dominate every number here: the hit ratio and the average object size. A drop from 95 to 90 percent doubles origin load; an increase in object size raises every bandwidth figure proportionally. We say this explicitly in the design and track both in production, with an alert on hit ratio at the edge and the shield, and a dashboard of average response size, so we notice drift before it becomes an incident.

7Follow-up questions

What would you change if image sizes doubled with a new high-resolution display?

At 80 KB, edge egress doubles to about 32 Gbit per second and the CDN bill roughly doubles. Origin bandwidth doubles too, to about 200 MB per second when warm, and if the origin was limited by network rather than CPU, instance counts rise. The CDN cache also holds half as many objects in the same space, which may lower the hit ratio. I would serve sizes by device using responsive image URLs, so only high-resolution screens get the larger file, and use modern formats such as WebP or AVIF, which often cut size by 25 to 50 percent compared with JPEG.

Why does a lower hit ratio hurt so much?

Because origin load is proportional to the miss ratio, not the hit ratio. Going from 95 to 90 percent hits doubles misses from 5 to 10 percent, so the origin load doubles.

Could the origin just serve straight from S3?

Yes, the CDN can use an S3 bucket as its origin if thumbnails are pre-generated, which removes the instance fleet. The shield is still useful to limit request costs and S3 request rate during cold periods.

8Conclusion

In this answer, we estimated about 16 Gbit per second of edge egress and 2,500 requests per second at the origin with a warm CDN, which two or three instances could serve. A cold CDN could send up to 50,000 requests per second, needing about 34 instances. We sized the origin for a realistic bad case, made that case smaller with an origin shield, request collapsing, cache warming and rate-limited fills, and named the hit ratio and object size as the assumptions to track.

What to say in the interviewAbout 90 seconds aloud

Open with

Egress is 50,000 requests a second times 40 kilobytes, about two gigabytes a second, which is roughly 16 gigabits a second at the edge. With a warm CDN at 95 percent hits, only five percent reach the origin: 2,500 requests a second and about 100 megabytes a second.

Then, if they want more

At 1,500 requests per instance, two instances would do it, and I would run three across zones for redundancy. But that is the easy case.

After a purge, a new edge location, an edge failure or a CDN incident, the hit ratio can drop towards zero, and the origin could see most of the 50,000 requests a second, which is about 34 instances. If it only has three, it collapses and the caches never refill.

So I would not size for the warm average, and I would not pay for 34 instances permanently either. I would put an origin shield in front, so all edges share one cache layer and each object is fetched from the origin about once, turn on request collapsing, avoid full purges and warm caches after deliberate ones, and rate-limit fills.

With a shield, a cold period might be around 5,000 requests a second, so five or six instances with autoscaling. And I would state that hit ratio and object size drive everything, and track both in production.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Estimate the CDN egress bandwidth, the origin load and the number of origin instances...": https://scrivio-interview-library.netlify.app/architecture/sd-fundamentals/87ea17ff5c/