2 tier vs 3 tier: Note: Before knowing the differences, it is advised to go through Introduction to 2-tier and 3-tier Architecture.
Table on 2 tier vs 3 tier
Feature | 2-Tier | 3-Tier |
---|---|---|
Administration | Complex as business logic and database exist on one system | Simple as layers are separated |
Security | Less secured as client can talk to database directly | Highly secured as client is not allowed to talk to database directly |
Scalability | Poor | Excellent as requests can be load balanced between servers |
Services | Not required as business logic application and database are tight-coupled. | Application server may use services like RMI or JMS etc. |
Performance | Poor as second-tier should execute both business logic and database queries | Good as processing is distributed between 2nd and 3rd tiers. |
Deployment costs | High as no granularity exists | Less and ease due to builder tools |
Infrastructure | No extra infrastructure is required due to tight-coupling | Infrastructure of middleware services can be used |
Reusability | Mostly clients are monolothic and thereby reusability not possible | Reusability more with services implementation |
Legacy integration | No | Yes, possible through gateways and business objects |
Hardware flexibility | Very limited as only one client and one server exist | Best with component-based environments to distribute services between 2nd and 3rd tiers |
Heterogeneous database support | Only database should be used | Multiple databases can be used even within the same transaction |
Support for Internet | Poor as bandwidth limitations may take more time for download fat client programs | Best to download client programs as services supporting downloading are distributed |
Availability | Can use backup servers | If one server fails, the services can be executed on other services |
Communication choices | Only connection-oriented and synchronous methods calls are permitted | Can support connectionless messaging, publish-subscribe and broadcast messaging etc. |
2 tier vs 3 tier: Points to note prone to different opinions:
- There is no clear cut demarcation in security. Many people favour 3-tier for security. Sometimes, even when a 3-tier approach is not taken good care, it ends in less secured.
- As 2-tier applications are easier to develop with less complexity, overall they are less expensive.
- Keeping the client program compatible with the server program, in long run, is difficult which can be overcome in 3-tier. In 3-tier also, sometimes the security patches installed on server may trouble the client.