Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a CDN in simple terms?
A CDN (Content Delivery Network) is a group of servers placed in different locations that store copies of content to deliver it faster to users nearby.
Click to reveal answer
beginner
Why do websites use CDNs?
Websites use CDNs to make their content load faster, reduce the load on their main servers, and improve user experience by serving content from nearby servers.
Click to reveal answer
intermediate
What is cache miss and cache hit in CDN context?
Cache hit means the CDN server has the requested content and delivers it quickly. Cache miss means the content is not on the CDN server, so it fetches it from the origin server first.
Click to reveal answer
intermediate
How does a CDN improve scalability?
A CDN spreads user requests across many servers worldwide, so the origin server handles fewer requests, allowing the system to serve more users without slowing down.
Click to reveal answer
beginner
Name two common types of content typically delivered by CDNs.
Static files like images, videos, stylesheets, and scripts are commonly delivered by CDNs because they don’t change often and benefit from caching.
Click to reveal answer
What is the main purpose of a CDN?
ATo replace the main database
BTo deliver content faster by using servers close to users
CTo store user passwords securely
DTo generate website content dynamically
✗ Incorrect
CDNs deliver content faster by caching it on servers near users.
What happens during a cache miss in a CDN?
AContent is fetched from the origin server and then cached
BContent is served immediately from the CDN
CUser request is denied
DCDN deletes the content
✗ Incorrect
On a cache miss, the CDN fetches content from the origin server and caches it for future requests.
Which content type is best suited for CDN delivery?
AReal-time chat messages
BDynamic user data
CStatic images and videos
DDatabase transactions
✗ Incorrect
Static content like images and videos are ideal for CDN caching and delivery.
How does a CDN help reduce load on the origin server?
ABy caching and serving content directly to users
BBy increasing server CPU speed
CBy deleting unused files
DBy blocking user requests
✗ Incorrect
CDNs cache content and serve it directly, reducing requests to the origin server.
Which of these is NOT a benefit of using a CDN?
AReduced server bandwidth usage
BBetter scalability
CImproved content delivery speed
DAutomatic content creation
✗ Incorrect
CDNs do not create content; they only deliver cached content faster.
Explain how a CDN works to improve website performance.
Think of how a package delivery service uses local warehouses to deliver faster.
You got /4 concepts.
Describe the difference between cache hit and cache miss in a CDN.
Compare it to finding a book in your local library versus ordering it from a distant store.
You got /4 concepts.
Practice
(1/5)
1. What is the primary purpose of a Content Delivery Network (CDN)?
easy
A. To store user data permanently
B. To cache content closer to users for faster delivery
C. To replace the origin server completely
D. To encrypt all website content
Solution
Step 1: Understand CDN function
A CDN stores copies of content in multiple locations worldwide to reduce latency.
Step 2: Identify main benefit
This caching near users speeds up content delivery and reduces load on the origin server.
Final Answer:
To cache content closer to users for faster delivery -> Option B
Quick Check:
CDN = caching near users [OK]
Hint: CDN = cache content near users for speed [OK]
Common Mistakes:
Thinking CDN replaces origin server
Confusing CDN with data storage
Assuming CDN encrypts all content
2. Which of the following is the correct sequence when a user requests content served via a CDN?
easy
A. User -> Origin Server -> CDN -> User
B. Origin Server -> User -> CDN
C. User -> CDN -> Origin Server (if needed) -> CDN -> User
D. User -> CDN -> User -> Origin Server
Solution
Step 1: Trace request flow in CDN
User first contacts the CDN edge server; if content is cached, it responds immediately.
Step 2: Understand cache miss handling
If content is not cached, CDN fetches it from the origin server, caches it, then serves user.
Final Answer:
User -> CDN -> Origin Server (if needed) -> CDN -> User -> Option C
Quick Check:
Request flow = CDN first, origin fallback [OK]
Hint: User hits CDN first, origin only if cache miss [OK]
Common Mistakes:
Assuming user contacts origin server first
Ignoring CDN cache miss flow
Confusing response direction
3. Consider this simplified code snippet representing a CDN cache check:
cache = {"index.html": "content"}
request = "style.css"
if request in cache:
response = cache[request]
else:
response = "fetch from origin"
print(response)
What will be printed?
medium
A. fetch from origin
B. KeyError
C. content
D. None
Solution
Step 1: Check if request key exists in cache
The request is "style.css" which is not in cache keys (only "index.html" exists).
Step 2: Determine else branch execution
Since request not found, else branch runs, setting response to "fetch from origin".
Final Answer:
fetch from origin -> Option A
Quick Check:
Cache miss prints fetch from origin [OK]
Hint: If key missing in cache, else branch runs [OK]
Common Mistakes:
Assuming cache returns default value automatically
Expecting KeyError without else
Confusing cache keys with values
4. A CDN is configured but users report slow content loading. Which of these is the most likely cause?
medium
A. The CDN is caching all content correctly
B. Users have slow internet unrelated to CDN
C. The origin server is down but CDN cache is fresh
D. The CDN edge servers are geographically far from users
Solution
Step 1: Analyze CDN slow delivery causes
If CDN edge servers are far from users, latency increases, causing slow loading.
Step 2: Evaluate other options
The CDN is caching all content correctly means caching works, so unlikely cause. The origin server is down but CDN cache is fresh means cache serves content fast. Users have slow internet unrelated to CDN is user-side, not CDN issue.
Final Answer:
The CDN edge servers are geographically far from users -> Option D
Quick Check:
Distance to CDN edge affects speed [OK]
Hint: Far CDN edges cause slow delivery [OK]
Common Mistakes:
Blaming origin server when cache is fresh
Ignoring CDN server location
Assuming caching always fixes speed
5. You want to design a CDN system that handles sudden traffic spikes without overloading the origin server. Which combination of strategies is best?
hard
A. Use aggressive caching with long TTL and multiple CDN edge locations
B. Disable caching and let all requests go to origin server
C. Use a single CDN edge server with short TTL caching
D. Serve content only from origin server with load balancer
Disable caching and let all requests go to origin server and D overload origin server. Use a single CDN edge server with short TTL caching limits caching benefits and single edge risks bottleneck.
Final Answer:
Use aggressive caching with long TTL and multiple CDN edge locations -> Option A
Quick Check:
Long TTL + many edges = scalable CDN [OK]
Hint: Long cache + many edges handle spikes best [OK]