GRPC Multiprocessing not working in Python

22 views
Skip to first unread message

Sumit Chauhan

unread,
Sep 7, 2020, 12:21:51 PM9/7/20
to grpc.io

I'm trying grpc multiprocess example listed here on OSX -https://github.com/grpc/grpc/tree/74bba2c90a4f4607674a01ec1c0b634708fea887/examples/python/multiprocessing

[PID 19271] Binding to 'localhost:50976'
[PID 19292] Starting new server.
[PID 19293] Starting new server.
[PID 19294] Starting new server.
[PID 19295] Starting new server.
[PID 19296] Starting new server.
[PID 19297] Starting new server.
[PID 19298] Starting new server.

I do see multiple server processes started. However, on running the client, I see only one of the server PID logged in server logs. Sample logs below. I expected it to be spread across all the server processes. Am I missing something here?

[PID 19295] Determining primality of 1139
[PID 19295] Determining primality of 779
[PID 19295] Determining primality of 1709
[PID 19295] Determining primality of 563
[PID 19295] Determining primality of 1493
[PID 19295] Determining primality of 226
[PID 19295] Determining primality of 1140
[PID 19295] Determining primality of 2027

Lidi Zheng

unread,
Sep 8, 2020, 1:10:19 PM9/8/20
to grpc.io
The reuse port mechanism provided by Linux is hashing your client address. If you create many clients, you should see the traffic distributed across server processes.
Reply all
Reply to author
Forward
0 new messages