Django:如何提供用户提交的图像和图像来自单独的多个服务器的缩略图?
对于我的 Django 站点,我想要:
- 接受用户提交的图像
- 从这些图像生成缩略图
- 将原始图像和缩略图放置到专用于提供图像的单独的多个服务器上
我需要多个单独的服务器来提供图像/thumbnails 以确保我有足够的 IO 性能。
构建这样的分布式图像服务系统的最佳方法是什么?有什么开源软件可以提供帮助吗?
谢谢。
For my Django site, I'd like to:
- Accept images submitted by users
- Generate thumbnails from those images
- Put both the original images and the thumbnails onto separate, multiple servers that are dedicated to serving images
I need multiple, separate servers to serve the images/thumbnails to ensure I have enough IO performance.
What is the best way to build a distributed image serving system like this? Any open source software that would help?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来像是分布式任务队列的工作。我个人最喜欢的是 Beanstalkd b/c,它非常轻量且易于使用。
服务器:https://github.com/kr/beanstalkd
客户端库:https://github.com/PeterScott/beanstalkc
Django Helper: https://github.com/jonasvp/django-beanstalkd
工作方式是这样的:
1. 文件上传并存储在本地
2. 通过上传视图创建作业并放入 beanstalk 管中
3. Beanstalk工人正在看着管子工作,他们抢了新工作
4. 工作人员可以创建缩略图并将其分发到您需要的任意数量的服务器
。美妙之处在于您可以让尽可能多的工作人员根据需要从管道中获取数据。因此,如果你落后了,只需解雇更多工人即可。工作人员可以在同一台机器上,也可以在许多单独的机器上,并且一切都会正常工作。
This sounds like a job for distributed task queues. My personal favorite is Beanstalkd b/c it is so lightweight and easy to use.
Server: https://github.com/kr/beanstalkd
Client Library: https://github.com/PeterScott/beanstalkc
Django Helper: https://github.com/jonasvp/django-beanstalkd
The way it would work is like this:
1. File gets uploaded and stored locally
2. Job gets created by upload view and put into a beanstalk tube
3. Beanstalk workers are watching the tubes for work, they grab the new job
4. The worker could create the thumbnails and distribute it to as many servers as you need
The beauty is that you can have as many workers feeding off the tube as is required. So if you ever get behind, simply fire up more workers. The workers can be on the same machine or on many separate machines, and it will all work fine.