Hi, I am tying to best take advantage the gevent loop in uWSGI to make async redis calls using redis-py.
Per the uWSGI docs at http://projects.unbit.it/uwsgi/wiki/AsyncSupport """every time the uWSGI server calls yield it stops the execution of the app and accept a new request or resume a previously stopped request. """ So, redis-py is blocking. So, if I want to make a redis call ...lets say the call takes 15 ms, in the mean time, I can process more requests and when the resutks are ready then continue on my merry way? Where I am confused is to best use yield. Do a call gevent.joinall(jt) or yield gevent.joinall(jt) or none of the above. From the below, I want to make two pipeline requests and not have the main loop block. Below is my code using bottle: def execute_pipe(pipe): data = pipe.execute() return data @post('/') def my_post(): #Get post data here pipe_threads = [] p1 = r_main_writes.pipeline() p1.hgetall(mab_profile1) pipe_threads.append(p1) p2 = r_other_writes.pipeline() p2.hgetall(mab_profile2) pipe_threads.append(p2) jt = [] for pt in pipe_threads: jt.append(gevent.spawn(execute_pipe, pt)) gevent.joinall(jt) yield 'end response' _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
