Search⌘ K
AI Features

Basic Architecture of Systems

Explore the basic architecture of systems by understanding client-server communication, key protocols such as TCP/IP and HTTP, and the role of DNS in mapping domain names to IP addresses. This lesson helps you grasp how distributed systems function and their importance in scalable and reliable system design, essential for technical program management interviews.

The strength of a structure depends on its foundation, so it is very critical to understand the basics very well. This lesson will help us understand how the client communicates with the server. Also, it will explain other fundamental elements of any system, like TCP, IP, HTTP, Cache, etc.

Many types of architecture are used to build systems. The most common ones are peer-to-peer and client-server architecture. The difference between the two architectures is that peer-to-peer focus on network sharing. Meanwhile, the client-server focuses on information sharing, where the central server stores the data. Let us understand them in detail and see how they are used in designing systems.

Client-server architecture

Client-server architecture is a critical part of system design that gets used in a lot of the systems. The internet is a good example of client-server architecture. All computers talk to each other through a client-server architecture.

Now, let’s understand how it works.

The client requests some data and the server gets the appropriate response for it. In other words, the server listens to incoming requests that come through networks and serves its clients.

The client and server are connected through the network. In distributed systems, components can be anywhere but complete their job independently.

We will take a famous interview question as an example here to understand this in detail:

“What happens when you enter a URL, such as www.educative.io, but the client cannot find the site’s server?”

Protocol

Protocol refers to a set of rules required for communication across the web. Different types of protocols exist depending on the use case of the application. For our above example of www.educative.io, the protocol will be HTTP or HTTPS.

HTTP is the most common protocol used for web applications. It is an TCP/IP protocol that delivers HTML and image files with their results over the World Wide Web. The default port for this protocol is 80.

DNS

The most important part of our above question is DNS. DNS solves the big puzzle of routing the request to the appropriate server. As we have read above, the client may not know where the www.educative.io server exists in the world.

All the communication happens over the network, and every machine has an address that makes it unique. Hence, the server of www.educative.io has a valid address. We need some mapping between a human-friendly name like www.educative.io and its IP address which uniquely identifies it. This mapping problem is solved by DNS.

DNS stands for Domain Name System. DNS give us human-readable addresses that the computer can use to find the IP address. This is useful because it would be nearly impossible to remember the IP address of sites but it is easy to remember DNS names. Hence, DNS plays a huge role in our internet and how we access websites today.

Now, we might be thinking of DNS as some mapping directory. But do you know how many websites exist today, and whether it is scalable to put all entries into one?

We need to analyze many factors before designing a solution. For example, we need to account for redundancy, replication, latency for clients, etc. We know it is hard to have a scalable standalone server to serve the requests on time around the globe.

DNS as a distributed system

DNS works as a distributed system, and its components are in different locations which communicate through the network.

It is a massive hierarchically distributed system where different independent servers maintain their registries and serve their clients.

DNS has all the features of a distributed system, such as fault-tolerance, high availability, consistency, scalability, security etc.

How does DNS works

  • Caching is everywhere. Every browser keeps track of a DNS cache by saving the recently searched websites of a user. As we type www.educative.io in our browser, it has a DNS cache of the browser. If DNS finds the record, it returns the address to the browser and sends a request.

  • In case, our browser cache does not contain an IP address for www.educative.io. Then, the user machine sends a request to their Internet Service Provider (ISP). When our ISP has the IP address, then the request is answered with a cached address.

  • Let us say even the ISP cache does not have an answer for our request. Then it goes to the DNS resolver. The DNS resolver is a server that queries the name by starting from the root server. It has records of top-level domain (TLD) server details. In our case, educative.io is the website which means .io is the top-level domain server to which the root server will point. Hence, “io” is a top-level domain.

  • After that, the search goes recursively from the top-level domain. It queries the server within the Educative realm. It finds the IP address for the second-level domain, named “educative”.

  • Lastly, DNS saves the result in the cache for a limited time. It does not have to go back to the domain server next time.

Conclusion

We have seen in a client-server architecture that all communications and requests happen over the network. HTTP is the most common form of protocol for communication between client and server.

Client requests and sends its queries while the server processes them and sends the response over the network.