Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a 3 (physical) tier architecture inefficient?

Note: When I refer to tier, I mean a physical tier. Many of the questions on this site relating to "tiers" are referring to logical layers, which is not what I'm asking about.

I am designing an app using a standard "3 layer" architecture, with presentation, business logic (BLL) and data access (DAL) layers. The technology is WPF, C#, LINQ and SQL Server 2008. My question relates to the physical architecture of this app.

I can place the BLL/DAL in a standard DLL which is loaded and run on the user machine, making a 2 tier architecture - client machine and database server. But it is not too difficult to turn the BLL/DAL into a WCF service which sits on an app server and is called from the user machine. This would give me a 3 tier architecture - client machine, app server and database server.

My question is this - what is the advantage of using a 3 tier architecture? I've often been told that 3 tiers add scalability, but it's not immediately apparent to me why this would be. And surely you are going to take a performance hit with the same data having to make two hops over the wire - from database server to app server, then from app server to client machine.

I would appreciate the advice of experienced architects and developers out there.

like image 824
Craig Schwarze Avatar asked Jan 04 '10 02:01

Craig Schwarze


People also ask

What is the disadvantage of the 3-tier architecture model?

It is more complex than the 2-tier client-server computing model, because it is more difficult to build a 3-tier application compared to a 2-tier application. The points of communication are doubled. The client does not maintain a persistent database connection. A separate proxy server may be required.

Is 3-tier architecture still relevant?

For decades three-tier architecture was the prevailing architecture for client-server applications. Today, most three-tier applications are targets for modernization, using cloud-native technologies such as containers and microservices, and for migration to the cloud.

Does 3-tier architecture have limited scalability?

The benefits of using a 3-tier architecture include improved horizontal scalability, performance and availability. With three tiers, each part can be developed concurrently by a different team of programmers coding in different languages from the other tier developers.

Which is more efficient a two-tier or three-tier architecture?

Two-tier architecture runs slower. Three-tier architecture runs faster. It is less secured as client can communicate with database directly.


1 Answers

It depends on the use of your application and your requirement for security. If your application is being used over the Internet, and you're storing anything that is potentially sensitive in any way, adding the physical remove for the database is strongly recommended. Never, ever let anyone from the outside onto any machine with direct access to your database. People can and will attempt to break your security for no better reason than they have nothing better to do.

Scalability can be a factor as well, both in front of the presentation layer (in front of the web servers) and in the database. Placing a load balancer in front of the presentation layer allows incoming requests to be routed to an array of machines that can be managed independently. Machines can be added to the pool in times of need and removed for maintenance. Placing load balancers between the other layers can have the same impact. The idea is to provide a flexible, dynamic back-end environment that can be adjusted as demand requires.

like image 94
jfawcett Avatar answered Oct 04 '22 08:10

jfawcett