我正在用Django构建一个web应用程序。我选择Django的原因是:
我想使用免费/开源工具。
我喜欢Python,觉得它是一种长期的语言,而对于Ruby,我不确定,而PHP似乎是一个巨大的麻烦。
我正在为一个想法构建一个原型,并没有过多地考虑未来。开发速度是主要因素,而且我已经了解Python。
我知道迁移到谷歌应用程序引擎将更容易,如果我选择这样做在未来。
我听说Django很“不错”。
现在我越来越接近于考虑出版我的作品,我开始担心规模问题。我找到的关于Django伸缩能力的唯一信息是Django团队提供的(我不是说什么要忽略它们,但这显然不是客观的信息…)
我的问题:
目前在Django上构建的“最大”站点是什么?(我主要通过用户流量来衡量规模)
Django能每天处理10万名用户,每个用户访问站点几个小时吗?
像Stack Overflow这样的站点可以在Django上运行吗?
"What are the largest sites built on Django today?"
There isn't any single place that collects information about traffic on Django built sites, so I'll have to take a stab at it using data from various locations. First, we have a list of Django sites on the front page of the main Django project page and then a list of Django built sites at djangosites.org. Going through the lists and picking some that I know have decent traffic we see:
Instagram: What Powers Instagram: Hundreds of Instances, Dozens of Technologies.
Pinterest: Alexa rank 37 (21.4.2015) and 70 Million users in 2013
Bitbucket: 200TB of Code and 2.500.000 Users
Disqus: Serving 400 million people with Python.
curse.com: 600k daily visits.
tabblo.com: 44k daily visits, see Ned Batchelder's posts Infrastructure for modern web sites.
chesspark.com: Alexa rank about 179k.
pownce.com (no longer active): alexa rank about 65k.
Mike Malone of Pownce, in his EuroDjangoCon presentation on Scaling Django Web Apps says "hundreds of hits per second". This is a very good presentation on how to scale Django, and makes some good points including (current) shortcomings in Django scalability.
HP had a site built with Django 1.5: ePrint center. However, as for novemer/2015 the entire website was migrated and this link is just a redirect. This website was a world-wide service attending subscription to Instant Ink and related services HP offered (*).
"Can Django deal with 100,000 users daily, each visiting the site for a couple of hours?"
Yes, see above.
"Could a site like Stack Overflow run on Django?"
My gut feeling is yes but, as others answered and Mike Malone mentions in his presentation, database design is critical. Strong proof might also be found at www.cnprog.com if we can find any reliable traffic stats. Anyway, it's not just something that will happen by throwing together a bunch of Django models :)
当然,还有更多感兴趣的网站和博主,但我必须在某个地方停下来!
一篇关于使用Django构建高流量网站michaelmoore.com的博文,将其描述为排名前10,000的网站。Quantcast数据和compete.com数据。
(*)编辑的作者,包括这些引用,曾经在该项目中作为外包开发人员工作。
我认为问题并不在于Django的伸缩性。
我真的建议你研究一下你的架构,这将有助于你的扩展需求。如果你弄错了,Django的性能就没有意义了。性能=规模。你可以拥有一个具有惊人性能但无法扩展的系统,反之亦然。
您的应用程序是否绑定了数据库?如果是,那么你的规模问题也存在。你打算如何与Django中的数据库交互?如果数据库处理请求的速度不及Django接收请求的速度,会发生什么?当您的数据超出一台物理机器时会发生什么。你需要考虑如何应对这些情况。
此外,当你的流量超过一个应用服务器时会发生什么?在这种情况下,如何处理会话是很棘手的,通常情况下,您可能需要一个共享的“无”架构。这取决于你的应用。
简而言之,决定规模的不是语言,而是语言的性能(同样取决于您的应用程序,不同的语言表现不同)。正是您的设计和架构使扩展成为现实。
我希望它能有所帮助,如果你有问题,我很高兴能进一步帮助你。