WEB APPLICATIONS-2-tier or 3-tier architecture

Let’s for an example, I created a web application that which the students of College of Technology, Pantnagar use to find their respective marks in different subjects.
The database of marks resides on the local server of College and application resides on client’s(i.e the students) computer. When a student wants to know his marks, he uses the application interface to access his personal account. This program then queries the database and application returns with the respective marks of a particular student.

This is the example of a 2-tier architecture. Here the 2-tiers are:

  1. Data Server– database serves the data based on the SQL queries i used in my application code.
  2. Client Application– application on students computer presents the data from database in a readable format.

Now there won’t be a problem until the users were in less numbers, problem arises when the number of students using this application is very large!!

Because every time a student queries the client application, the server has to serve up large queries for the client application to manipulate which is a very hectic task for server as there will be an enormous drain on the n/w resources.

So, now we create a 3-tier architecture by inserting another program at the server level, known as server application. Now the client application will not query the database directly but will first query the server application which will further  query the data server.

Now when student wants to know his/her marks the following  will occur:

  1. The student asks the client application.
  2. The client application asks the server application.
  3. The server application queries the data server.
  4. The data server serves a record with all the student’s grades.
  5. The server application does all the calculations to determine the marks.
  6. The server application sends final marks to the client application.
  7. The client application displays the final grade for the student.

Note that here the client application is your WEB BROWSER. Server application(3rd tier) is the ASP code which queries the database.