issues when using pycassa with uwsgi
-
14-11-2019 - |
문제
We are using pycassa with uwsgi. There are about 16 uwsgi processes.
It is strange that one process can get the data which is queried by another process. e.g. there is one row in column family A, looks like:
{row_key, {'column_a': 1, 'column_b': 2}}
process 1 run: get(row_key, columns=['column_a', ])
process 2 run: get(row_key, columns=['column_b', ])
but, sometimes, process 1 got value of column_b, process 2 got value of column_a.
Is this a known issue of connection pool?
Any response is appreciated.
해결책
Open a connection for every worker using the uwsgi.post_fork_hook api function
import uwsgi
def myconnect(...):
global_connection = ...
uwsgi.post_fork_hook = myconnect
제휴하지 않습니다 StackOverflow