I have a FileField that uses django-storages' S3BotoBackend to upload audio files to to Amazon S3. The audio files can be up to 10MB in size, and a user can upload multiple files in the same form. The upload time can be very long and blocks. In order to speed up processing, I thought about writing a custom storage backend that inherits S3BotoBackend and submits jobs to a beanstalk queue before uploading to S3.
我有一个FileField使用django-storages的S3BotoBackend将音频文件上传到Amazon S3。音频文件的大小最大可达10MB,用户可以以相同的形式上传多个文件。上传时间可能很长并且阻塞。为了加快处理速度,我考虑编写一个继承S3BotoBackend的自定义存储后端,并在上传到S3之前将作业提交到beanstalk队列。
Are there any easier alternatives to speed up the user experience?
有没有更简单的替代方案来加速用户体验?
1 个解决方案
#1
2
If you want to speed things up, you'll want to have your Web server more engaged with handling uploads. You can check out out the Nginx upload module for Nginx, though you can accomplish much of the same using any Web server.
如果您想加快速度,您需要让您的Web服务器更多地参与处理上传。您可以查看Nginx的Nginx上传模块,尽管您可以使用任何Web服务器完成相同的操作。
For this approach, you'll configure a view that's going to receive a request once a file has been successfully uploaded by the user, which would then be the opportune moment to queue the file to be uploaded to S3.
对于这种方法,您将配置一个视图,该视图将在用户成功上载文件后接收请求,这将是将文件排队上传到S3的合适时机。
This will allow you to asynchronously receive multiple uploads from a user and asynchronously send the files to S3, which should cover just about everything you could do to improve the file upload experience.
这将允许您异步接收来自用户的多个上载并异步将文件发送到S3,这应该涵盖您可以执行的所有操作以改善文件上载体验。
#1
2
If you want to speed things up, you'll want to have your Web server more engaged with handling uploads. You can check out out the Nginx upload module for Nginx, though you can accomplish much of the same using any Web server.
如果您想加快速度,您需要让您的Web服务器更多地参与处理上传。您可以查看Nginx的Nginx上传模块,尽管您可以使用任何Web服务器完成相同的操作。
For this approach, you'll configure a view that's going to receive a request once a file has been successfully uploaded by the user, which would then be the opportune moment to queue the file to be uploaded to S3.
对于这种方法,您将配置一个视图,该视图将在用户成功上载文件后接收请求,这将是将文件排队上传到S3的合适时机。
This will allow you to asynchronously receive multiple uploads from a user and asynchronously send the files to S3, which should cover just about everything you could do to improve the file upload experience.
这将允许您异步接收来自用户的多个上载并异步将文件发送到S3,这应该涵盖您可以执行的所有操作以改善文件上载体验。