MULTI – TIER COMPUTING
In software engineering, multi-tier architecture (often referred to as n-tier architecture) is a client–server architecture in which the presentation, the application processing, and the data management are logically separate processes. For example, an application that uses middleware to service data requests between a user and a database employs multi-tier architecture. The most widespread use of multi-tier architecture is the three-tier architecture.
N-tier application architecture provides a model for developers to create a flexible and reusable application. By breaking up an application into tiers, developers only have to modify or add a specific layer, rather than have to rewrite the entire application over. There should be a presentation tier, a business or data access tier, and a data tier.
The concepts of layer and tier are often used interchangeably. However, one fairly common point of view is that there is indeed a difference, and that a layer is a logical structuring mechanism for the elements that make up the software solution, while a tier is a physical structuring mechanism for the system infrastructure.
N-Tier and Example
Usually N-Tier Architecture begins as a 3-Tier model and is expanded. It provides finer granularity. Granularity is the ability of a system, in this case, an application, to be broken down into smaller components or granules. The finer the granularity, the greater the flexibility of a system. It can also be referred to as a system’s modularity. Therefore, it refers to the pulling apart of an application into separate layers or finer grains.
One of the best examples of N-Tier Architecture in web applications is the popular shopping-cart web application. The client tier interacts with the user through GUIs (Graphic User Interfaces) and with the application and the application server. In web applications, this client tier is a web browser. In addition to initiating the request, the web browser also receives and displays code in dynamic HTML (Hypertext Markup Language), the primary language of the World Wide Web. In a shopping cart web application, the presentation tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents. It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network. This layer calls custom tags throughout the network and to other networks. It also calls database stored procedures and web services, all in the goal of providing a more sophisticated response. This layer glues the whole application together and allows different nodes to communicate with each other and be displayed to the user through the browser. It is located in the application server.
In N-Tier Architecture, the business logic tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing. For example, in our shopping cart example, this tier completes credit card authorization and calculates things like shipping costs and sales tax. The tools used to encapsulate an application’s business logic into its own layer include web services, custom tags, and stored procedures.
The business tier can also be considered the integration layer. Encapsulation allows the application to communicate with the data tier or the business logic tier in a way that is intelligible to all nodes. Encapsulation is one of the principles of object-oriented programming (OOP) and refers to an object’s ability to conceal its data and methods. Encapsulated objects only publish the external interface so any user interacting with them only needs to understand the interface and can remain ignorant as to the internal specifications. This way a user can call all sorts of services into action by calling the custom tag without having to know the code details of what made communication or implementation possible. The services just have to be accessible in the custom tag library. Encapsulation in the integration tier also liberates the network from just one vendor. The integration tier allows N-Tier Architecture to be vendor independent. In the shopping cart example, the application may have a simple custom tag for searching inventory and providing the most up-to-date, detailed information.
The final application tier is the data tier. It usually consists of database servers. It keeps data neutral and independent from application servers or business logic. Giving data its own tier also improves scalability and performance. As it grows, it is easily moved to another, more powerful machine.
Web server
Web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that can be accessed through the Internet.The most common use of web servers is to host web sites but there are other uses like data storage or for running enterprise applications. The primary function of a web server is to deliver web pages on the request to clients. This means delivery of HTML documents and any additional content that may be included by a document, such as images, style sheets and scripts. A client, commonly a web browser or web crawler, initiates communication by making a request for a specific resource using HTTP and the server responds with the content of that resource or an error message if unable to do so. The resource is typically a real file on the server's secondary memory, but this is not necessarily the case and depends on how the web server is implemented. While the primary function is to serve content, a full implementation of HTTP also includes ways of receiving content from clients. This feature is used for submitting web forms, including uploading of files.
Many generic web servers also support server-side scripting, e.g., Active Server Pages (ASP) and PHP. This means that the behavior of the web server can be scripted in separate files, while the actual server software remains unchanged. Usually, this function is used to create HTML documents "on-the-fly" as opposed to returning fixed documents. This is referred to as dynamic and static content respectively. The former is primarily used for retrieving and/or modifying information from databases. The latter is, however, typically much faster and more easily cached.
Web servers are not always used for serving the World Wide Web. They can also be found embedded in devices such as printers, routers, webcams and serving only a local network. The web server may then be used as a part of a system for monitoring and/or administrating the device in question. This usually means that no additional software has to be installed on the client computer; since only a web browser is required (which now is included with most operating systems).
History of web servers
In 1989 Tim Berners-Lee proposed a new project with the goal of easing the exchange of information between scientists by using a hypertext system to his employer CERN. The project resulted in Berners-Lee writing two programs in 1990:
- a browser called WorldWideWeb;
- The world's first web server, later known as CERN http, which ran on NeXTSTEP.
Between 1991 and 1994, the simplicity and effectiveness of early technologies used to surf and exchange data through the World Wide Web helped to port them to many different operating systems and spread their use among socially diverse groups of people, first in scientific organizations, then in universities and finally in industry. In 1994 Tim Berners-Lee decided to constitute the World Wide Web Consortium (W3C) to regulate the further development of the many technologies involved (HTTP, HTML, etc.) through a standardization process.
MULTI – TIER COMPUTING: Tier separations and interaction
All web applications are N-Tier architectures. We have an application server, a large number of clients, and a database. N-Tier architecture is really a Client-Server architecture combined with the Layered architecture. The reason why I combine Client-Server and N-Tier here is because they are very much related.
N tier-system is a distributed model approach.
Application server can access or communicates other application server and its database too.
The application server can take many forms of TPM, DBMS, Message, CORBA, COM based solution.
Presentation Layer
The first, or presentation tier, a.k.a. the client or front-end, deals with the interaction with the user. Usually, there can be any number of clients which can all access the server at the same time. Currently the clients are mostly thin clients, which mean they do not contain a lot of application code (in contrast to fat clients). Clients process user input, send requests to the server, and show the results of these requests to the user. A common client is made up of a number of dynamic HTML pages that one can access with a web browser.
Application Layer
The second, or application tier, a.k.a. the server, or the back-end, or middleware, processes the requests of all clients. It is the actual web application that performs all functionality specific to the web application. However, it does not store the persistent data itself. Whenever it needs data of any importance, it contacts the database server.
In the logic Tier the application’s functionality is done by performing detailed processing of data from presentation layer. Server such as Apache (or IIS) or Server Script (such as PHP) can be used to support this. With Server (Apache or IIS) the appropriate action to be taken is identified, such as fetching a file, or passing request to an interpreter.
As such support for thousands for concurrent users, multithreading (allow multiple processor to run concurrently) and caching (holding results in a temporary store to reduce recalculation) is achieved). With Server script (example in PHP) interacting with server such as accessing input or generating input is done. It interprets the requests according to business rules and past transactions from this client, and requests appropriate data from the persistence layer. It also computes the derived data and creates HTML (or GIF…) for the page.
The database Layer
The database tier contains the Oracle database server or sql database server , which stores all the data maintained by Application respectively. More specifically, the database tier contains the Oracle or SQL data server files and Oracle or SQL Applications database executables that physically store the tables, indexes, and other database objects for your system. In general, the database server does not communicate directly with the desktop clients, but rather with the servers on the application tier, which mediate the communications between the database server and the clients.
Business logic layer
The information exchange between database and user interfaces. The rules associated with data in the database, typically encode the business policies
An example: automatically adding fees for over dues items. Let’s now apply N-Tier Architecture to our shopping cart example. In this example, we will demonstrate how sales tax is calculated and displayed. Business logic layer deals with data access layer in database layer for example in 2 Tier architecture that contains presentation layer and database layer, the following text box express the example of two tier architecture or explain business logic and data access layer.
The presentation tier formats the response through HTML and forwards it to the client or web browser, where it is displayed to the user. The business logic tier is able to communicate with the data tier through the integration tier. Through encapsulation, the integration tier is able to conceal the complexities of communication. It also retrieves the right tax rate and returns it to the business logic tier. The business logic tier completes its calculations. The presentation tier formats the response through HTML and forwards it to the client or web browser, where it is displayed to the user.
Components of the N-Tier system
A Multi-tier architecture is thus defined by the following three component layers:
- A front-end component, which is responsible for providing portable presentation logic;
- A back-end component, which provides access to dedicated services, such as a database server.
- A middle-tier component, which allows users to share and control business logic by isolating it from the actual application;
The middle tier in most 3-tier application is not implemented as a monolithic program.Instead,it is implemented as a collection of components that are used in a variety of client-initiated business transaction (see fig).
Benefits of N-Tier Architecture
There are many business benefits to N-Tier Architecture. For example, a small business can begin running all tiers on a single machine. As traffic and business increases, each tier can be expanded and moved to its own machine and then clustered. This is just one example of how N-Tier Architecture improves scalability and supports cost-efficient application building.
N-Tier model also make applications more readable and reusable. It reduces the amount of spaghetti code. Custom tag libraries and EJBs are easier to port to readable applications in well-maintained templates. Reusability multiplies developer productivity and improves application maintainability. It is an important feature in web applications.
N-Tier Architectures make application more robust because there is no single point of failure. Tiers function with relative independence. For example, if a business changes database vendors, they just have to replace the data tier and adjust the integration tier to any changes that affect it. The business logic tier and the presentation tier remain unchanged. Likewise, if the presentation layer changes, this will not affect the integration or data layer. In 3-Tier Architecture all the layers exist in one and affect each other. A developer would have to pick through the entire application code to implement any changes. Again, well-designed modules allow for applications or pieces of applications to be customized and used across modules or even projects. Reusability is particularly important in web applications.
As demonstrated N-Tier Architecture offers innovations in the standard Client-Server technology that spawned the Internet itself. It is but one of many web application frameworks. These are used to develop dynamic web sites, web applications or web services. They provide database access libraries, templates, and, as previously stated code re-use. Most web application frameworks follow the Model View Controller (MVC) which separates the user interface, the business rules and the data model. They provide authentication and authorization to provide security. This allows the web server to restrict user access based on pre-determined criteria. Web application frameworks also provide a unified API (Application programming Interface). This allows web application to work with various databases without requiring any code change. These frameworks also maintain a web template system.
Other advantages of Multi-Tier Client/Server architectures include:
- Changes to the user interface or to the application logic are largely independent from one another, allowing the application to evolve easily to meet new requirements.
- Network bottlenecks are minimized because the application layer does not transmit extra data to the client, only what is needed to handle a task.
- When business logic changes are required, only the server has to be updated. In two-tier architectures, each client must be modified when logic changes.
- The client is insulated from database and network operations. The client can access data easily and quickly without having to know where data is or how many servers are on the system.
- Database connections can be 'pooled' and thus shared by several users, which greatly reduces the cost associated with per-user licensing.
- The organization has database independence because the data layer is written using standard SQL which is platform independent. The enterprise is not tied to vendor-specific stored procedures.
- The application layer can be written in standard third or fourth generation languages, such as Java, C or COBOL, with which the organization's in-house programmers are experienced.
- More powerful applications
- Many services to many clients
- Enhanced security, scalability and availability
- Support multiple application more easily common protocol/API
N-Tier Architecture Disadvantages: Explain the points
–Much more complicated to design and model
–Performance risks (concern in the buyer’s mind that the product being considered for purchase will not work efficiently).
–Reliability is more difficult to achieve
–More difficult to maintain software
–Less efficient
–Must learn API(CORBA,RMI,etc)
–Expensive products
–More complex, more faults
–Load balancing is hard
Major Quality Attributes Effects of N-Tier architectures
•Performance
•Reliability
•Usability
•Security
•Availability
•Scalability
•Maintainability
Challenges of N-Tier Architectures
Communication and distribution is usually handled by bought middleware (CORBA, EJB, DCOM, etc)
Software becomes heterogeneous and parallel
A lot to learn about the new technologies
Distributed object application servers are expensive (BEA's Weblogic, IBM's WebSphere)
Designing truly reusable objects is difficult
– the design must be high quality