I am running a uwsgi application on my linux mint. it has does work with a database and shows it on my localhost. i run it on 127.0.0.1 IP and 8080 port. after that i want to test its performance by ab(apache benchmark).
when i run the app by command uwsgi --socket 0.0.0.0:8080 --protocol=http -w wsgi and get test of it, it works correctly but slowly.
so i want to run the app with more than one thread to speed up. so i use --threads option and command is uwsgi --socket 0.0.0.0:8080 --protocol=http -w wsgi --threads 8 for example. 
but when i run ab to test it, after 2 or 3 request, my application stops with some errors and i don't know how to fix it. every time i run it, type of errors are different. some of errors are like these:

(Traceback (most recent call last): 2014, 'Command Out of Sync')

or 

(Traceback (most recent call last):   File "./wsgi.py", line 13, in
  application
      return show_description(id)   File "./wsgi.py", line 53, in show_description
      cursor.execute("select * from info where id = %s;" %id)   File "/home/mohammadhossein/myFirstApp/myappenv/local/lib/python2.7/site-packages/pymysql/cursors.py",
  line 166, in execute
      result = self._query(query)   File "/home/mohammadhossein/myFirstApp/myappenv/local/lib/python2.7/site-packages/pymysql/cursors.py",
  line 322, in _query
      conn.query(q)   File "/home/mohammadhossein/myFirstApp/myappenv/local/lib/python2.7/site-packages/pymysql/connections.py",
  line 856, in query
      self._affected_rows = self._read_query_result(unbuffered=unbuffered) 'Packet sequence number
  wrong - got 1 expected 2',)   File
  "/home/mohammadhossein/myFirstApp/myappenv/local/lib/python2.7/site-packages/pymysql/connections.py",
  line 1057, in _read_query_result

or 

('Packet sequence number wrong - got 1 expected 2',) Traceback (most
  recent call last):

or 

('Packet sequence number wrong - got 1 expected 2',) Traceback (most
  recent call last):   File "./wsgi.py", line 13, in application
      return show_description(id)   File "./wsgi.py", line 52, in show_description
      cursor.execute('UPDATE info SET  views = views+1 WHERE id = %s;', id)   File
  "/home/mohammadhossein/myFirstApp/myappenv/local/lib/python2.7/site-packages/pymysql/cursors.py",
  line 166, in execute
      result = self._query(query)

Please help me how to run my uwsgi application wiht more than one thread safety. any help will be welcome
it has solved.
the point is that you should create separate connection for each completely separate query to avoid missing data during each query execution
uwsgi application stops with error when running it with multi thread