如何重写/重新编码网站以使其可扩展?
如何重写一个可扩展的网站?(流量)我主要使用 PHP 和一些 Ruby on Rails,我知道这是一个普遍问题。我只是想增加我的知识,所以任何建议都会有用。
先感谢您 ;-)
How do you rewrite a website to be scalable?(traffic) I work with mainly PHP and some Ruby on rails and i know its a generic question. I'm just looking to increase my knowledge so any advice would be useful.
Thank you in advance ;-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是一个相当广泛的问题,很难给你一个明确的答案——但有几个想法:
还有一些可能会给您一些想法的快速链接:
This is a quite wide question, and it's going to be pretty difficult to give you a definite answer -- but a couple of ideas :
And a quick couple of links that might give you some ideas :
一个技巧 - 使用 memcached 或同等版本,而不是直接查询数据库。
此外,扩展最困难的部分是超越单个 Web 服务器。一旦您可以扩展到两个 Web 服务器,那么扩展到更多服务器就不会有太大问题。
One tip - cache data using memcached or an equivalent, instead of querying the database directly.
Also, the most difficult part of scaling is moving beyond a single web server. Once you can scale to two web servers, you should not have much trouble scaling to many more.
获得 PHP 加速器,您的性能绝对会得到显着提升,Wikipedia 有一个很好的列表从中选择。正如 Justin 所说,使用 memcached,这太棒了。
Get a PHP accelerator, you will definatly have a noticable performance increase, Wikipedia has a nice list to choose from. And as Justin said get memcached, it is amazing.
“规模”不是一个普遍的、具体的现象,而是在一组特定标准下对绩效和能力的相对衡量。因此,您需要一组标准和一些指标,以使此对话具有任何意义。
我发现 Apdex 是思考和推理所需指标的非常有用的机制:
像 Apdex 指数这样的系统的优点在于,它与用户对满意的应用程序响应能力的看法直接相关。在任何关于规模和性能的讨论中,这些是唯一真正重要的事情。
因此,例如,当以这种方式考虑您的系统时,您可以确定满足用户对响应能力的期望所需的响应率,估计需要支持的流量水平,然后添加容量以满足您的目标。
"Scale" isn't a universal, concrete phenomena, but a relative measure of performance and capacity under a specific set of criteria. So you need a set of criteria and some metrics in order for this conversation to have any meaning at all.
I have found Apdex to be a very useful mechanism for thinking and reasoning about the metrics required:
The beauty of a system like an Apdex Index is that it is directly related to users' perceptions of satisfactory application responsiveness. These are the only things that actually matter in any discussion of scale and performance.
So, for example, when thinking about your system in this way, you determine the response rate required to meet your user's expectation of responsiveness, you estimate the level of traffic you will need to support, then add capacity to meet your targets.