Hey ya’ll, I’m back! Here I am, continuing my journey through the basics of how the internet works. A quick recap so we can pick up where we left off:
- What is the Internet? A way for us humans to send information.
- The internet has a physical side! There are enormous amounts of cables that transport our data.
- Circuit Switching + Packet-switching are different ways our data is moved from one machine to the next.
- Our data knows where to go because it has an IP address.
- The Client-Server Model is the process of a client requesting information from a Server and the Server receiving and responding to that request.
Alright, let’s get back on track. We type a URL in our browser(client) and then it checks a cache to find the appropriate DNS record that matches said URL. So what is this cache?
A cache is a storage location! It’s used to hold temporary data so that everything runs faster. Typically, when you visit a website for the first time, your browser will store a copy of it on your own machine via a browser cache! That way, next time you visit the page, your browser(whether that be Chrome or Safari) doesn’t need to pull all the information again because it already has it on hand. Think of it as your browser’s memory of sorts. So when we make that initial request, you browser actually searches a few different caches:
- Your browser will check its own cache (duh)! As we previously mentioned, your browser keeps a repo of DNS records of sites you’ve previously visited.
- Next, it will search your computers own cache.
- If it can’t find the correct DNS record there, it will then check your router.
- Finally, if all else fails, it will reach out to your Internet Service Provider’s cache(ISP). If the DNS record is not in their cache, they will perform their own search to find the appropriate IP address.¹
Lots of steps! Lots of your information floating out in the world…perhaps thats a topic for a different blog! After it receives the appropriate record to retrieve the right IP address, it’s time to establish the TCP connection (Transmission Control Protocol) with the server!
Before we dive into the next section, I wanna bring our attention to the “IP” of “IP Address.” So as discussed in Part One, IP stands for Internet Protocol. Why does the internet have a protocol? Well, because it provides a set of standards that governs the way certain actions are performed and how data is formatted in order for devices to communicate with one another. You will often see TCP + IP together because they are part of a protocol suite — A protocol suite is a collection of protocols that are designed to work together. For the Internet Protocol suite, TCP/IP are the most commonly used protocols. Where the IP is used to address and send the data packets to the correct recipient, the TCP’s job is to establish a connection between the two devices and maintain it while the data is transmitted.
How exactly is the TCP connection established? To begin, the client sends a SYN packet (short for synchronize) to the server, asking for a connection to be established. The server then agrees by sending back a SYN-ACK packet (ack standing for acknowledgement). Last but not least, the client sends its own ACK back to the server letting it know it received its acknowledgement. At this point, the client can begin transferring data.²
Protocols after protocols after protocols….
Alright, we got the IP address of Amazon.com, we made connection and now we need to get the data so we can actually see the website. In order to get that data, the client (our side) needs to send a HTTP GET request over to the server. What does HTTP stand for? Another protocol?! Oy vey!
It stands for Hypertext Transfer Protocol. It’s used to structure the way requests and responses are transmitted on the internet. We can actually take a look at one of these requests in our Network tab from the browser console! While browsing the big list of HTTP requests sent out when I visited Amazon, I was curious why so many? I thought it was a simple GET request (like the ones I use when working on my own projects?)
ARE WE THERE YET?!
Yes! And no….like I said, this is a personal journey about me learning about the internet and sharing what I‘ve learned so far!
For the next part of this journey, we’ll dive into the different types and structures of these HTTP requests. Hope to see you there!
- Cool video inside a Google Data Center — https://www.youtube.com/watch?v=XZmGGAbHqa0