What's The Advantage Of Running Multiple Threads Per UWSGI Process?
If I'm performing blocking operations like querying a database, then what is the advantage? How does this add extra worthwhile capacity?
Solution 1:
Python's native multithreading is affected by GIL limitations. Simply put, only one Python thread at a time is physically executed. An exception to this are blocking IO calls (e. g. DB query) that let other Python threads take over, which may increase performance of IO-bound operations.
So the real performance gain would only be possible if your application is mostly IO-bound. However, in this case you should consider making the app asynchronous, which uWSGI also supports.
Otherwise you should keep your app single-threaded and use multiprocess uWSGI to scale up.
Post a Comment for "What's The Advantage Of Running Multiple Threads Per UWSGI Process?"