对于高流量 ajax 密集型网站,您会推荐什么?

发布于 2024-07-07 21:14:58 字数 176 浏览 10 评论 0原文

对于像 Reddit 这样的网站,每个主题都有大量的赞成/反对票和大量评论,我应该选择什么?

Lighttpd/Php 还是 Lighttpd/CherryPy/Genshi/SQLAlchemy?

对于数据库来说,MySQL(4.1 或 5?)或 PostgreSQL 哪个扩展性更好/速度最快?

For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?

Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?

and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL?

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

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

发布评论

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

评论(5

铃予 2024-07-14 21:14:58

我无法回答 MySQL/PostgreSQL 问题,因为我对 Postgres 的经验有限,但我的硕士研究项目是关于使用 CherryPy 的高性能网站,如果您使用 CherryPy 来构建高性能网站,我认为您不会感到失望。地点。 它可以在商用硬件上轻松扩展到数千个并发用户。

当然,对于 PHP 来说也是如此,而且我不知道有任何合理的基准来比较 PHP 和 CherryPy 的性能。 但如果您想知道 CherryPy 是否可以处理每秒处理大量请求的高流量站点,答案肯定是肯定的。

I can't speak to the MySQL/PostgreSQL question as I have limited experience with Postgres, but my Masters research project was about high-performance websites with CherryPy, and I don't think you'll be disappointed if you use CherryPy for your site. It can easily scale to thousands of simultaneous users on commodity hardware.

Of course, the same could be said for PHP, and I don't know of any reasonable benchmarks comparing PHP and CherryPy performance. But if you were wondering whether CherryPy can handle a high-traffic site with a huge number of requests per second, the answer is definitely yes.

哭泣的笑容 2024-07-14 21:14:58

理想的设置应该接近这个< /a>:

caching

简而言之,nginx 是一个快速、轻型的网络服务器/前端代理,具有独特的模块,可以直接从 nginx 获取数据。 danga.com/memcached/" rel="nofollow noreferrer">memcached 的 RAM 存储,无需访问磁盘或任何动态 Web 应用程序。 当然,如果请求的 URL 尚未缓存(或者已过期),则请求会像往常一样继续发送到 Web 应用程序。 天才之处在于,当 Web 应用程序生成响应时,会将其副本发送到 memcached,以供重复使用。

所有这些不仅完全适用于网页,而且适用于 AJAX 查询/响应。

在文章中,“后台”服务器是http,并专门讨论mongrel。 如果后面是FastCGI和其他(更快?)框架就更好了; 但这并不那么重要,因为 nginx/memcached 团队承担了大部分负载。

请注意,如果您的 AJAX 流量的 url 方案设计良好(REST 是最好的,恕我直言),您可以将大部分数据库放在 memcached 中,并且任何 POST(将传递到应用程序)都可以抢先更新缓存。

The ideal setup would be close to this:

caching

In short, nginx is a fast and light webserver/front-proxy with a unique module that let's it fetch data directly from memcached's RAM store, without hitting the disk, or any dynamic webapp. Of course, if the request's URL wasn't already cached (or if it has expired), the request proceeds to the webapp as usual. The genius part is that when the webapp has generated the response, a copy of it goes to memcached, ready to be reused.

All this is perfectly applicable not only to webpages, but to AJAX query/responses.

in the article the 'back' servers are http, and specifically talk about mongrel. It would be even better if the back were FastCGI and other (faster?) framework; but it's a lot less critical, since the nginx/memcached team absorb the biggest part of the load.

note that if your url scheme for the AJAX traffic is well designed (REST is best, IMHO), you can put most of the DB right in memcached, and any POST (which WILL pass to the app) can preemptively update the cache.

眼眸 2024-07-14 21:14:58

关于数据库问题,我想说 PostgreSQL 比 MySQL 具有更好的扩展性和更好的数据完整性。 对于小型站点,MySQL 可能会更快,但据我所知,随着数据库大小的增长,它的速度会显着减慢。 (注:我从未将 MySQL 用于大型数据库,因此您可能应该对其可扩展性有不同的看法。)但是 PostgreSQL 确实具有良好的可扩展性,对于高流量来说是一个不错的选择地点。

On the DB question, I'd say PostgreSQL scales better and has better data integrity than MySQL. For a small site MySQL might be faster, but from what I've heard it slows significantly as the size of the database grows. (Note: I've never used MySQL for a large database, so you should probably get a second opinion about its scalability.) But PostgreSQL definitely scales well, and would be a good choice for a high traffic site.

时间你老了 2024-07-14 21:14:58

需要更多数据。 Jeff 有几篇关于相同问题的文章,答案是等到遇到性能问题为止。

首先 - 谁在主持以及他们可以提供什么? 您的内部人才技能是什么? 您要雇用外部公司吗? 他们有什么推荐? 一个愿意学习新框架的团队的全新项目?

第二件事是做一些模型——界面如何工作。 它需要加载和保存哪些数据? 这个想法是保持网络端和数据库端之间的流量下降。 例如,没有包含大量查询的聊天页面。 等等。

一旦您对数据需求和流程有了更好的了解,那么就可以进行数据库设计。 有很多规则需要遵循,但更好的规则之一是遵循规范化规则(是的,我是一个数据库人员,为什么?)

现在您已经构建了几个页面 - 运行您的测试。 你有问题吗? 是的,现在看看它是什么。 页面服务还是数据库拉取? 衡量然后选择行动方案。

Going to need more data. Jeff had a few articles on the same problems and the answer was to wait till you hit a performance issue.

to start with - who is hosting and what do they have available ? what's your in house talent skill sets ? Are you going to be hiring an outside firm ? what do they recommend ? brand new project w/ a team willing to learn a new framework ?

2nd thing is to do some mockups - how is the interface going to work. what data does it need to load and persist ? the idea is to keep your traffic between the web and db side down. e.g. no chatty pages with lots of queries. etc.

Once you have a better idea of the data requirements and flow - then work on the database design. there are plenty of rules to follow but one of the better ones is to follow normalization rules (yea i'm a db guy why ?)

Now you have a couple of pages build - run your tests. are you having a problem ? Yes, now look at what is it. Page serving or db pulls ? Measure then pick a course of action.

ˉ厌 2024-07-14 21:14:58

我会选择 nginx + php + xcache + postgresql

I would go with nginx + php + xcache + postgresql

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