具有大量图像服务的可扩展 Web 应用程序
我开始开发网络应用程序。 该应用程序需要大量图像处理。 我从 PHP 开始,因为它是最简单且最便宜的托管。 我之前的一些应用程序中使用过 .NET 框架,并且我对 Python 非常满意。
但我现在使用 PHP 一点也不舒服,所以我决定使用一些对我来说更简单的东西。
任何人都可以帮助我了解 .NET 框架还是 Python(目前 web.py 对我来说看起来不错) 考虑到大量图像处理,假设每秒大约 200 个请求,比其他人有一些优势吗?
如果有人能为他们推荐一个合适的主人,我也将不胜感激。
编辑:
抱歉造成混乱。 通过图像处理,我的意思是应用程序的用户可以上传将存储在平面文件系统中的图片,而他们的条目位于数据库中。
通过图像处理,我的意思是我也需要为这些图像创建缩略图,以便在应用程序中使用。
I started working on a web application. This application needs lot of image handling. I started off with PHP as it was the easiest and cheapest to host. I have used the .NET framework for some of my previous applications and I'm very comfortable with Python.
But I'm not at all comfortable using PHP now, so I have decided to use something easier for me.
Can anyone help me understand if the .NET framework or Python (currently web.py looks good to me)
has some edge over others, considering a lot of image manipulation and let's say about 200 requests per second?
Also I would appreciate if someone can suggest a proper host for either of them.
EDIT:
Sorry for the confusion. By image handling I mean the users of the application are allowed to upload pictures that would be stored in the flat file system while their entries are in the database.
By image manipulation, I mean I would need to create thumbnails for these images too which would be used in the application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如前所述,任何数量的开发平台都可以工作,这实际上取决于您缓存内容的方法。
如果您熟悉 Python,我会推荐 Django。 该框架有一个大型的开发社区和许多大型应用程序和站点。
Django 内部通过使用 memcached 支持缓存。 您可以极大地自定义想要缓存的方式和内容,同时能够在实际的 Django 应用程序中保留许多缓存设置(在使用我无法完全控制的第三方托管服务时,我发现这很好系统的)。
以下是一些可能有帮助的链接:
有许多托管公司提供共享和专用托管计划。 我会访问 http://djangohosting.org/ 来确定哪个主机最适合您的需求。 我经常使用 WebFaction 并且对他们的服务非常满意。
As mentioned previously, any number of development platforms will work, it really depends on your approach to caching the content.
If you are comfortable with Python I would recommend Django. There is a large development community and a number of large applications and sites running on the framework.
Django internally supports caching through use of memcached. You are able to customize quite greatly how and what you want to cache, while being able to keep many of the settings for the caching in your actual Django application (I find this nice when using third party hosting services where I do not have complete control of the system).
Here are a few links that may help:
There are a number of hosting companies that offer both shared and dedicated hosting plans. I would visit http://djangohosting.org/ to determine which host may work best for your need. I have used WebFaction quite a bit and have been extremely pleased with their service.
请购买 Schlossnagle 的书,可扩展的互联网架构。
您不应该从 Python(或 PHP 或 .Net)提供图像,而应该从 Apache 和 Squid 提供图像。 Javascript 和 CSS 文件也是如此——它们是静态媒体,Python 永远不应该接触它们。
您应该只处理交易的 HTML 部分。
顺便说一句,这就是像 Django 这样的架构。 静态媒体在 Python 外部处理。 Python 处理验证和处理的 HTML 部分。
事实证明,您将花费大量时间与 Squid 和 Apache 打交道,试图让事情进展得更快。 如果你限制 Python(和 Django 框架)的职责,它们就足够快了。
Please buy Schlossnagle's book, Scalable Internet Architectures.
You should not be serving the images from Python (or PHP or .Net) but from Apache and Squid. Same is true for Javascript and CSS files -- they're static media, and Python should never touch them.
You should only be processing the HTML portion of the transaction.
This, BTW, is the architecture you get with things like Django. Static media is handled outside Python. Python handles validation and the HTML part of the processing.
Turns out that you'll spend much of your time fussing around with Squid and Apache trying to get things to go quickly. Python (and the Django framework) are fast enough if you limit their responsibilities.
如果您希望在提供图像时获得性能,则必须采用 FaceBook 的方法“除非绝对必要,否则永远不要访问磁盘”——这意味着在图像服务器和最终用户之间使用尽可能多的缓存。 有许多产品可以帮助您解决商业和免费的问题,包括正确配置您的网络服务器 - 谷歌并查看哪些产品适合您的成本和平台。
If you want performance when serving images, you have to take the FaceBook approach of 'never go to disk unless absolutely necessary' - meaning use as much caching as possible between your image servers and the end user. There are many products that can help you out both commercial and free, including just configuring your webservers correctly - google and see what works for your cost and platform.
根据您所写的内容,.NET 或 Python 对您来说都是不错的选择。 就我个人而言,我会选择 Python。 为什么?
说实话,您的选择并不重要 - 只需选择您觉得舒服的那个并坚持下去即可。您提到了 web.py - 该网站是用 web.py 制作的:colr.org - 它由 1304 行代码组成,不包括外部库。
From what You have written, either .NET or Python would be a good choice for You. Personally, I would go for Python. Why?
To be honest Your choice is not important - just choose the one You feel comfortable with and stick with it.You mentioned web.py - this site is made with web.py: colr.org - and it is made with 1304 lines of code, not counting external libraries.
我认为切换语言对解决您的问题没有多大帮助,这只是您最初选择的架构仅适用于少量数据。 我建议您访问 http://highscalability.com ,是时候开始了解大公司如何扩展他们的应用程序了。
I do not think switching languages will help much with your problem, It's just the architecture you chose initially only works for small amounts of data. I would recommend you to visit http://highscalability.com , It's time you started looking how the big guys scale their applications.
我还建议查看 MogileFS。 它是一个在基于 Unix 的操作系统上运行的分布式文件系统。 我知道 digg 用它来存储他们的头像图像。
它来自创建 Memcached 和 Live Journal 的同一个人。
I would also recommend looking at MogileFS. It is a distributed file system which runs on Unix based OS's. I know that digg use it to store their avatar images.
It's from the same guys who created memcached and live journal.