4 points · by anon_founder · 12y ago · 8 comments
The more I think about it, the more it sounds like I may need something like nginx for my web service calls (from whatever I have heard about nginx). Can python django really be used in this manner with an appropriate web server and a set of middleware components? If so, can you recommend a particular stack choice? If not, what are my options and can you educate me on the pros and cons of those choices?
1. Long polling: It’s definitely possible to have thousands of long-lived requests with something like gunicorn/tornado. Remember to turn-off buffering in your front-end nginx proxy if you want to use long-polling.
2. Async with web hooks. Gather the request payload, push it to a job queue, and return the response. Process the job queue at your leisure and then call the web hook when complete. You can use celery, beanstalk or my personal choice rq (and django-rq.)
It's pretty simple and straight forward
I guess you want a proxy that you could tell to make an HTTP request on your behalf but would return immediately. And then it would make an HTTP request back to you once it has received the remote response.
Another of our projects is Zurl, which is used for async outbound HTTP. You'd have to write some zmq handler code but potentially it could be appropriated for what you're trying to do.