I want to know Is grpc python support multithreading? please share some reference.
I have written the code in the single thread but don't know how to write in multithread.
解决方案
gRPC Python does support multithreading on both client and server. As for server, you will create the server with a thread pool, so it is multithreading in default. As for client, you can create a channel and pass it to multiple Python thread and then create a stub for each thread. Also, since the channel is managed in C instead of Python, create multiple channels to the same server in the same process won't give you any performance advantage.
import threading
import grpc
def worker(channel):
stub = your_pb2_grpc.YourStub(channel)
...YOUR WORK WITH STUB
channel = grpc.insecure_channel()
your_thread = threading.Thread(target=worker, args=(channel,))
your_thread.start()