On the server you can provide a threadpool like this: 
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))

This will spawn a maximum of 10 concurrent threads to handle requests in 
parallel. See this example: 
https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_server.py

On the client side, you can create one channel and pass it to your worker 
threads to create stubs on that channel. Worker threads can then do 
concurrent RPCs on their own stubs while using the same channel 
(connection) to the server.


On Friday, October 26, 2018 at 11:27:51 AM UTC-7, Carl Mastrangelo wrote:
>
> +Lidi
>
> On Fri, Oct 26, 2018 at 11:23 AM Vaibhav Bedi <[email protected] 
> <javascript:>> wrote:
>
>> Can you share some reference?
>> ᐧ
>>
>> On Fri, Oct 26, 2018 at 11:51 PM Vaibhav Bedi <[email protected] 
>> <javascript:>> wrote:
>>
>>> My problem is
>>> I want to write the grpc python multithread code for the client-server 
>>> application, both client and server should use
>>> threads in order to handle multi-requests at the same time. The client 
>>> is simulating a gateway where it uploads data to the server. This data 
>>> should be an array of objects.
>>> The server is receiving these data and printing them in a multi-threaded 
>>> way.
>>>
>>> Thank you
>>> ᐧ
>>>
>>> On Fri, Oct 26, 2018 at 11:46 PM 'Carl Mastrangelo' via grpc.io <
>>> [email protected] <javascript:>> wrote:
>>>
>>>> Yes it does.  If you provide more information about what you want to 
>>>> do, we can give a better answer.
>>>>
>>>> On Thursday, October 25, 2018 at 9:11:49 AM UTC-7, [email protected] 
>>>> wrote:
>>>>>
>>>>> hi
>>>>>  
>>>>> I want to know Is grpc python support multi-thread?
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "grpc.io" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/grpc-io/TYz7WUUJkiw/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> [email protected] <javascript:>.
>>>> To post to this group, send email to [email protected] 
>>>> <javascript:>.
>>>> Visit this group at https://groups.google.com/group/grpc-io.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/grpc-io/31b617e5-629f-473b-8dcf-d9af2d17a0a5%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/grpc-io/31b617e5-629f-473b-8dcf-d9af2d17a0a5%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> -- 
>>> Sincerely,
>>> Vaibhav Bedi
>>> Email ID- [email protected] <javascript:>
>>> Contact Number-8950597710
>>> Website-http://www.vaibhavbedi.com/
>>>
>>
>>
>> -- 
>> Sincerely,
>> Vaibhav Bedi
>> Email ID- [email protected] <javascript:>
>> Contact Number-8950597710
>> Website-http://www.vaibhavbedi.com/
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/46d960d2-fdfa-40ea-8cab-dee05adeceee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to