我正在用Django构建一个web应用程序。我选择Django的原因是:

我想使用免费/开源工具。 我喜欢Python,觉得它是一种长期的语言,而对于Ruby,我不确定,而PHP似乎是一个巨大的麻烦。 我正在为一个想法构建一个原型,并没有过多地考虑未来。开发速度是主要因素,而且我已经了解Python。 我知道迁移到谷歌应用程序引擎将更容易,如果我选择这样做在未来。 我听说Django很“不错”。

现在我越来越接近于考虑出版我的作品,我开始担心规模问题。我找到的关于Django伸缩能力的唯一信息是Django团队提供的(我不是说什么要忽略它们,但这显然不是客观的信息…)

我的问题:

目前在Django上构建的“最大”站点是什么?(我主要通过用户流量来衡量规模) Django能每天处理10万名用户,每个用户访问站点几个小时吗? 像Stack Overflow这样的站点可以在Django上运行吗?


当前回答

如果你想使用开源,那么你有很多选择。但是python是其中最好的,因为它有很多库和一个超级棒的社区。 下面这些原因可能会改变你的想法:

Python is very good but it is a interpreted language which makes it slow. But many accelerator and caching services are there which partly solve this problem. If you are thinking about rapid development then Ruby on Rails is best among all. The main motto of this(ROR) framework is to give a comfortable experience to the developers. If you compare Ruby and Python both have nearly the same syntax. Google App Engine is very good service but it will bind you in its scope, you don't get chance to experiment new things. Instead of it you can use Digital Ocean cloud which will only take $5/Month charge for its simplest droplet. Heroku is another free service where you can deploy your product. Yes! Yes! What you heard is totally correct but here are some examples which are using other technologies Rails: Github, Twitter(previously), Shopify, Airbnb, Slideshare, Heroku etc. PHP: Facebook, Wikipedia, Flickr, Yahoo, Tumbler, Mailchimp etc.

结论是一个框架或语言不会为你做所有的事情。一个更好的架构,设计和策略会给你一个可扩展的网站。Instagram是最大的例子,这个小团队管理着如此庞大的数据。这里有一个关于它的架构的博客,一定要读。

其他回答

如果你想使用开源,那么你有很多选择。但是python是其中最好的,因为它有很多库和一个超级棒的社区。 下面这些原因可能会改变你的想法:

Python is very good but it is a interpreted language which makes it slow. But many accelerator and caching services are there which partly solve this problem. If you are thinking about rapid development then Ruby on Rails is best among all. The main motto of this(ROR) framework is to give a comfortable experience to the developers. If you compare Ruby and Python both have nearly the same syntax. Google App Engine is very good service but it will bind you in its scope, you don't get chance to experiment new things. Instead of it you can use Digital Ocean cloud which will only take $5/Month charge for its simplest droplet. Heroku is another free service where you can deploy your product. Yes! Yes! What you heard is totally correct but here are some examples which are using other technologies Rails: Github, Twitter(previously), Shopify, Airbnb, Slideshare, Heroku etc. PHP: Facebook, Wikipedia, Flickr, Yahoo, Tumbler, Mailchimp etc.

结论是一个框架或语言不会为你做所有的事情。一个更好的架构,设计和策略会给你一个可扩展的网站。Instagram是最大的例子,这个小团队管理着如此庞大的数据。这里有一个关于它的架构的博客,一定要读。

请注意,如果您希望每天有10万用户,并且一次活跃数小时(意味着最多有2万+并发用户),那么您将需要大量的服务器。SO有大约1.5万名注册用户,其中大多数人可能不是每天都活跃。虽然大部分流量来自未注册用户,但我猜他们中很少有人在网站上停留超过几分钟(即他们关注谷歌搜索结果后离开)。

对于这样的容量,预计至少需要30台服务器……这仍然是相当沉重的,每台服务器有1000个并发用户。

目前在Django上构建的“最大”站点是什么?(我主要通过用户流量来衡量规模)

在美国,是Mahalo。我听说他们一个月要处理大约1000万份。现在,在2019年,Mahalo由Ruby on Rails支持。

在国外,Globo网络(巴西的新闻、体育和娱乐网站网络);Alexa将它们排在全球前100名(目前大约排在第80位)。

其他著名的Django用户包括PBS、国家地理、探索、NASA(实际上是NASA内部的许多不同部门)和国会图书馆。

Django能处理每天10万用户,每个用户访问站点几个小时吗?

是的——但前提是您编写了正确的应用程序,并且有足够的硬件。Django不是灵丹妙药。

像StackOverflow这样的网站可以在Django上运行吗?

是的(但请参见上文)。

在技术方面,很容易:请参阅soclone。在流量方面,compete将StackOverflow固定在每月100万次以下。我能说出至少十几个流量超过SO的Django站点。

看看这个叫做EveryBlock的微型新闻聚合器。

它完全是用Django编写的。事实上,正是他们开发了Django框架本身。

不知道每天的访问量有多少,但这里有一些大型Django站点的例子:

Disqus.com(来自djangocon的演讲) bitbucket。org(写作) lanyrd.com(源) support网站(源代码) Addons.mozilla.org(源代码)(来自django的谈话) Theonion.com网站 uk评论系统使用Django(来源) instagram pinterest rdio

这里是Quora上高流量Django网站的链接。