XO.PL / IT Made Fun
PL / EN
IT Made Fun

Technology explained in human terms. No magic, no marketing fluff. Just useful examples.

Simple explanations without sacrificing technical accuracy.

Menu & Topics

Home Page
Navigation
SearchFavorites
Networking16RoutingAudio version availableIP AddressesDHCPNATTCP and UDPDNSTTLTraceroutePing, Jitter and LossDoS and DDoSQoSMTU and MSSVPNHTTP & HTTPSSSL/TLS CertificatesBGPOSI ModelNetwork SwitchRouterWireless Access Point
Internet8BrowsersCookiesCachingProxyCDNEmailInstant MessagingVoIPSearch EnginesFile TransferCloudStreaming
Data & Storage4BackupsData RecoveryData EncryptionDatabases
Operating Systems4WindowsLinuxmacOSAndroidiOS / iPadOSProcessesThe KernelFile Systems
IT Security1IT Security BasicsSecurity PolicyPhishingPasswords and MFAFirewalls
Hardware2Data StorageRAIDCPURAMHDD and SSD
Software-UpdatesSoftware BugsOpen Source
Programming-VariablesLoopsDebugging
Read or listen to this article onlineScan the QR code to open this article on XO.PLArticle source:https://xo.pl/it-made-fun-inet-cdn
QR Code
Internet

CDN: why travel halfway around the world for pizza?

Greg ordered pizza from New York. To be delivered hot. In Poland. The restaurant owner looked at the map, then at Greg, then at the oven. “By the time it arrives, the cheese will have applied for retirement!” Fortunately, the Pizza Packet chain had an idea: instead of shipping every order halfway around the world, it opened local branches. 🍕🤣

Pizza from the other side of the planet

— I'd like an authentic pizza from headquarters — Greg announced.

— We have a branch two streets away — replied Agnieszka, the delivery manager.

— BUT I WANT ONE FROM NEW YORK!

— Same recipe.

— And the oven?

— Similar.

— What about the delivery driver?

— Considerably closer.

A similar idea on the Web is called a CDN — Content Delivery Network. Rather than sending every resource from one distant server every time, a CDN uses a distributed network of locations that can deliver copies closer to users.

— The Internet has its own pizza chain?

— That's a surprisingly good description.

— Then why am I still paying for delivery?

— Ask accounting.

Headquarters and local branches

At Pizza Packet headquarters, the head chef kept the original recipe, menu pictures and latest prices.

— We're the source — he declared proudly.

— The origin? — asked the IT specialist.

— Doesn't that sound more impressive?

The origin is a source server from which the CDN may fetch content. Distributed locations near the network's edge are called edge locations. They can serve resources without every request traveling all the way back to headquarters. This doesn't mean one branch per city, and the selected edge server isn't always the geographically closest one. Network paths, availability and load matter too.

— So the branch that serves me might not be the nearest one on a map?

— Correct.

— Why do we have the map, then?

— The manager needed something for the wall.

The first pizza has to come from somewhere

The first customer entered a new branch.

— I want the promotional poster and that pizza photo.

— We don't have those yet — admitted the employee.

— WHAT KIND OF BRANCH IS THIS?!

— We'll fetch them from headquarters.

A CDN may use caching. When a valid copy of a resource is already at the edge, it can be served locally: a cache hit. When the copy isn't there, that's a cache miss. The edge has to fetch it from another location, often the origin, and may save it for subsequent customers.

— And next time?

— We might hand you the picture immediately.

— Do you also keep the pizza for a week?

— Greg, please don't confuse an image file with your dinner.

CDNs deliver digital resources. Not every response is suitable for shared caching.

Why does the website load faster?

The headquarters manager called the branch.

— How many times did we send that picture today?

— To this branch? Once. But we served it to five hundred customers nearby.

— FIVE HUNDRED FEWER TRUCKS?!

— That's approximately the point.

When large images, CSS stylesheets, JavaScript files or media segments come from well-placed CDN locations, they may travel a shorter or less congested network path. Fewer requests may also reach the origin server directly. Loading speed still depends on the network, resource sizes, the user's device and the website's own application logic.

— Will a CDN fix my slow laptop?

— No.

— What about the application that takes a minute to calculate my bill?

— Not necessarily.

— THEN WHAT DO YOU DO?!

— Deliver content. Not miracles.

Who stole the new menu?

One morning, headquarters changed the pizza price. The local branch still displayed the old menu.

— MY PRICE IS DIFFERENT! — shouted Greg.

— The copy hasn't been refreshed yet — explained Agnieszka.

— THE YESTERDAY NEWSPAPER PROBLEM AGAIN!

CDN locations need rules for how long cached content can be reused. When something must change quickly, operators may invalidate or purge cached copies, or change the resource URL. Updates don't necessarily reach every edge location at exactly the same moment.

— So I have three cupboards? One in my browser, one at the intermediary, and one at the CDN?

— There can be several cache layers.

— I want a diagram.

— Already printed.

— Which version?

Agnieszka slowly hid the paper in a drawer.

Not every pizza can be prepared in advance

A customer called the branch.

— I'd like to check my account balance.

— We have yesterday's file ready!

— THAT ISN'T MY ACCOUNT!

— PUT THAT FILE DOWN RIGHT NOW! — shouted the IT specialist.

Not every response should be served from a shared cache. Private content, information specific to a signed-in user and frequently changing results need appropriate rules and may need to be handled directly by the application. Incorrect caching can expose one customer's data to another.

Some CDNs also provide extra functions, such as filtering certain unwanted traffic, handling TLS or helping during traffic spikes. That doesn't mean every CDN offers identical security or guarantees availability through every outage.

— So we don't leave customers' invoices by the till?

— Absolutely not.

— I'll make that rule number one.

— Don't wait for rule number two.

A CDN isn't just a box of files

Mr Proxy from the office next door arrived for a meeting.

— I hear you also handle deliveries for others.

— We do — said Agnieszka. — But we operate a whole distributed network of locations.

— A very large proxy, then?

— Many CDNs use reverse proxy and caching functions, but CDN describes the distributed content-delivery system, not merely one intermediary.

— And my browser cache?

— That's the customer's cupboard. Our locations are part of the delivery infrastructure.

— What if a branch closes?

— Traffic may be directed elsewhere, if the network and configuration allow it.

— So it depends again?

— Welcome to computing, Greg.

The great delivery report

That evening Greg finally received his pizza.

— Well? — Agnieszka asked.

— Hot. Fast. Looks exactly like the photo.

— Excellent.

— But I still don't know where it came from.

— From a location that could serve you efficiently.

A CDN helps deliver content through a geographically distributed infrastructure and reduces the load on origin servers. It is particularly useful when many people request the same resources and cache freshness is managed properly. It does not replace a functioning application or sensible caching rules.

— May I order dessert?

— Certainly.

— From New York?

— GREG!


Pizza Packet management reports: local branches improved delivery times and headquarters reduced unnecessary journeys. All menus have been synchronized. Greg filed a complaint because he ordered a pizza from New York but the courier walked over from the next street. The complaint was rejected: “Product as described. Geography is not an ingredient.” 🍕🌍🤣❤️