现在的 N 层架构是什么意思? [英] What does N-tier Architecture mean nowadays?

查看:26
本文介绍了现在的 N 层架构是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在传统意义上,N 层意味着将应用程序分成层"并将每个层"放在不同的服务器上.这样做至少有 3 个原因:

In a traditional sense, N-tier means separating the application into "tiers" and putting each "tier" on different servers. This was done for at least 3 reasons:

  1. 维护:

a) 代码维护:更容易进行错误修复和功能添加.

a) Code Maintenance: Easier to do bug fixes and feature additions.

b) 硬件维护:关闭一台服务器不会中断其他层的服务.

b) Hardware Maintenance: Taking one server down does not disrupt service from other tier.

性能:一台服务器的速度通常不够快,无法同时处理 Web 请求、业务逻辑计算和数据库/文件访问.

Performance: One server was often not fast enough to handle web requests, business logic computations, and database/file access at the same time.

可扩展性:特别是水平可扩展性

Scalability: Specifically horizontal scalability

a) 容错:每层能够拥有超过 1 个物理服务器意味着当 1 个服务器宕机时,应用程序仍然可以作为一个整体运行.

a) Fault Tolerance: Ability to have more than 1 physical server per tier means when 1 server is down, the application can still function as a whole.

b) 负载平衡:拥有多个层级实例有助于为大量请求提供服务.

b) Load-balancing: Having multiple instances of a tier helps service large amount of requests.

如今,硬件和网络的速度足以在单个服务器上每秒处理数千个请求.此外,现在 IT 的流行词是整合".因此,即使应用程序被拆分为多个层,它们也可能最终托管在单个服务器上的虚拟机上.

Nowadays, hardware and networks are fast enough to serve thousands of requests per second on a single server. Also, the buzz word for IT right now is "consolidation". So even if the application is split into tiers, they probably will end up hosting on virtual machines on a single server.

我认为现在当人们谈论 N 层架构时,他们谈论的是应用程序中的关注点分离.它更像是一种逻辑分离而不是物理分离.我认为只要我们实现了良好的关注点分离和松散耦合,应用程序就不必是 N 层的.似乎很多程序员都认为 N 层架构是每个 Web 应用程序都必须遵守的黄金标准.

I think nowadays when people talk about N-tier architecture, they are talking about separation of concerns within the application. It is more of a logic separation than a physical one. I think as long as we achieve good separation of concerns and loose coupling, applications do not have to be N-tier. It just seems that many programmers think that N-tier architecture is a golden standard that every web application must comply with.

那么,现在对您来说什么是 N 层架构?

So, what is N-tier architecture to you nowadays?

推荐答案

我阅读的维基百科文章:

From wikipedia article I read:

通常,术语层用于描述物理分布独立服务器、计算机或网络上的系统组件(处理节点).一个三层架构然后将具有三个处理节点.层是指组件的逻辑分组它可能位于也可能不在一个处理节点上.

Generally, the term tiers is used to describe physical distribution of components of a system on separate servers, computers, or networks (processing nodes). A three-tier architecture then will have three processing nodes. Layers refer to a logical grouping of components which may or may not be physically located on one processing node.

我确实认为层"的概念和层"的概念与时间混淆了.我个人喜欢只谈论层而不是层,因为我更喜欢 PAAS 解决方案,我只关心软件,而这个行业正在慢慢朝这个方向发展.

I do think that the concept of "layer" and the concept of "tier" got mixed up with time. I personally like to talk about layers only rather than tiers as I prefer PAAS solutions where my concerns are only on the software, and the industry is slowly moving in this direction.

此外,当您计划可以极大扩展的应用程序时,我仍然认为您不应该考虑 n 层的可扩展性.事实上,拥有大量流量的非常受欢迎的网站只将自己分为 3 个部分:数据库服务器、Web 服务器(包括缓存服务器)和一些 CDN(内容交付网络).这种分离可以在任何应用中实现.

Also when you plan for an application that could greatly expand I still don't think that you should think about n-tier for scalability. In fact, very popular websites with a lot of traffic only separate themselves into 3 components: Database servers, web servers (including the caching servers), and a few CDN (content delivery networks). This kind of separation can be achieved in any application.

但总而言之,我认为程序员应该只考虑应用程序中的层和关注点分离,以实现最重要(也是最困难)的任务:从长远来看可维护性.

But to conclude, I think a programmer should only think abuot layers and separation of concerns within the application to achieve the most important (and difficult) task: maintainability in the long run.

这篇关于现在的 N 层架构是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆