application run slowly under uwsgi threaded mode
You are probably experiencing the python GIL overhead. Try adding a second process to see if results are better.
we use uwsgi + nginx to build the web site. recently, we want to improve the qps of our site, so we decide to switch uwsgi mode from prefork to threaded. but we found something very bad.
when using prefork mode with workers setting 5, we get the request time is 10-20ms. but in threaded mode(one worker 5 threads), the value increase to 100-200ms. this is too bad.
we find memcache.Client take the most time which makes the request time increasing.
please help me to know where the problem is and how to solve, thank you!
PS:
code:
import memcache
client = memcache.Client(['127.0.0.1:11211'])
client.get('mykey')