One of the topics I often get asked about by clients and server administrators is the three tier web application framework. Although it is pretty straightforward to describe, there are some important considerations when deploying a three tier web application framework, especially if it is meant to scale to a very large implementation. The trend today seems to be moving toward a model control view (MVC) framework, but that is a totally different framework that I will cover in another post. Essentially, the three tier web application framework seeks to separate the web application into three parts, which run on three different physical machines, and utilize the power of the three pieces of hardware to speed up the process. An additional but crucial benefit of this model is that it separates the process into tiers that can scale individually to handle large amounts of traffic. Let's start out with a picture to illustrate the three tier web application framework. This picture comes courtesy of tqnyc.org.
As you can see from this illustration, the three tiers that make up the three tier web application framework are the client tier, application tier and data tier. The interaction between these tiers is well defined, strictly enforced and rarely circumvented.
The client tier is probably the most diverse in terms of possible configurations, but it is pretty much the same with respect to structure across its variations. Each client has its own operating system. A web browser runs on top of the operating system. The Sun Java Runtime Environment is often running on these systems as well in order to extend functionality beyond simple HTML rendering. Some additional pieces of software may also be installed such as Flash to enhance the users' multimedia experience. Typical operating systems at this tier include various distributions of Linux such as Ubuntu, RedHat and SUSE, Microsoft Windows and Mac. Typical web browsers include Mozilla Firefox, Safari, Opera and Internet Explorer.
The application tier can also be of various composition, but the typical setup is Linux with Apache and PHP. This typical setup is often referred to as a LAMP stack (minus the M which is part of the data tier.) A similar implementation with Microsoft Windows Server, Internet Information Services (IIS) and the .Net framework is also widely used. Various other platforms exist that will run on the Linux/Apache and Windows/IIS stacks such as Ruby on Rails. All of these frameworks are meant to extend usability and provide for rapid development.
The data tier is comprised of the database or XML files that hold all of the data for the system. Databases are the most widely used applications in the data tier, so we will focus on those. In a LAMP stack, the M stands for mySQL which is an open source database application. On the Microsoft side, SQL Server (current version is 2005) is the database application of choice. There are other alternatives such as PostgreSQL which focus on specific database functionality needs. The SQL, or structured query language, is what allows the application tier to search the database and read or write to it. The database remains the single repository of all data in the system instead of having a plethora of random files stored all over the place.
As you can see, the three tier web application framework is not too difficult to dissect and understand. When referring to the LAMP stack, often an administrator will run all of the stack on a single server. This is fine for a small web application or web site that will not have heavy traffic. If you plan to have large amounts of traffic such as a social networking site, the separation of each tier is what allows you to scale the framework. By placing all data on a database, that database can later be cloned and mirrored many times over. This results in multiple databases with identical data being served to a multitude of web servers. These large groupings of databases and web servers are often referred to as farms. Just as one farm may grow a lot of corn and another may grow a lot of wheat, these server farms may have many databases or many web servers in each. In a large scale environment, hardware load balancers such as F5's BigIP take incoming requests from clients on the web and spread them evenly among the web servers in the farm. This is a truly large scale three tier web application framework. This type of distributed application provides stability, speed and redundancy - all of which are vitally important to a business who is deploying this type of framework. There are various other ways to tweak and implement the three tier web application framework, but they are often more complex and outside of the scope of this post. This post is meant to provide information for someone who is not current with the web frameworks available. If you need more information, I am always up to discuss web frameworks via email.