简体   繁体   中英

Python concurrent REST API

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM