System Design for Noobies..

The Application under the hood

System Design for Noobies..

Have you ever wondered how an application works with so many users? Have you ever experienced latency when accessing a website?

image.png

This can be attributed to the poor design of an application.

What is System Design? Systems design is the process of defining the architecture, interfaces, and data for a system that satisfies particular requirements. After you have your requirements for your system, the next step is translating them into technical specifications so you can construct your system.”

Lets gets some basic...

User wants to access the site let's say hashnode.com in the browser

image.png What do you think is going to happen? You're right it will hit the server but first Browser don't know what the heck is "hashnode.com" then browser call his friend called DNS (Domain Name System). For now, think DNS as the phonebook of the Internet.

image.png Browser sends the domain name to DNS, then DNS replies with an IP address, which is then forwarded to the server. Voila! You now have a basic understanding

image.png

That's pretty interesting, isn't it...let's dig deeper

Now Hashnode.com is getting popular day by day with more users, if more users more traffic right.

image.png

Is our server capable of handling thousands of users? Let's say our server ram configuration is 1GB? Is it enough to handle our users request?? More users, more traffic, more resources required. NO, right! As users increase utilization of resources also increases which can decrease the performance of the site. So, what is the solution? Yeh we can increase server configuration for e.g., ram size to 1 to 5GB will it solve the problem. Hash node is growing more users are interested in blogging from 100 to 10000 users. will server handle more than thousand plus requests? This increase of resources like RAM, CPU and HDD etc. in a single server is called Vertical Scaling this solution is limited to small application and not feasible in Realtime. Another solution is adding more servers of similar configuration which can help to avoid a single point of failure. This is known as Horizontal Scaling

image.png If there are multiple servers then which server should be served by incoming request? We can't just add multiple servers. We need to divide the traffic among the servers. To divide the server, we need another tool which helps to divide traffic equally among the servers called Load Balancer (LB). LB can be hardware or a software component which balances the traffic among the server.

image.png Now finally you have found the solution to scale your system to hundreds of thousands of users. But one group of users is accessing "hashnode.com" from LA, USA but the server is far away in HYD, India which is more than 13080 km. Do you think users can access sites faster after installing multiple servers and a load balancer? NO, it might delay the request and response user might get frustrated. image.png So, what should we do now? Let's Invite server friend called CDN content delivery network which helps to store static data like your website data .html, .CSS and .js etc... CDN provides a cache mechanism which helps to serve response faster to the users.

image.png Whenever a fresh request is made by a single user it will fetch the response directly from the server and store the static data in the CDN. if again the different users made same request response is served from CDN not from server. This helps to prevent loading on server and increase response rate. Tadaa... :)

image.png

Here's the complete picture

image.png As a result, you have gained a basic understanding of how a system works.

To be continued.....

Follow for more ;)