The following content is both my understanding and the translation of the content, the title of the translation is:
<<expert C # Business Objects >>http://www.douban.com/subject/3442908/
N -tier architecture, including two aspects of the architecture. On the one hand, N-tier 's physical architecture, on the one hand, is the logical architecture of n-tier . In general terms, the physical architecture is the architecture of computers and other ancillary hardware, layered to achieve high-performance performance, high-scalability Scalability, high- safety Security, and high fault tolerance Fault tolerance; logical architecture refers to the code design aspects of the architecture, code layering, the main purpose is to facilitate our developers, the main benefits:
L make the code more logical
L Easier Maintenance
L Better Code reuse
• A better team development experience
L Clearer code responsibilities
In the benefits of n-tier physical architecture, high performance and scalability, high security, and high fault tolerance are inversely proportional and need to be measured at design time. In fact, the lower the number of layers, the higher the performance, reduce the network traffic, but other performance will be reduced, other performance if high, it means adding more layers, at least to increase the validation, increase the error processing, which will lead to performance loss.
This requires us to design for the specific customer environment, such as the banking system, then his security good fault tolerance is certainly more important than high performance, it is worthwhile to use security in exchange for some performance losses, but some of the requirements of high-real-time, user experience more important occasions, the security status is relatively lower, To ensure the timeliness of processing, to ensure the performance of the site or system.
The logical N-tier architecture, where I quote csla.net 's design,5-layer login Architecture.
The role of the five layers is
Layer |
Roles |
Interface |
Presenting information to users and collecting input from users |
Interface Control |
Plays a role between the user and the logical layer, handing the user's input to the logical layer, and then returning the result to the user |
Business Login |
Provides all business logic rules, validation, operations, handling, and application security assurances |
Data Access |
Play an intermediary role in the business logic layer and data management layer, packaging and including all data access technologies, databases and data structures |
Data Storage and Management |
Physical creation, acquisition, updating, and deletion of data stored in persistent storage |
The five layers of logic can be distributed in a single physical environment or in a multi-layered physical environment, one layer of logic can be distributed over multiple physical layers, and multiple layers of logic can be distributed in a physical layer.
In a two-tier physical environment, the data storage and management layer is usually separated, that is, with a separate server installed MS SQL or Oracle database management system, so that the database management system fully play its role.
In a two-tier physical architecture,MS SQL Server can handle up to one or more concurrent requests. The two-tier physical architecture greatly improves performance, but they are less scalable than the three-tier physical architecture. A good rule is that if you have more than a few concurrent users, you 'd better separate the data access layer and make up a three-tier physical architecture.
Another reason for separating the data access layer is security. Because the data access layer contains direct interaction with the database, the machine where the data access layer resides is trusted by the database server, and instead of placing that trust on a client machine, it is better to separate it in an application server. This way the user's computer is not directly trusted by the database server, which increases the security of the database server.
It is also possible to distribute the business logic layer on an application server, which brings benefits to non-interactive processing, such as batch updates, dense business data calculations, and so on. Most applications allow users to interact, so there is a clear need to spread the business logic layer across an application server to enhance interactivity.
As I said earlier, you can distribute a layer of logic across multiple physical layers, and you can distribute the database access layer across an application server and distribute the business logic layer in the client application and application server tiers. In . NET , if all user-linked databases use the same user ID and password, you can use connection pooling to manage all users. This allows you to use fewer database connections in place of each customer's direct connection to the database server. In practice, these need to depend on the details of the application, but this means that two or three database connections can support up to five concurrent volumes.
Of course, in doing so, all requests go through the external network, which increases the potential problems (such as performance degradation). The cost of this performance in exchange for large scalability, because this physical configuration than 2-tier can handle more concurrent requests.
Deploying the business logic layer on both the client and server side, this application can fully play the strengths of both computers. Some authentication and business processing can be placed on client computers, which provides a rich and good customer interaction experience, while non-interactive processing can also be run efficiently on the application server.
If the design is good, such a schema can support concurrent requests from the forward user, while providing sufficient performance assurance.
Best-performing Web client
In WPF and WinForm applications, good system performance is achieved with fewer physical layers. However, such exchanges are not the same in Web scenarios: While increasing performance and scalability, the cost of security is also demonstrated below.
In order to get the best performance in a Web application, it is advisable to run most of the code in a single machine environment.
The interface layer must be physically detached because he is running in the browser, but the interface control layer, the business logic layer, the data access layer can be run on the same physical machine, and processed simultaneously. Sometimes you'll put physical storage together, but this only works for very small applications.
The above image shows the best performance and can get good scalability because the Web server can make a part of the Web server farm and all Web servers run the same code.
This type of installation provides a good database connection pool because each Web server can handle hundreds of requests and all database connections are in the pool.
Unless the connection from the farm is predominant, there is no need to isolate the application server because the additional application server adds the physical layer, which provides scalability while also reducing performance. It is necessary to consider fault tolerance in such an environment, because a large number of application servers will have a point of failure.
High-security Web Client
As we have discussed earlier, many of our projects stipulate that the Web server cannot access the database directly. The Web server must be running in the DMZ(military containment area), sandwiched between the external firewall and the internal firewall. Web servers must interact with one service on the internal firewall and internal databases or other systems. A dashed code firewall.
In the WinForm solution, this business logic layer is deployed on both the Web server and the application server in a way that brings many benefits.
Separating the data access layer and running it in a distributed Application server increases the security of the application. However, this has led to a performance loss, which has been discussed earlier. This configuration will probably lead to degraded performance 50%. From another point of view, this configuration is very extensible. For example, the first Web configuration, you can improve scalability by implementing a farm class, each of which runs the same interface control layer and business logic code.
"Blog" http://virusswb.cnblogs.com/
"MSN"[email protected]
"Reprint" http://www.cnblogs.com/virusswb/archive/2009/12/15/1624962.html
"description" Reproduced please indicate the source, thank you
N-tier Architecture N-tier architecture (RPM)