A Web server is part of a multitier application, sometimes referred to as an n-tier application. Multitier applications divide functionality into separate tiers (i.e., logical groupings of functionality). Tiers can be located on the same computer or on separate computers. Figure 19.2 presents the basic structure of a three-tier application.
Figure 19.2. Three-tier application model.
(This item is displayed on page 915 in the print version)
The bottom tier (also called the information tier or the data tier) maintains data for the application. This tier typically stores data in a relational database management system (RDBMS). For example, a retail store might have a database of product information, such as descriptions, prices and quantities of items in stock. The same database also might contain customer information, such as user names for logging into the online store, billing addresses and credit card numbers.
The middle tier (also called the business logic tier) implements business logic to control interactions between application clients and application data. It acts as an intermediary between data in the information tier and the application clients. The middle-tier business logic receives client requests from the top tier (e.g., a request to view a product catalog), retrieves and processes data from the information tier, and sends the result back to the client.
Business logic in the middle tier enforces business rules and ensures that data is reliable before updating the database or sending data to a user. Business rules dictate how clients can and cannot access application data and how applications process data. For example, a business rule can specify how to convert numeric grades to letter grades.
The top tier (also called the client tier) is the application's user interface. Users interact directly with the application through the user interface. The client tier interacts with the middle tier to make requests and to retrieve data from the information tier. The client tier then displays to the user the data retrieved from the middle tier.