How the Internet Works
You type bookshop.example and a page of books appears in under a second, even though the server might sit in a data centre on another continent. As a backend developer, that server is yours. Knowing how a request crosses the gap tells you where delays and failures come from.
Throughout this course we follow one small online bookshop: its website, its API and its database.
The rule
Split into packets, address by IP, route hop by hop, rebuild.
The internet is a network of networks: your home router, your internet provider, large backbone carriers and data centres, all agreeing to pass data along for each other.
- IP address: every reachable machine has a numeric address, such as
203.0.113.10(IPv4) or a longer IPv6 address like2001:db8::10. It plays the role of a postal address. - Packets: a message is not sent in one piece. It is cut into small packets, each stamped with the sender's and the receiver's address.
- Routers: a router reads a packet's destination and forwards it one hop closer. No router knows the whole path; each only knows a good next step.
- TCP: packets can arrive late, out of order or not at all. TCP, a protocol that runs on top of IP, numbers them, asks again for missing ones and puts them back in order.
- Ports: one server runs many programs, so a port number picks which program gets the data. Web traffic normally uses port 443 (HTTPS) or 80 (plain HTTP).
You can see the hops for yourself:
traceroute example.comEach line of the output is one router the packets passed through on the way.