[英]Key factors for designing scalable web based application
Currently I am working on web based application. 目前我正在开发基于Web的应用程序。 I want to know what are the key factors a designer should take care while designing scalable web based application ?
我想知道设计人员在设计可扩展的基于Web的应用程序时应该注意哪些关键因素?
That's a fairly vague and broad question and something you could write books about. 这是一个相当模糊和广泛的问题,你可以写一些书。 How far do you take it?
你走多远了? At some point the performance of SQL JOINs breaks down and you have to implement some sharding/partitioning strategy.
在某些时候,SQL JOIN的性能会崩溃,您必须实现一些分片/分区策略。 Is that the level you mean?
这是你的意思吗?
General principles are: 一般原则是:
Having a good read of highscalability.com should give you some ideas. 好好阅读highscalability.com应该会给你一些想法。 I highly recommend the Amazon articles.
我强烈推荐亚马逊的文章。
Every application is different. 每个应用程序都不同。 You'll have to profile your application to see where you should concentrate your optimization efforts.
您必须分析您的应用程序,以了解您应该将优化工作集中在哪里。 Some web applications might require database access optimizations, while others have complicated business logic that cause the bottleneck.
某些Web应用程序可能需要数据库访问优化,而其他Web应用程序则具有导致瓶颈的复杂业务逻辑。
Don't attempt to optimize random arbitrary parts of you application without first profiling. 在没有首次分析的情况下,不要尝试优化应用程序的随机任意部分。 You might end up having to support complicated optimized code that doesn't actually make your application snappier.
您可能最终必须支持复杂的优化代码,这些代码实际上并不会使您的应用程序变得更加快捷。
I get the sense from the other answers here that there is a general confusion between scalability and performance. 我从其他答案中得到的结论是,可伸缩性和性能之间存在普遍的混淆。 High performance means that the response is quick.
高性能意味着响应迅速。 High scalability means that you get a response no matter how many others are also using the site at the same time.
高可扩展性意味着无论有多少人同时使用该网站,您都会得到响应。 There's a big difference.
有很大的不同。
In fact, you actually have to sacrifice a little performance just to get good scalability. 实际上,为了获得良好的可伸缩性,您实际上必须牺牲一点性能。 A general pattern to scalability is distributed computing.
可伸缩性的一般模式是分布式计算。 Factoring functionality out into separate tiers of clustered servers (web, business rules, database) is the usual approach to scalability.
将功能分解到不同的集群服务器层(Web,业务规则,数据库)是可扩展性的常用方法。 That extra round trip will slow down page load a little bit.
额外的往返行程会减慢页面加载速度。
Everyone always wants to focus on high scalability but also don't forget that, for software vendors who sell licenses to customers who self host the application, scaling down can be just as important as scaling up. 每个人都希望专注于高可扩展性,但也不要忘记,对于向自托管应用程序的客户销售许可证的软件供应商而言,缩小规模与扩展规模一样重要。 An application that can run on a single server for ten users but can also be configured to run on a ten server web cluster, a three server middle tier, and a four server database cluster for 10,000 users would be a system well designed for scalability.
可以在单个服务器上为10个用户运行但也可以配置为在10个服务器Web集群,3个服务器中间层和4个服务器数据库集群上运行的应用程序,可用于10,000个用户,这是一个专为可扩展性而设计的系统。
None. 没有。 Just code the application using proper design techniques (separation of concerns, etc) and then when the application is done or nearly done, do your performance testing.
只需使用适当的设计技术(关注点分离等)对应用程序进行编码,然后在应用程序完成或接近完成时进行性能测试。 You'll find the real bottlenecks then - they won't be what you might have guessed in the beginning.
你会发现真正的瓶颈 - 它们不会是你在开始时猜到的。 This is where your proper design from the beginning comes into play - it makes it easy to make changes to fix the bottlenecks.
这是您从一开始就正确设计的地方 - 它可以轻松地进行更改以修复瓶颈。
Sometimes, a specific answer is more helpful than just generic tips. 有时,特定答案比通用提示更有帮助。
If you want to scale, the only thing to target is SPEED (in hardware and software) and RESOURCES (in hardware). 如果要扩展,唯一要定位的是SPEED(在硬件和软件中)和RESOURCES(在硬件中)。
Hardware, the latter is expensive (more servers, load-balancers, etc.). 硬件,后者是昂贵的(更多的服务器,负载平衡器等)。
So, by carefully selecting your initial development framework you will save a lot of time and resources -up to several orders of magnitude. 因此,通过仔细选择您的初始开发框架,您将节省大量时间和资源,达到几个数量级。
For example, nginx is (much) faster than Apache. 例如,nginx比Apache快得多。
Other solutions are faster than nginx (for both static and dynamic contents) but I could not disclose them without being censored on StackOverflow (it was rated SPAM & advertising despite the fact that this is a FREE solution). 其他解决方案比nginx更快(对于静态和动态内容)但我无法在没有被StackOverflow审查的情况下透露它们(尽管这是一个免费的解决方案,它被评为垃圾邮件和广告)。
That's the limits of "sharing": we must share only "acceptable" solutions rather than efficient solutions. 这就是“共享”的局限:我们必须只分享“可接受的”解决方案而不是有效的解决方案。
Cheers, 干杯,
Pierre. 皮埃尔。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.