In this post, I will be discussing this concept based on the following
- DNS request
- TCP/IP
- Firewall
- HTTPS/SSL
- Load-balancer
- Web server
- Application server
- Database
- DNS Request: The first step is for your computer to perform a DNS (Domain Name System) request to resolve the domain name "www.google.com" to its corresponding IP (Internet Protocol) address. Your computer sends a query to a DNS server that is responsible for translating domain names into IP addresses. If the browser doesn’t know that domain name (it’s not stored in its cache), it is going to ask the?Domain Name System?for the IP address corresponding to this particular domain name. This IP (Internet Protocol) address is in fact the unique address of the main server hosting the website ?www.google.com. This IP address is just a suite of four numbers ranging from 0 to 255, separated by dots. Domain name came because humans would quickly remember words than to memorize a bunch of numbers with dots. Good enough DNS is here to translate these words into its IP address. The DNS request first goes through the?resolver. The resolver is usually our ISP(Internet Service Provider), and if it doesn’t find the IP in its cache, it’s going to request the?root?server. The root server knows where the?TLD?(Top-Level Domain) server is. In our case, the top-level domain is?.com. Other types of TLD are?.net,?.org, etcetera. If the TLD server doesn’t know the IP, it points the resolver to the?Authoritative Name Servers?for the domain name. Usually, there is more than one name server attached to one domain name. But any of those name servers can give the IP for the domain name they are attached to. Now the resolver has the IP address(for example, 216.58.223.196), and can send it back to the browser(host client) which will perform its request to the corresponding server.
- TCP/IP: Once the IP address is resolved, your computer establishes a TCP (Transmission Control Protocol) connection with the server hosting the Google website. This connection is used to ensure reliable and ordered delivery of data packets over the Internet. It is basically a set of rules on how data will be shared, transfered, broken into packets, received, etcetera between the client and the server over the network.
- Firewall: The connection must pass through any firewalls or security systems that may be in place, which are designed to protect the server from unauthorized access or malicious attacks. It is simply a software that set rules on what traffic should be allowed into or out of the network. In this example, when the browser request for the website with IP address 216.58.223.196 for instance, that request has be processed by a firewall which will decide if it’s safe, or if it’s a threat to the server’s security. The browser itself may be protected by firewall against any malicious threat.
- HTTPS/SSL: Once the TCP connection is established, your browser and the server exchange SSL (Secure Socket Layer) certificates to authenticate each other and establish a secure HTTPS (HTTP Secure) connection. HTTPS encrypts all data sent between your browser and the server, providing a secure and private connection. HTTP and HTTPS requests include GET, POST, PUT, and others. The HTTPS requests and responses are encrypted, which ensure the users that their data can not be stolen or used by third-parties. For example, if we put our credit card information in a website that uses HTTPS, we are guaranteed that this information is not going to be stored in plain text somewhere accessible to anybody.
- Load-balancer: In the case of large websites like Google, traffic is often balanced across multiple servers to ensure optimal performance and prevent overloading of any single server. A load balancer distributes incoming traffic across a set of servers following a load-balancing algorithm in a way that maximizes speed and reliability. HAproxy is a very famous load-balancer, and example of algorithms that we can use are the?round-robin, which distributes the requests alternating between all the servers evenly and consequentially, or the?least-connection, which distributes requests depending on the current state of the server(s).
- Web Server: A web server is simply a computer somewhere in the world that listen to HTTP request and serves static content, like simple HTML pages, images or plain text files. Examples of web servers are Nginx or Apache. Once the HTTPS connection is established, your browser will now send an HTTP (Hypertext Transfer Protocol) request to the web server hosting the Google website. This request contains information about the web page you want to view, such as the URL, cookies, and any other parameters.
- Application Server: The web server then communicates with the application server, which is responsible for generating the dynamic content of the web page based on the user's request. In this case, the application server may access various databases, perform calculations, and run complex algorithms to generate search results. They work behind web servers and will be able to serve a dynamic application using the static content from the web server.
- Database: Finally, the application server communicates with a database server to retrieve and store data, such as user account information, search histories, and other relevant data. A database is simply an organized collection of data, usually stored and accessed electronically from a computer system.
It is magical how what I just explained here happens in a matter of microseconds! This just a glimpse of what goes on behind the scene when we try to access any website for example www.google.com.
Thank you for reading my article. Please don't forget to leave a comment or thumps up!