4

I have a web application that is deployed as follows on web hosting:

  1. Code(without separation of BLL, DAL etc) being uploaded to web hosting
  2. Database (MSSQL backup file) being uploaded to web hosting database

Is this considered a 2-tier architecture or 3-tier architecture?

I have seen different explanation from different sources

  1. If code and database reside on same server, then it is 2-tier. If code and database reside on different server, then it is 3-tier.
  2. A web application with database has a minimum of 3-tier architecture
  3. It is a 2-tier architecture.

Definition of 2-tier by this source
In a 2-tier architecture, web server responds to requests for web pages and a database server provides backend data storage
Definition of multi-tier by this source
In a 3-tier architecture, a web server is linked to a middle-tier layer that typically includes a series of application servers that perform specific tasks, as well as to a backend layer of existing corporate systems

Hope that someone can clarify this.

Plamen G
  • 4,729
  • 4
  • 33
  • 44
vincentsty
  • 2,963
  • 7
  • 34
  • 51

1 Answers1

1

It really depends on what you understand under the term "tiers" in your question.

From infrastructural/physical point of view in most web applications you will have 3 layers:

  • Client (browser) <--> Application Server <--> Database

As opposed to most desktop applications that consist of 2-tiers:

  • Client <--> Database

Note that by this this definition a website is not always 3 tier - you might not have any persistence in a simple site that just calculates compound interest for example.

In the web application architecture itself from logical point of view, you often have layers that are abstract representation the aforementioned tiers - for example in MVC, you will have Models corresponding to the database, Controllers corresponding to the logic performed on server and Views corresponding to what gets presented to the client.

So, infrastructurally, you have a 3-tier architecture (because you are clearly in the first case), but from what you have described, your website itself maybe doesn't follow a strict multi-layered approach and it unites multiple logical layers into one.

See this wikipedia article, it will further clear things up.

Update: Also this thread seems to clarify the issue.

Community
  • 1
  • 1
Plamen G
  • 4,729
  • 4
  • 33
  • 44
  • 1
    So, can i conclude that from infrastructure point of view, any website with database is at least 3 tier architecture while static website which just display information is 2 tier architecture. – vincentsty Apr 20 '15 at 16:09
  • Regarding the layering (logical point of view), is MVC itself is 3-layer architecture by default. eg: Taking ASP.NET MVC as example, by default it have model, view and controller but it is still in single project. which means that it wasn't possible to deploy the model, view and controller separately into different web server. Because I have read on source that state that layering only considered to be valid if the code itself (bll, dal) is being writen in the sense that it can be deployed into different server. – vincentsty Apr 20 '15 at 16:17
  • Your first comment is correct - n-tier is about physical layers, divided by network in most cases. Regarding your second one, you can look at MVC as layers (if you look at each type of component Controllers/Views/Models as an entity) or like components. MVC is just a design pattern. It is not connected to number of tiers. You referred to separation of code in your question - that is why i touched on the topic of MVC in my answer. It is an important distinction between physical tiers and logical components/layers. – Plamen G Apr 20 '15 at 16:42
  • _that state that layering only considered to be valid if the code itself (bll, dal) is being writen in the sense that it can be deployed into different server_ I'm trying to determine this as well @vincentsty, have you come to any conclusion? – Michael Hommé Jun 02 '15 at 21:52