Software architecture is the organization of components in a system that includes how they interact with each other, the environment they operate in, and the principles used to design the software. Web application architecture is the conceptual description of the interactions between different components from the user interface, backend servers, cache servers, and databases.
Through this article, you will learn different types of tiers, examples, advantages, and disadvantages.
Tiers
As defined by Wikipedia, A tier is a term used to describe the physical distribution of components of a system on separate servers.
Types of Tiers
Single Tier Applications
In a single-tier application, all the elements: the user interface, the backend logic, and the database are in one place. A good example is Microsoft Office, where the user installs the application on their computer. They can easily access the files from their computer since they are available locally.
Advantages of Single Tier Applications
- High performance due to no network latency since every component is located in the machine
- Data safety and privacy are high since the user's data is always on the machine and does not need to be transmitted.
- Cost of development is less
Disadvantages of Single Tier Applications
- Not scalable, cannot be accessed remotely
- Vulnerable can easily be reverse-engineered and used for purposes not intended by the publisher
- Inconsistent aesthetics due to being dependent on the user's machine
- Does not support remote access
- High cost of maintenance due to the monolithic nature
Two-Tier Applications
Two-tier applications have application logic and the user interface on the client while the server contains the data stored. An example of a two-tier application is a music player.
Advantages of Two-Tier Applications
- Few network calls to the backend server result in low latency due to having the user interface and business logic in the same machine.
- High performance, fewer network calls result in low cost to keep the server running, thus being an economical solution
- Development is easy due to its simplicity
- Fast prototyping of applications through robust tools, thus maximizing customer satisfaction
Disadvantages of Two-Tier Applications
- Lack of scalability when client requests increase over a threshold leading to degradation of the database performance
- The logic is coupled, which makes it challenging to re-use it
- Changes made to the application have to be distributed to all clients leading to administrative overhead
- Difficulty in database redesign since other applications will become dependent on the existing database structure
Three-Tier Applications
Three-tier applications are organized into three tiers the logical and physical tier, application tier, and data tier.
- The logical and physical computing tier is where the user interacts with the application
- The application tier is where data is processed using a set of business rules
- Data tier is where processed information is stored and managed.
The logical and physical computing tier contains the presentation or the user interface. The application is where data is processed, and the data tier stores and manages the application data.
Communication in the three-tier goes through the application tier. The physical tier and data tier cannot communicate directly. An excellent example of a three-tier application is a web application built by React and Tailwind as the interface, Django as the backend, and PostgreSQL as the database.
Advantages of Three-Tier Applications
- Distributed deployment of application servers improves scalability. Any tier can be scaled independently of others as required.
- Enhanced security since clients do not interact with the database directly
- Reliability is improved since redundant server availability makes it easier to create an application that will recover the system from network or server failures
- Faster development since different teams can work simultaneously on different tiers.
Disadvantages of Three-Tier Applications
- Improved complexity since points of communication are doubled
- Increase in network traffic if a separate proxy server is used.
- Physical separation of application servers containing business logic may affect performance
- A separate proxy may be required. A proxy server serves as an intermediary server that forwards requests for content from clients to servers across the internet. It allows a client to make an indirect network connection to a network service.
N-Tier Applications
N-tier applications include dividing the architecture into logical layers and physical tiers. Layers are differentiated from tiers in that layers are the logical organization of code while tiers are the physical separation of components. Layers separate responsibilities and manage dependencies. Layers at a higher level can use services from a lower level, but the lower level cannot use services from a higher level.
An N-tier application can have a closed layer architecture or an open layer architecture. In a closed layer architecture, a layer can only call the next layer immediately down. In an open layer architecture, a layer can call any layers below it. A closed-layer architecture limits the dependencies between layers. However, it might create unnecessary network traffic if one layer passes requests to the next layer. Application Architecture Guide, Microsoft
An excellent example of an application that used an N-tier application is Instagram.
image from wikimedia
Advantages of N-Tier Applications
- Each tier can be secured separately, thus improving security
- Manageable since each tier can be updated without affecting another tier
- Portability between different cloud platforms
Disadvantages of N-Tier Applications
- Managing network security can be difficult in an extensive system
- The complex structure due to the componentization of the tiers may be challenging to maintain.
Conclusion
Knowing the different tiers helps you understand the tradeoffs made to build good software applications.
Credits
Wikipedia hackr.io quora Geeksforgeeks Techopedia Dotnetspider IBM Martini geeks stackify