4 ms·
There are some use cases in web programming. For example, if a request handler (view, in Django's terminology) is in turn calling out some external endpoints, y
by siddhant 8y ago
There are some use cases in web programming. For example, if a request handler (view, in Django's terminology) is in turn calling out some external endpoints, you don't want those external requests to block other requests to your API. For things like those, async is actually quite nice.
- nsomaru 8y agoYou can mix asynchronous code with Django?
- dec0dedab0de 8y agoYou kick off an async task in celery or use some other way to keep track of it. Then return a key, and have your front end poll for status
- siddhant 8y agoThere are things you can do to achieve async in Django. But I only used Django terminology because Django is more popular than other frameworks.
- zepolen 8y agoAre you talking about blocking other requests to the request handler or to external endpoints? Because both can be solved in a sync server via thread pools.
- viraptor 8y agoIt really depends on how responsive your endpoints are. If they're really slow (or slowly streaming data), you can probably do hundreds/thousands via thread pools. (depends how you do the dispatch / locking) You can go orders of magnitude higher with async. (as in epoll - specific async frameworks may have their own bottlenecks)