Reputation: 5988
I am new to Python, so maybe this is a easy question, but I am planning to do an REST API application but I need it to be very fast and allow concurrent queries. Is there a way to do a application Python that allows concurrent execution and each execution responds to an REST API?
I don't know if threads are a way to go in this case? I know threading is not the same as concurrency, but maybe are a solution for this case.
Upvotes: 0
Views: 1815
Reputation: 77902
If you use a WSGI compliant framework (or even just plain WSGI as the "framework") then concurrency is handled by the wsgi "container" (apache + mod_wsgi, nginx+gunicorn, whatever) either as threads, processes or a mix of both. All you have to do is write your code so it does support concurrency (ie : no mutable global state etc).
Upvotes: 2