The First Report Of My Challenge | Answered Two Questions

The First Report Of My Challenge | Answered Two Questions

2 questions are covered now.

Yesterday I wrote a blog by setting up a challenge and I gave two questions for the explorers to answer.

After writing a blog, I go so many replies and I am thankful to all of you.

Now it's my turn to answer the questions.

I recorded a video about the same topic also that you can watch and it will help you better understand it.

The first question is:

What is a Load balancer and how it decides which application should get the traffic?

Let's say there is one person who sends a request from his laptop to the app server. The request will first go to the internet and then it will be received by the app server.

This process will go smoothly if you have some users to send the requests but if you have thousands or ten thousand requests at the same time to the app server then it will be really difficult for the app server to handle them.

The solution for this problem is to horizontally scale the servers by adding more of them.

Question ❓

Now the question is who will decide that which request should go to the particular server.

Answer ☝️

The answer to this question is the Load balancer. It is created for the purpose to decide which request should go to the particular server.

Question ❔

Now another question arises how the load balancer decides which application should get the traffic?

Answer ☝️

There are three scenarios through which the load balancer will decide which application should get the traffic.

  1. The load balancer

    • Will send a request to the first app server.
  • If it gets rejected, then it will send it to the second app server.

  • If it gets rejected, then it will send it to the third app server.

  • This will a continuous of sending the requests after every rejection.

  1. The load balancer and the app server will continuously communicate with each other.

    • The load balancer will send a request to the first app server. The app server will respond with a busy message.

    • The load balancer will send a request to the second app server. The app server will respond with a busy message.

    • The load balancer will send a request to the third app server. The app server will respond if it's busy or free.

    • If the app server is free then it will accept the request, otherwise reject it.

  2. The third scenario is not limited to just one method. Instead, there are nine algorithms that will intelligently decide which application should get the traffic.

    • Among those nine algorithms. One is randomly selecting an app server and sending a request to it.

The second question is:

What is 3-tier architecture and how it is different from tier-2 architecture?

2-Tier architecture

In 2-tier architecture, the client will directly communicate with the database server. There will be no middleman present in between.

The business logic will either be handled by the client or the database server itself.

3-Tier architecture

In 3-tier architecture, the client will first send a request to the application server and then the application server will send that message to the database server.

The business logic will be handled by the application server that is present in between.

Difference b/w 2-tier & 3-tier architecture

2-tier architecture

  • works on the client-server architecture.

  • is easy to build and maintain.

  • has slow execution.

  • is less secure because there is no process involved in b/w that solves the issues and bugs.

3-tier architecture

  • works on the application server like the web, desktop, or other apps.

  • is complex more processes are involved in it.

  • has fast execution.

  • is more secure because there is an application server process involved in b/w that solves the issues and bugs.

Next Step

The next step is to solve two more questions that I have added here. You can check them out.

That's it for now. Did you like this blog? Please let me know.

You can Buy Me a Coffee if you want to and don't forget to follow me on YouTube, Twitter, and LinkedIn also.

Happy Learning!