Software Architecture: N Tier, 3 Tier, 1 Tier, 2 Tier Architecture
Software Architecture is a subset of the software design in the Software Development Life Cycle (SDLC). It defines how the important components of software will get organised and assembled.
It should be made clear that application architecture does not involve the building of software, it just schemes the arrangement of key components of the software.
Software architecture tries to make sure efficient communication between these components. It also involves finding out the constraints, to be considered while building the software.
There are three tiers in software architecture
- One-tier architecture
- Two-tier architecture
- Three-tier architecture
We will also discuss the N tier architecture.
Before moving forward to learn about tiers, it must be learned that there exists generally three layers in the application architecture.
- User Interface: It is the layer that is visible to the user and the one with which the user interact. The user gives the inputs and instructions through this and the output is also displayed on it.
- Business Layer: This layer contains all the models and logics provides the functionality to the application. It also acts as an intermediate between the user interface and the database layer.
- Backend or Database layer: This layer store all the data that the software need and the data receive after manipulation.
Whenever any instruction is given by the user on the user interface layer, the business layer uses it’s predefined logics so the manipulation of the database can be done and output is given back on the user interface.
Let’s see how these 3 tiers of architecture are used for the development of various types of application architecture.
One – Tier Architecture
1 tier architecture also known as single-tier architecture, is referred to that kind of software architecture in which all the required components for the working of application are available under the same package.
Image Source: images.app.goo.gl/d5LgD3afi2z3KK1z6
It means that the user interface, business, layers are accessible by the application under the same local drive.
Both the client and server reside in the same machine. It is the simplest application architecture used.
But this tier is not suitable for a web application. As it can only access data available in a single computer or server. MS Office is a prominent example of 1 tier architecture.
This is a cost-efficient architecture and applications based on this are much easier to build.
The major disadvantage of this architecture is that it cannot share information from one client machine to others. Sometimes the applications based on 1 tier are unable to work if some changes are done in the machine.
2 tier architecture is the one in which the user interface layer and the database layer are located in two different machines. It means that the client and the server are not on the same computer.
The client, which is the user side device gives the instructions. Then the server which stores all the data and information is asked to provide the required data or make changes in the existing data.
The business layer is present on the server machine. Both the user interface or the presentation layer and database layer communicate with each other through the Internet, Transfer Control Protocol, Internet Protocol.
It is easy to maintain and modify the 2 tier application architecture. Even the communication between client and server in the form of request and response is very quick.
But the disadvantage with this architecture is that, if the number of clients crosses the capacity then the server finds it unable to respond to the requests made by clients. It decreases the productivity of the server.
The application is also required to be reinstalled in the client if some changes are done in the application. Since the business layer resides on the client-side so the client has to be of high processing power.
Three – Tier Architecture
In 3 tier architecture, the layer, the business layer and the database layer are located in separate machines. Unlike 2 tier architecture, 2 servers perform the major tasks in this application. One server is for the business layer and the other is the database layer.
This architecture is used to design a web application. The client layer request for the data. The application server act as an interface between the client and the server layer.
The application layer helps the client in communicating with the server. It receives the request from the client and sends it to the database, which then responds and the required information reaches the client passing the application layer.
The database layer store all of the data and respond according to the application layer logic. This layer also increases the security of the application.
The main goal of 3 tier architecture is to separate the client application and the physical database, program data independence and support multiple views.
N – Tier Architecture
N tier architecture also referred to as distributor architecture, where n stands for the number of tiers. The difference between the 3 tier and n tier is that there is more than one application server intermediating between the user interface layer and the database layer.
This is done to distribute the business logics among different servers so that all of them can perform individually.
This architecture is very flexible with the increase in the number of databases server. The n tier architecture based application is more secure than the other tiers of architecture.
Even making changes or modification in any layer can be done without affecting the other layer. At any point of time business logic can be modified, or database size can be increased, without touching the client.
Java EE architecture is based on n tier architecture. It has 4 tiers. First one is a client tier, then the web tier and business tier running on Java EE server. After this, there is an EIS server, where EIS stand for Enterprise Information System work as a database tier.
So, tiers in software architecture are the number of machines on which the working of an application is distributed to increase the security, scalability, and productivity of the software.