What is an N-layer structure?

Source: Internet
Author: User
What is an N-layer structure?

 

N-Layer Structure
(N-tiers Structure
Multi-layer running Architecture
) Is relative to the two-layer structure. Traditional C/S
Computing is mostly based on two-level Mode
In this mode, all the formal logic and business logic reside in the client
Server becomes a database
Server, responsible for processing and maintaining various data. As a result, the server becomes very thin, known as the "thin server )". In contrast, this mode needs to be
Run huge applications
This is the so-called "fat client )".

Layer-N Architecture
(N-tiers
Structure, multi-layer running architecture) Layer 4 refers to presentation tier (presentation layer, that is, the interface directly presented to the user), web server tier (Web server layer) application server tier (application server layer) and data tier (data layer ).



Early network systems were often designed with a three-tier structure. The most common structure is the presentation layer, domain layer, and infrastructure layer.

The N-layer structure is proposed to adapt to the current B/S
Module
Development of web applications. The traditional brown model refers to: presentation layer (presentation), control/mediation layer (
Controller/Mediator, domain, data mapping, and Data Source
(Data source ). It is actually in a three-tier architecture
Added two middle layers
. The control/mediation layer is located between the presentation layer and the domain layer, and the data ing layer is located between the domain layer and the infrastructure layer.

J2EE
The specification puts forward its own N-tiers structure.


The following table compares several models.

 

Isa Brown J2EE Layer Corresponding program section
Presentation Layer Presentation Layer Customer Layer Browser HTML page, XSL, mobile client, etc.
Server presentation layer JSP and actionform, XML
  Control/mediation Layer   Controller and action
Domain Layer Domain Layer Business Layer JavaBeans/sessionbean/Session Facade
  Data ing Layer Integration Layer Entitybean/JDO
/Hibernate/jdbc
Data Layer Data Source Layer Resource Layer RDBMS Database

One of the basic principles of J2EE is to minimize the decoupling or coupling of each layer. The final implementation can be implemented to switch any layer.

For example, in the data ing layer, you can use EJB
You can also use o/rmapping such as hibernate or JDO. This is determined by the deployment environment.

 

I. Main Problems in the n-layer architecture (n-tiers structure, multi-layer running Architecture)

  
First, the system reliability is reduced. A client/server system is a variety of hardware and software independently developed, manufactured, and managed by each other.
The inherent reliability is not as good as that of a single, central-managed mainframe or minicomputer. In case of problems, it is difficult to get technical support and help immediately.
  
Second, the maintenance cost is high. Although this application mode improves production efficiency to some extent, because the client needs to install a large and complex application, when the number of network users reaches a certain number, as the amount of system maintenance increases dramatically, it is very difficult to maintain the application system.
  
Third, waste of system resources. As the size of the client grows, the requirement for client resources increases. Although the hardware is constantly updated, the new operating system
The continuous emergence of new application software makes hardware updates unable to keep pace with software updates. The customer had to install a large number of software on the local hard disk, but most of them were used only a small portion (generally less than 10% ). In an environment with many "fat clients", this is undoubtedly a huge waste.
  
 
 
Finally, the system lacks flexibility. Because the logic is combined with the interface, the client/server needs to develop applications independently for each application, without reusability. However, the computing mode of the fat client still cannot meet the daily requirements.
Needs of growing applications. In the process of expanding to a wide area network (such as the Internet), due to the rapid increase in the amount of information, dedicated clients can no longer meet the needs of multiple functions.
. The network computing mode is extended from the two-layer mode to the n-layer mode, and is combined with dynamic computing to solve this problem.
  
 
 
The core of the N-layer architecture is to provide the scalability feature. On the one hand, the service load can be scaled to provide services for extremely large scale users at the same time, and on the other hand, the service functions can be scaled, huge rules can be formed
The software group system of the model. Each subsystem can share information and services to form an enterprise-level information expressway.
The N layer can be placed on different hardware systems respectively, so it is highly flexible and can adapt to the increase in the number of clients and handle load changes. For example, you can add the loading function when appending new services.
Layer server. Therefore, the larger the system scale, the more obvious the advantages of this form.

Ii. Main advantages of the N-layer architecture (n-tiers structure, multi-layer running Architecture)

In addition, the N-layer structure is logically independent from each other. Changes in a layer usually do not affect other layers and are highly reusable. In addition, the N-layer structure has the following advantages:
  
1. A single access point can be used to access the database of the site anywhere;
  
2. Use the same interface for various information sources, whether text or graphics;
  
3. All information, regardless of its platform, can be accessed through the same interface;
  
4. cross-platform operations are supported;
  
5. Reduce the cost of the entire system;
  
6. Easy maintenance and upgrade;
  
7. Good openness;
  
8. Strict security management;
  
9. System Management
Simple and supports heterogeneous databases with High Availability
  
The interface layer is responsible:
Collect information
Send information to the logic layer for processing
The logic layer receives processing results
Show the result
......
  
The logic layer is responsible:
Receiving interface input
Interacts with the data layer to execute the designed business
Operations (business logic, system services, etc)
Send the processing result to the interface layer.
......
  
The data layer is responsible:
Data Storage
Data Acquisition
Data Maintenance
Data Integrity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.