Modern software applications perform complex, heavy-duty operations, and that is why it is important that such applications are backed by appropriate software architecture. Two-tier software architecture does not enable software applications to handle such complex operations. Given the context, it is a costly and an onerous proposition to maintain and troubleshoot applications based on two-tier architecture. Three-tier software architecture enables applications to seamlessly process huge volumes of varied and complex requests and also maintain data confidentiality. Since all three tiers of the software architecture are independent of one another, maintenance and troubleshooting efforts and costs are relatively lower than that in the case of two-tier architecture applications. Three-tier software applications experience significantly less downtime and indirectly contribute to user experience.
Two-Tier Versus Three-Tier Architecture
There are a number of reasons three-tier architecture is considered superior to two-tier architecture.
Two-tier architecture is unsuitable for applications that need to process large volumes of varied and complex operations because the client directly interacts with the server and the server can be flooded with more requests than it can process. The middleware in three-tier architecture processes operations and requests in the order of their arrival and then sends them to the data access layer.
The client in two-tier architecture is in a lot of ways a fat client, which increases complexities in maintenance and performance as well as increasing costs. In three-tier architecture, independence of tiers provides better performance, maintainability and cost savings. (For more on software development, see Agile Software Development 101.)
What Is Three-Tier Architecture?
Three-tier architecture, as the name indicates, is hierarchical software architecture with three distinct, independent tiers or layers. Three-tier architecture is comprised of the following tiers: presentation, business and data access, in that order, and each tier has a distinct job to perform. The main job of the architecture is to enable software applications to efficiently and quickly respond to user requests or inputs. The image below shows a simplified representation of three-tier architecture.
As can be seen from the above image, the user sends a request through the presentation layer which then sends the request to the business layer. The business layer then processes the request by adding business rules, data rules, business processes and so on, and sends the enriched request to the data access layer. The data access layer accesses the database for the response and sends it back to the business layer which in turn sends the response back to the presentation layer, which displays the information to the user on a user interface (UI).
Roles of the Different Tiers
All three tiers in three-tier architecture can be independent of one another in terms of technology, language, logic and platform, and yet need to constantly interact with each other in order to enable the software applications' work. Since the tiers are independent of each other, their operation, maintenance and troubleshooting are also independent. It is important that the tiers are both backward and forward compatible with all the components of all other tiers.
Presentation Tier
This tier is responsible for accepting inputs or requests from the user and displaying data for the user in a user-friendly format. It accepts inputs and sends the inputs or request to the business logic layer. The presentation tier is used when the user provides inputs through one or more channels such as traditional applications, websites, portals, mobile device websites and apps. In three-tier architecture, the presentation layer is a thin client.
Business Tier
This tier helps define solutions to complex business problems. The solutions or rules can be defined on a number of components that reside inside the tier. Software developers can define complex business algorithms, business processes, government or legal rules or data rules that help keep the data structure consistent with one or more databases. These middle-tier components are not tied to any client and can be used by all applications and moved to all places.
Data Access Tier
This tier interacts with persistent data stored in the database or any permanent storage by constructing SQL queries and executing these queries with the help of relevant APIs. (To learn more about APIs, see Open API: The Future of Application Programming Interfaces.)
Benefits of Three-Tier Architecture
The main benefits of three-tier architecture are described below:
- It is suitable for handling large volumes of complex and varied operations. Since the presentation layer does not interact with the data access layer, the data access layer does not need to handle multiple operations at the same time. The middleware or the business logic tier accepts the requests or inputs from the presentation layer, makes the request suitable for acceptance by the data access layer and then sends it to the data access layer.
- All three tiers in the architecture can be independent of one another in terms of technology, platform, implementation and language. Any tier can be modified, maintained or removed without impacting the other tiers.
- The sizing of each layer can be adapted according to performance requirements.
- It is more scalable since it allows the distribution of application components across multiple servers.
- The architecture provides a framework for creating new applications. Since each tier is independent and specializes in a certain area or domain, it is possible to have more components that are adaptive of this framework. It is just a matter of having more components for the new application that are fitted into this framework.
Practical Implementation
A case study on how three-tier architecture solved real-time business problems is provided below.
The Challenge
Global e-commerce giant eBay wanted to improve its profitability and customer satisfaction by improving the reliability of its website to provide real-time marketplace services all over the world and boost customer satisfaction. According to Chuck Geiger, Vice President of Product Development at eBay, “We wanted to improve the reliability of our website to deliver real-time marketplace services in all regions and also boost customer satisfaction – which would, in turn, impact our bottom line."
The Solution
To find and implement a solution, eBay chose IBM. To cut a long story short, IBM revamped eBay’s existing system and put in place an integrated platform-based three-tier architecture with a web interface in the front-end and back-end databases that manage all customer-related and merchandise information. As a result, eBay developers have a common tool which enables collaboration and sharing of all common Java objects and they can add new website features easily. This has also contributed to improvement of website reliability and customer experience.
Conclusion
While three-tier architecture is almost considered the norm now, for many companies – especially those with limited resources – it is not easy to implement three-tier architecture. It is a complex system and requires big investment in terms of technology, money and skilled personnel. Does that mean that companies with smaller budgets will not be able to achieve efficiency? They can, in their own ways. For example, Ajax is a client-side script that can interact with the server or a database, and such companies can look for clues in such technologies. Also, it needs to be realized that there is no single way of implementing three-tier architecture. The planning and implementation depends on the type of project one is working on and the complexities will be different.