可扩展网站的多层架构是否是一种不成熟的优化?

发布于 2024-10-12 05:58:26 字数 147 浏览 2 评论 0原文

我正在设计一个新网站的架构。由于多层架构肯定具有过早优化的所有症状(复杂性、开发时间等),因此我很想在这一点上避免它,但是,我相信在系统编写完成后引入这样的架构(并引入它)正确地)将是非常昂贵的。 我确实相信,如果网站足够大,这样的架构是势在必行的。

你怎么认为?

I am designing the architecture of a new web site. Since multi-tier architecture definitely have all the symptoms of premature optimization (complexity, length of development, etc) I would love to avoid it at this point, however, I believe that introducing such an architecture after the system is written (and introducing it properly) will be very costly.
I do believe that if the site gets big enough, such an architecture is imperative.

What do you think?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沫雨熙 2024-10-19 05:58:26

这取决于您要依赖哪个平台。

您可以使用良好实践并避免层之间的依赖关系来开发 n 层架构,这就是可以发展为 n 层方法的设计。

例如,如果您处于 .NET 领域,借助 Windows Communication Foundation,将非 n 层架构移植到 n 层非常容易,这可以避免您编写大量代码来通过 HTTP、原始 TCP 公开您的服务或者任何您想要用来通信层的协议,甚至是使用它们的客户端代码。

看看领域驱动设计及其相关的设计模式,您就会获胜。

总而言之,您需要分析将解决方案分发到不同层是否会提高其第一个版本的可扩展性。并准备您的设计以轻松支持 n 层。

这是为了避免依赖关系并让程序的每个部分通过共享接口一起工作而分离关注点。

无论如何,在中低使用场景中,与非 n 层网站相比,n 层网站的性能应该较差,这意味着您应该考虑您的应用程序是否需要同时向数千或数百万用户提供内容,这将是n 层场景的成本。

N 层需要专用托管。

您能否提供有关您的项目目标的更多信息? (我的意思是在可扩展性方面)。

It depends on which platform are you going to rely on.

You can develop a n-layered architecture using good practices and avoiding dependencies between layers, and that's having a design that can grow to a n-tier approach.

For example, if you're in .NET arena, porting a non-n-tier architecture to n-tier is easy thanks to Windows Communication Foundation, which avoids you to write a lot of code to expose your services through HTTP, raw TCP or whatever protocol you want to use to communicate tiers, and even client code to consume them.

Take a look to Domain-driven design and its related design patterns and you'll win.

Summarizing, you need to analyze if distributing your solution in different tiers would improve its scalability in your first version. And prepare your design to easly support n-tier.

That is separating concerns in order to avoid dependencies and let each part of your program work together with shared interfaces.

Anyway, n-tier websites should perform bad compared to a non-n-tier one in a low to medium usage scenario, meaning that you should think if your application will need to serve content to thousands or milions of users concurrently and which would be the cost for having an n-tier scenario.

N-tier would need a dedicated hosting.

Can you provide more information about goals of your project? (I mean in terms of scalability).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文