The 400 Milliseconds That Shape the Entire Internet
You do it hundreds of times a day. You tap a URL into your browser, press Enter, and a webpage appears-but what actually happens when you type a url and press Enter? The whole process feels instant. Effortless. Almost boring.
But here is the truth that most engineers never stop to appreciate: in that fraction of a second between your keypress and the page painting on your screen, your browser just orchestrated one of the most complex relay races ever engineered. It talked to machines on three different continents. It verified cryptographic certificates. It navigated through layers of caching, load balancing, and application logic that took thousands of engineers decades to build.
This is the story of those 400 milliseconds. Not the textbook version. Not the "memorize this for your interview" version. The real version, the one that will change how you see every single webpage you ever load again.
Pour yourself a coffee. We are going on a journey.
It Starts Before You Even Finish Typing
The moment your fingers touch the keyboard, your browser is already working. Modern browsers like Chrome and Firefox do not wait for you to press Enter. They start predicting. As you type "sca" into the address bar, the browser is scanning your history, your bookmarks, and popular search queries to guess where you are headed. If it has high confidence, it might even begin a DNS lookup and TCP connection before you finish the word.
This is called "preconnect" and "DNS prefetch," and it shaves off precious milliseconds. It is the browser equivalent of a sprinter leaning forward before the starting gun fires. Not cheating, exactly. Just being incredibly prepared.
But let us say you have typed the full URL and pressed Enter. Now the real magic begins.
The Phone Book of the Internet: DNS Resolution
Your browser has a problem. You typed "scaledojo.dev" but the internet does not understand words. Every device on the internet communicates using IP addresses, strings of numbers like 172.67.182.XX. So before anything else can happen, your browser needs to translate that friendly domain name into an actual address. This process is called DNS resolution, and it is one of the most elegant systems ever designed.
Think of it like this. You want to call a restaurant, but you only know its name, not its phone number. So you check your own contacts first (the browser cache). Nothing there? You ask your roommate (the operating system cache). Still no luck? You call directory assistance (your ISP's DNS resolver). And if even they do not have it, they start making calls on your behalf, climbing a hierarchy of authoritative servers until someone, somewhere, says "Ah yes, scaledojo.dev lives at 172.67.182.XX."
This chain has four layers, and it happens in roughly 20 to 50 milliseconds:
Browser cache checks if it resolved this domain recently. If yes, it skips everything below.
OS cache checks the system level DNS cache and the hosts file on your machine.
Recursive resolver (usually your ISP or a public resolver like 8.8.8.8) does the heavy lifting. It queries root servers, then TLD servers (.dev), then the authoritative nameserver for that specific domain.
Authoritative nameserver owns the final answer. It responds with the IP address, a TTL (time to live) value, and sometimes additional records like CNAME or AAAA for IPv6.

The beauty of DNS is that it is massively distributed. There is no single "phone book" for the internet. Instead, there are thousands of DNS servers scattered across the globe, each responsible for a tiny slice of the namespace. This design means DNS almost never goes down entirely. When it does (like the famous Dyn attack in 2016), half the internet becomes unreachable, and everyone suddenly remembers how foundational this invisible system truly is.
The Secret Handshake: TCP and TLS
Your browser now knows the IP address. But it cannot just start screaming data at the server. The internet is not a walkie talkie; it is more like a formal diplomatic channel. Before a single byte of your actual request is transmitted, your browser and the server must establish a reliable, encrypted connection. This happens in two stages, and both are fascinating.
The TCP Three Way Handshake
TCP (Transmission Control Protocol) is the foundation of reliable internet communication. Unlike UDP, which fires packets and hopes for the best, TCP guarantees that every byte arrives, in order, without corruption. But that guarantee comes at a cost: a three step handshake that must complete before anything useful happens.
Imagine you are at a noisy concert trying to have a conversation. Before you can talk, you need to confirm the other person can hear you:
SYN (your browser): "Hey, can you hear me? I would like to talk. Here is my sequence number."
SYN ACK (the server): "I hear you! Yes, let us talk. Here is my sequence number, and I acknowledge yours."
ACK (your browser): "Perfect, I acknowledge yours too. We are in sync. Let us go."
Three packets. Three trips across the ocean. On a transatlantic connection, this alone takes about 90 milliseconds. That is 90 milliseconds of pure ceremony before a single byte of actual content has moved. This is exactly why CDNs exist (more on that in a moment) and why engineers obsess over connection reuse through HTTP keep alive.
The TLS Handshake: Building the Encryption Tunnel
If the URL starts with "https" (and in 2026, it always should), there is a second handshake layered on top of TCP. This is TLS (Transport Layer Security), and its job is to ensure that nobody between you and the server can read or tamper with your data. Not your ISP. Not the coffee shop WiFi. Nobody.
The TLS handshake is where cryptography meets engineering. Your browser and the server negotiate which encryption algorithms to use, exchange cryptographic keys, and verify the server's identity through a digital certificate signed by a trusted Certificate Authority. If any step fails, if the certificate is expired, if the domain does not match, if the algorithms are outdated, your browser slams the door shut and shows you that intimidating "Your connection is not private" warning.
With TLS 1.3 (the modern standard), this entire negotiation has been compressed down to a single round trip. Older versions needed two. That one round trip savings might sound trivial, but when you multiply it across billions of connections per day, it represents one of the most impactful performance improvements in internet history.

The Express Lane: How CDNs Bend Geography
Here's what Actually happens when you type a URL and press Enter-and it should bother you a little. If a server is physically located in Virginia and you are browsing from Mumbai, every single packet has to travel roughly 14,000 kilometers. At the speed of light through fiber optic cable, that is about 70 milliseconds one way. For every round trip, 140 milliseconds. For TCP handshake plus TLS plus the actual request and response, you are looking at nearly half a second before anything even begins to render.
This is where CDNs (Content Delivery Networks) completely change the game.
A CDN is a globally distributed network of servers, called edge nodes or Points of Presence (PoPs), strategically placed in cities around the world. Instead of your request traveling 14,000 kilometers to Virginia, it travels maybe 50 kilometers to a CDN edge node in Mumbai that already has a cached copy of the content you want.
Think of it as the difference between ordering a book from a warehouse in another country versus picking it up from a library branch down the street. The book is the same. The experience is wildly different.
CDNs do not just cache static files like images and JavaScript bundles either. Modern CDNs from Cloudflare, AWS CloudFront, and Fastly can cache API responses, run serverless functions at the edge, and even terminate TLS connections locally so that the cryptographic handshake happens 50 kilometers away instead of 14,000.
When we talk about "making systems fast," 90% of the battle is won or lost right here, at the edge, before the request ever reaches your actual backend servers.
The Traffic Controller: Load Balancers
Let us say the request makes it past the CDN, either because the content was not cached or because it is a dynamic request (like logging in or submitting a form). Now it arrives at your backend infrastructure. But here is the thing: no serious production system runs on a single server. Netflix runs on thousands. Google runs on millions. Even a modest SaaS product typically runs on at least three or four backend instances for reliability.
So when your request arrives, who decides which server handles it?
That is the load balancer's job, and it is one of the most critical components in any production architecture.
A load balancer sits at the front door of your server fleet and distributes incoming requests across multiple backend servers using various strategies:
Round Robin simply rotates through servers one by one. Simple, fair, but blind to how busy each server actually is.
Least Connections sends the request to whichever server currently has the fewest active connections. Smarter, but adds a tiny bit of overhead.
IP Hash routes requests from the same client IP to the same server every time. Useful when you need session stickiness.
Weighted distribution assigns more traffic to beefier servers and less to smaller ones.
But load balancers do far more than traffic distribution. They continuously health check every backend server, pinging them every few seconds to make sure they are still alive and responding correctly. The moment a server fails a health check, the load balancer quietly removes it from the rotation. No downtime. No error pages. Users never even notice.
This is the magic that makes "five nines" reliability (99.999% uptime) possible. Individual servers crash all the time. Load balancers make sure nobody cares.

Inside the Server: Where Your Request Comes Alive
Your request has traveled through DNS, TCP, TLS, possibly a CDN, and a load balancer. Now it finally lands on an actual web server. This is where the internet stops being about infrastructure and starts being about logic.
The web server (think Nginx, Apache, or a modern application server like Uvicorn or Gunicorn for Python) receives your HTTP request and parses it apart. Every HTTP request carries a surprising amount of information: the method (GET, POST, PUT, DELETE), the path (/blogs/what-happens-when-you-type-a-url), headers (your browser type, accepted languages, authentication tokens, cookies), and sometimes a body (for form submissions or API calls).
The server examines the path and method and routes your request to the correct handler. In a framework like FastAPI, Django, or Express, this routing happens through URL patterns that map to specific functions. Your request for /blogs/some-slug gets routed to a function that knows how to fetch and return a blog post.
Here is where the real engineering decisions live. That handler function might need to:
Verify your authentication token (are you logged in? is the token expired? is it tampered with?)
Check authorization (are you allowed to access this resource?)
Validate the input (is the slug a valid format? is it within length limits?)
Query the database (fetch the actual blog data)
Transform the data (convert database rows into a JSON response)
Set response headers (cache control, content type, security headers)
Every single step is a potential point of failure, a security boundary, and a performance optimization opportunity. This is why backend engineering is so much deeper than "just write a function that returns data." At scale, every millisecond in this handler matters, because it is multiplied across millions of concurrent requests.
The Vault: Databases and the Art of Storing Everything
Almost every interesting web request eventually talks to a database. The database is where the truth lives. User profiles, blog posts, order histories, message threads: if it needs to survive a server restart, it is in the database.
But "the database" is not one thing. The choice of database is one of the most consequential architectural decisions in any system, and getting it wrong is expensive.
Relational databases like PostgreSQL and MySQL store data in structured tables with rigid schemas. They give you ACID transactions (Atomicity, Consistency, Isolation, Durability), which means you can trust them to never lose your data, never give you a half completed write, and never show you stale reads within a transaction. They are the workhorses of the internet. Boring, reliable, battle tested across decades.
NoSQL databases like MongoDB, DynamoDB, and Cassandra trade some of those guarantees for flexibility and horizontal scalability. When you need to store millions of documents with varying structures, or when you need to spread your data across 50 servers in 12 countries, NoSQL gives you tools that relational databases struggle with.
And then there are specialized data stores. Redis and Memcached for blazing fast in memory caching. Elasticsearch for full text search across billions of documents. ClickHouse and BigQuery for analytics on massive datasets. Neo4j for graph relationships. Each one is a precision tool, and knowing when to reach for which one is what separates a junior engineer from a senior architect.
When your request for a blog post arrives, the server sends a SQL query to PostgreSQL. Something like: find the blog post where the slug matches "what-happens-when-you-type-a-url" and the status is "published." The database engine parses that query, builds an execution plan, checks its indexes (think of indexes as the table of contents of a book, they let the database jump directly to the right page instead of scanning every row), fetches the matching row, and returns it. On a well indexed table, this takes under a millisecond. On a poorly indexed table with millions of rows, it could take seconds. The difference between those two outcomes is the difference between a snappy website and a frustrating one.
The Cheat Code: How Caching Makes Everything 100x Faster
Here is a secret that every high performance system relies on: the fastest database query is the one you never make.
Caching is the art of storing frequently accessed data in a faster layer so you do not have to recompute it or re fetch it every time. And caching happens at almost every layer of the stack you have seen so far.
Your browser has a cache. It stores images, CSS files, JavaScript bundles, and even API responses locally. If the server said "this content is valid for the next 3600 seconds" via a Cache Control header, your browser will not even make a network request. It will serve the cached version instantly, in zero milliseconds.
The CDN has a cache. It stores entire pages and API responses at edge nodes around the world.
The application server might have an in process cache. Recently fetched database results, computed values, or rendered HTML fragments stored in memory.
And then there is the dedicated caching layer, almost always Redis in modern architectures. Redis stores data in RAM, which means reads take microseconds instead of the milliseconds that a disk based database needs. When your blog post gets 10,000 views in an hour, the server fetches it from PostgreSQL once, stores the result in Redis, and serves the next 9,999 requests from memory. The database barely notices.
The tricky part of caching is not the technology. It is the invalidation. When you edit a blog post, every cached copy across every layer needs to be updated or expired. "There are only two hard things in computer science," Phil Karlton famously said: "cache invalidation and naming things." After 20 years in this industry, he was painfully right about both.
The Return Journey: How the Response Finds Its Way Home
The server has processed your request, fetched data from the database (or cache), serialized it into JSON or rendered it into HTML, and now the response begins its journey back to your browser. This return trip is not just a reversal of the inbound route; there are fascinating details here too.
The response travels back through the same TCP connection that was established earlier (thanks to HTTP keep alive, this connection stays open for multiple requests, saving you from repeating the handshake). It passes back through the load balancer, which might add its own headers for tracing and debugging. It passes through the CDN, which might cache this response for future visitors. And it arrives at your browser.
But arriving at your browser is not the end. It is the beginning of an entirely new phase: rendering.
Your browser takes the HTML and starts parsing it from top to bottom, building a DOM (Document Object Model) tree. When it encounters a CSS file, it builds a CSSOM (CSS Object Model). It combines these into a render tree, calculates the layout (exactly how many pixels wide is that div? where does this text wrap?), and then paints the pixels onto your screen.
If the HTML references external resources like images, fonts, or JavaScript files, the browser fires off additional requests for each one, often in parallel. Each of those requests goes through its own mini version of this entire journey: DNS (usually cached by now), TCP (usually reused), TLS (already established), CDN, server, response.
Modern browsers are astonishingly good at parallelizing this work. Chrome, for example, can handle over six simultaneous connections to the same host and will speculatively parse HTML ahead of where it is currently processing, prefetching resources it predicts it will need. By the time you see the page fully loaded, your browser might have completed 50 to 100 individual HTTP requests across a dozen different domains, all in under two seconds.
Zoom Out: The Architecture You Just Traveled Through
Let us take a breath and look at the full picture. In under 400 milliseconds, your request passed through:
DNS Resolution to translate a human friendly name into an IP address
TCP Handshake to establish a reliable connection
TLS Handshake to encrypt everything end to end
CDN Edge Node to serve cached content close to you
Load Balancer to route traffic to a healthy server
Web Server to parse and route the HTTP request
Application Logic to handle authentication, validation, and business rules
Database to fetch the actual data
Cache Layer to speed up repeated reads
Response Journey back through all those layers in reverse
Browser Rendering to turn bytes into pixels
This is not an academic exercise. This is the exact architecture that powers every app you use. Instagram, Netflix, Uber, Spotify, your banking app, the website you are reading right now. The components might be scaled differently. The specific technologies might vary. But the fundamental pattern, the flow of a request through these layers, is universal.
And here is the profound realization that separates a coder from a system designer: every single layer in this stack is a set of tradeoffs. DNS caching trades freshness for speed. CDNs trade consistency for latency. Load balancers trade simplicity for reliability. Caching trades memory for throughput. Databases trade flexibility for guarantees. There are no right answers, only tradeoffs that fit your specific requirements.

Why Understanding This Journey Makes You a Better Engineer
If you have read this far, you now understand something that most engineers only grasp at a surface level. You understand the full vertical slice of a web request. You can trace a packet from a keystroke to a pixel.
This understanding is exactly what interviewers are probing for in system design interviews. They do not want you to memorize box diagrams. They want to see if you understand why each layer exists, what happens when it fails, and how the layers interact under pressure. Can the CDN handle a cache stampede? What happens if the load balancer's health check interval is too long? What if the database connection pool is exhausted? These are the questions that separate a "textbook answer" from a "this person has actually built systems" answer.
This is also the knowledge that makes day to day engineering dramatically easier. When a page loads slowly, you stop guessing and start reasoning. Is it DNS? Is it a cold cache? Is it a slow database query? Is it render blocking JavaScript? You can instrument, measure, and fix the actual bottleneck instead of randomly restarting servers and hoping for the best.
Closing with CTA
Build This Architecture Yourself, Layer by Layer
Reading about system design is valuable. But the engineers who truly internalize these concepts are the ones who build. Who drag a CDN onto a canvas, wire it to a load balancer, connect two web servers to a database, and then watch an AI reviewer tell them they forgot a cache layer, or that their database is a single point of failure, or that their estimated latency just blew past the budget.
That is what ScaleDojo was built for. 70 progressively harder system design challenges, from static websites to global scale social platforms including GenAI levels, each one scored by an AI architect that evaluates your design for completeness, correctness, scalability, resilience, and cost. Every concept in this article, DNS, CDNs, load balancers, caching, databases, message queues, and many more, becomes a component you can drag, connect, and learn by doing.
You just read the story of a single web request. Now go design the system that serves millions of them.
Start building at scaledojo.dev

