You are on page 1of 3

3 Tier Architecture

This is clearly not a new subject and is well discussed.  Yet, in my experience I have seen many systems
designed the wrong way.  In many projects I have come across die hard believers in one versus the other
approach.  What is rare to come across is some who evaluated the needs of the customer or the
requirements for the application to actually determine which of the two architectures (or others) is
best.  Hence, If felt it would be great if we can jot down all the important notes over this.

Nearly all existing technologies (java/J2EE, .Net, etc.) offer the ability to develop 2 and 3 tier
applications.  I will use here .Net as an example but I believe the concepts remain the same no matter
what technology I use.

Before I start off with 3-tier, let’s first see how a 2 tier architecture helps us in application development
in brief. Their advantages are jotted as follows:-

Advantages of 2 tier Architecture


1. For small scaled applications, 2-tier architecture is very fast when it comes to performance.
This is due to absence of the Application Server avoiding the network hop.
2. Easier development and lesser configuration management making it much easier in
deployment.

The existence of 3-tier comes to picture when we vision it large. Let’s assume that there are 100 users
accessing an application say “Online Ticket Booking”. Now the 2 tier works fantastic with this set up.
Now, when the number of users shoot up to 10 times the current. The response time similarly increases
by same number of times for all the users as all of them are querying the data to the server and
accessing the same database simultaneously. This is where the 3 tier architecture comes to by
introducing an intermediate independent system “The Application Server”. So, let’s now see what we
have in 3-tier architecture.

Typically a 3 tier application has a web server, an application server and a database server (as in at least
3 different physical machines).  It can be pictorially represented as follows :-
Clearly for a 3 tier system to work the code required will have to be different from the code needed to
make a 2 tier system to work.  The reason being, in a 3 tier system, the web server will have to make
requests to code that resides on a physically different machine, i.e., the application server.

Let’s look at a scenario where there are 10k users hitting the same application from a location say “New
York”. Let’s say there are 20 application servers installed to handle the traffic and 5 systems used to
store the data. We will now see how the application server helps in reducing the network traffic and
being very efficient.
Let’s assume the first user has queried for the Flight details from New York to Michigan. And also
assume 500 users(out of 20k) querying the same data. When the user 1 has queried the data i.e. the
Client application requests the Application server for data, the application server queries the Database
server, fetches all the data required and stores it locally for a period of time. This data is immediately
sent to the client and displayed in the client Application GUI. Now, when the user 2 requests the same
data, the same application server which has the data is identified and the data is sent back to user 2.
Here the traffic between the application server and Database server if removed during the user 2
request.
In the 2-tier architecture this would be 2 round trips to database leading for the other users to wait until
the Database server retrieves the data for the current user.
Graphically the data being sent across the Network can be shown as follows :

All the presentation layer objects are generated in Client application, the business layer objects in
Application server and the Data layer objects in Database server.
When a user 2 queried the same data as user 1, the business object used by user 1 is retrieved and sent
to user 2.

The business objects being stored in the application server holds data for a specific time frame only and
that time depends on the business needs of the application.

Let’s now quickly discuss in brief the advantages of 3-tier over 2-tier architecture:

Performance and Load/Throughput:


The response time of the users increase greatly when the user number hits big. All the work is taken by
the application server in reducing the Network traffic. Also if the same data is being queried by users,
then the application server will first make a database call and store the data locally. This data is then
sent to all the rest of users.

Security:
When a client queries the data, it is the application server in realty which queries the database server
and fetches the data for the client. Hence in spite, the client system being prone to intrusions, the data
security is maintained by the application server by letting only web servers to instruct. This increases the
Database security.

You might also like