Two-tier & Three-tier Architecture

Flevian Kanaiza
3 min readAug 19, 2019

--

A ‘tier’ commonly refers to the logical or functional separation of software into layers on different physical locations or hardware. Multi-tier architecture is a pattern of splitting software into several definite domains that handle particular aspects of the software such as presentation, logic or data management. The main areas of focus here are two-tier and three-tier architecture

Two-Tier Architecture

The two-tier architecture is based on the Client-Server model. It consists of Client-Application tier and Database tier. The Client-Application server communicates directly with the Database server. Data or information transfer between the two components is fast due to the absence of a middleware.

The Client-Application contains the codes for interfacing with the user and also for saving data in the database server. The Client-Application sends the request to the server and it processes the request and sends back with data. This means client Application handles both the Presentation layer (application interface) and the Application layer (logical operations). The client-Application layer can be build using languages such as C, C++, Java, Python, PHP, Rails, .NET.

On the other hand, the database server handles the data management layer. Data management layer consists of data storage(database or file system) and methods for storing and retrieving data from the data storage. Commonly used databases include MySQL, MongoDB, PostgreSQL, SQLite. Hosting is possible on-premises or in the cloud.

Two-tiered application examples include desktop applications, games, and music players.

Advantages:

  • It is fast and easy to implement
  • communication is faster
  • It is suitable in an environment where business rules or logic operations are static

Disadvantages:

  • It is not easily scalable, thus performance degrades as users scale.
  • Data integrity issue may arise due to the server responding to multiple requests at the same time.

Three-Tier Architecture

The three-tier architecture is similar to two-tier architecture with the Client-Application tier being divided into two. In other words, it is a modular client-server architecture that consists of a presentation(client) tier, an application tier, and a data tier. A good example is modern web applications.

  1. The Presentational tier is the topmost layer of an application. This interface layer translates tasks and information to something the user can understand. It also takes in user request, sends it to the application layer where it is processed and the result sends back to the user. This layer can be built with HTML, CSS, VBScript, and Javascript frameworks such as React, Angular, Vue.js. Moreover, deployment is possible via web browsers such as chrome, firefox.
  2. The Application tier is the middle layer. This layer contains business rules and logical operations for performing tasks like processing commands, validation, logical evaluations, decision making, database interactions, and web applications structuring. It can be implemented using frameworks such as Django, Rails, Spring, Laravel, .NET. Javascript too can be used when executed on Node.js. Deployment is possible on distributed or dedicated in-house servers such as Nginx, Apache, Puma, Microsoft’s Internet Information Server.
  3. The Data tier is the back-end layer. It is similar to the database server on two-tier architecture.

Advantages:

  • It scales horizontally well due to the distributed deployment of application servers. For instance, when there are more web requests, the presentational layer can load-balanced among the existing servers.
  • It has better reusability of the various components as a result of the separation of concerns(interface, logic and data management).
  • Data integrity is improved due to the existence of middleware between the client and the server.
  • Maintenance is simplified because each layer is treated as an independent entity.
  • Performance is improved due to minimized network utilization as a result of cashing requests at the presentational layer.

3-tier drawback:

  • complexity is increased.

--

--

Flevian Kanaiza

Simple; zealous and curious; Software engineer and in love with technology. Above all GOD FEARING and Ambassador of Jesus Christ