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

时间:2022-10-09 06:53:35

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

对于像reddit这样的网站,有很多上/下投票和每个主题的很多评论,我该怎么办?

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

Lighttpd / Php或Lighttpd / CherryPy / Genshi / SQLAlchemy?

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

而对于数据库来说,什么会扩展得更好/最快的MySQL(4.1或5?)或PostgreSQL?

5 个解决方案

#1


8  

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.

我不能谈论MySQL / PostgreSQL问题,因为我对Postgres的经验有限,但我的硕士研究项目是关于使用CherryPy的高性能网站,如果你使用CherryPy,我认为你不会失望现场。它可以轻松扩展到商用硬件上的数千个并发用户。

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.

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

#2


8  

The ideal setup would be close to this:

理想的设置将接近于此:

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

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.

简而言之,nginx是一个快速轻巧的Web服务器/前端代理,具有独特的模块,可以直接从memcached的RAM存储中获取数据,而无需访问磁盘或任何动态Web应用程序。当然,如果请求的URL尚未缓存(或者它已过期),则请求照常进入webapp。天才部分是当webapp生成响应时,它的副本转到memcached,准备重用。

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

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

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.

在文章中,'后'服务器是http,特别是谈论mongrel。如果后面是FastCGI和其他(更快的?)框架会更好;但是它不那么重要,因为nginx / memcached团队吸收了最大的负载。

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.

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

#3


3  

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.

在DB问题上,我会说PostgreSQL比MySQL更好地扩展并且具有更好的数据完整性。对于一个小型站点,MySQL可能会更快,但据我所知,随着数据库大小的增长,它会显着减慢。 (注意:我从来没有将MySQL用于大型数据库,所以你应该对它的可扩展性有所了解。)但PostgreSQL肯定能够很好地扩展,并且对于高流量站点来说是个不错的选择。

#4


2  

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.

现在你有几个页面构建 - 运行你的测试。你有问题吗?是的,现在看看它是什么。页面服务或db拉?然后衡量一个行动方案。

#5


2  

I would go with nginx + php + xcache + postgresql

我会选择nginx + php + xcache + postgresql

#1


8  

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.

我不能谈论MySQL / PostgreSQL问题,因为我对Postgres的经验有限,但我的硕士研究项目是关于使用CherryPy的高性能网站,如果你使用CherryPy,我认为你不会失望现场。它可以轻松扩展到商用硬件上的数千个并发用户。

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.

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

#2


8  

The ideal setup would be close to this:

理想的设置将接近于此:

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

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.

简而言之,nginx是一个快速轻巧的Web服务器/前端代理,具有独特的模块,可以直接从memcached的RAM存储中获取数据,而无需访问磁盘或任何动态Web应用程序。当然,如果请求的URL尚未缓存(或者它已过期),则请求照常进入webapp。天才部分是当webapp生成响应时,它的副本转到memcached,准备重用。

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

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

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.

在文章中,'后'服务器是http,特别是谈论mongrel。如果后面是FastCGI和其他(更快的?)框架会更好;但是它不那么重要,因为nginx / memcached团队吸收了最大的负载。

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.

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

#3


3  

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.

在DB问题上,我会说PostgreSQL比MySQL更好地扩展并且具有更好的数据完整性。对于一个小型站点,MySQL可能会更快,但据我所知,随着数据库大小的增长,它会显着减慢。 (注意:我从来没有将MySQL用于大型数据库,所以你应该对它的可扩展性有所了解。)但PostgreSQL肯定能够很好地扩展,并且对于高流量站点来说是个不错的选择。

#4


2  

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.

现在你有几个页面构建 - 运行你的测试。你有问题吗?是的,现在看看它是什么。页面服务或db拉?然后衡量一个行动方案。

#5


2  

I would go with nginx + php + xcache + postgresql

我会选择nginx + php + xcache + postgresql