I would like to know if there is a recommended way to return data back from a server to a client in GRPC python.
Currently, I have a dedicated server's RPC call that blocks on every client call - it loops on a data queue(which blocks when empty) to get the data and sends it back to the client. The server implementation of this call:
def GetData(self, request, context):
while self._is_initialized:
data = self._processed_data_queue.get()
yield data
print 'client out'
It seems super awkward, non-scalable, and obviously slows down the communication. In NodeJS, C#, c++ implementations, it is much much easier to accomplish this. But with Python implementation it doesn't seem to be possible to accomplish this efficiently. I really hope I'm missing something.
In addition, the server currently accepts data from a client, add it to a queue and then return it back to the client(without any processing). Again, with the code above, my performance drops dramatically even without any processing!
Thanks, Mike