What Happens When You Type google.com into Your Browser?

What Happens When You Type google.com into Your Browser?

According to Pingdom, the average load time for websites is around 3.21 seconds. Sometimes, when I have a faulty internet connection, and I need to be sure that the internet is working, I go to nairaland.com on my browser.

Using the Pingdom tool, the speed for accessing nairaland.com is 1.11 seconds. For google.com, the speed is 904 milliseconds (1000 milliseconds make one second).

Now, this is pretty fast.

But, a lot goes on under the hood to make it possible for you to access websites on the internet at the click of a button.

When I say a lot, I mean a lot.

If you have always wondered what happens under the hood when you type google.com, or any other URL, into your browser, you're in the right place.

I'll work you step by step through the technical stuff that makes it easy for you to enjoy yourself on the internet.

Let's begin.

TCP

When we want to access the internet, we generally talk about "connecting" to the Internet. Throughout this guide, when we talk about connecting, we're talking of TCP, which stands for Transmission Control Protocol.

This is basically a set of rules that prescribe how computers over the internet can talk to each other.

Firewall

A firewall is basically an application on your computer that checks incoming and outgoing connections.

It has a set of rules on which connection to send out and which to take in. It does this for security reasons.

For instance, a malicious application could theoretically send out requests in order to carry out its malicious actions.

If your computer (the client), doesn't normally expect that application to send out a connection request, the firewall flags that connection as suspect and might either not allow the application to connect, or would ask for your permission.

When trying to make a connection on the internet, the firewall checks its settings to make sure that you're allowed to make that request.

There can also be firewalls on the server that receives your connection. This firewall might prevent people from certain banned IPs from accessing the website.

This is why people from certain countries are unable to access some websites.

DNS Lookup

Now that we've handled the fundamentals, let's talk about you typing google.com into your web browser.

But first, we need to understand what "google.com" is. It is basically a domain name. When computers talk to themselves, they use a string of numbers called an IP address.

One of the IP addresses for google.com is 216.58.223.238. If you paste that in your browser, it would lead you to google.com.

However, those strings of numbers are very difficult to remember, which is why we use domain names e.g, google.com.

Now, when you type google.com into your browser, your browser needs to find the IP address for google.com. If you have visited Google sometime in the past, the IP address would be in your hosts file.

If it isn't, then the browser gets the IP address from the DNS Server.

This IP address is usually the address of the server that hosts the websites. A server is basically a computer that lets other computers connect to it in order to display the information it contains.

Your browser uses TCP/IP to access this server, leading us to the next step.

Load Balancer

Imagine a website like Facebook or even Google with billions of users. Using only one server for that kind of website is very risky.

What if the server goes down? What if there's a bug? What if a hurricane wipes off the only server you have for your website? What if the server gets flooded with traffic?

This is where a load balancer comes in.

With a load balancer, you can have multiple servers and switch between each server as the load balancing algorithm dictates.

So, when your browser tries to connect with the IP that the DNS repository provides, it encounters Google's load balancer. The load balancer would then send the connection to one of the many servers it controls.

HTTPS/SSL

Connections over the internet are not secure by default. A hacker listening in on your connection could easily see the data you're transferring.

This is where HTTPS/SSL comes in. HTTPS stands for Hypertext Transfer Protocol Secure. While SSL stands for Secure Socket Layer.

HTTPS/SSL can be installed on the load balancer. This would encrypt the traffic between your computer and the server.

Web Server

The load balancer then sends traffic to a web server. A web server is a server that displays static pages.

Basically, HTML, CSS, and some light Javascript. A static page doesn't have a lot of interaction. It just displays the design of the website. In the case of Google, that's basically this page:

If you want to do things on the website, like signing up or typing your search query, you'll need an Application Server.

Application Server

An application server is a server that runs logical operations.

When you type your search term in Google, it is the logic contained on the application server that determines what happens next.

The logic is basically written in programming languages like C, Python, etc.

Now that the logic has determined what it should do with your search query, it needs to pull information to display the search results. It pulls this information from a database.

Database

A database is basically a method for storing information. Google needs to store the information of billions of websites, and it does that on a database.

There are different types of databases. We have MySQL, SQLite, Oracle, etc.

The logic on the application server passes instructions to the database, requesting specific information. In this scenario, these are the results for your search term.

After getting this from the database, the application server sends it back to the Web Server, which sends it back to the load balancer, and, finally, to your web browser.

Conclusion

What I have written above is a less technical and less detailed overview of what happens when you type Google.com into your browser.

It is a marvel of technology that all this happens in less than three seconds.

So, when next you type in a URL into your browser, you'll have an appreciation for what goes on under the hood.