uWSGI for uploading and processing files

后端 未结 1 1784
生来不讨喜
生来不讨喜 2021-01-03 11:21

I have a python web application written in bottlepy. Its only purpose is to allow people to upload large files that will be processed (takes approximately 10-15 minutes to p

相关标签:
1条回答
  • 2021-01-03 12:12

    If the file upload takes minutes, how will uWSGI be capable of handling other clients without blocking?

    It will block. A solution is to put a webserver like NGINX in front of uWSGI that pre-buffers the POST request. So the file upload will be actually bound to an NGINX handler until is completed and then passed to the uWSGI handler.

    Is there any way the processing can be offloaded using built in functionality in uWSGI so that the user get a response after upload and can query for processing status?

    You need to create a task queue system to offload the processing from the web handler. This is a common best practice. Just look around for python task queues. For builtin functionalities it really depends on the task you need to offload. You can use the builtin uWSGI spooler, or the uWSGI mules. These are very good alternatives to a typical task queue (like the very famous Celery) but have limitations. Just try it yourself in your scenario.

    0 讨论(0)
提交回复
热议问题