gRPC Python: Can the gRPC server be run in a per-fork worker model?

1,763 views
Skip to first unread message

ssa...@atlassian.com

unread,
Jul 29, 2016, 12:32:45 AM7/29/16
to grpc.io
Hi,

We are currently evaluating gRPC and the Python based implementation on top of the c core seems to use Python threads from a thread pool for executing the code that represents the remote method.
The code that would be exposed via gRPC is not threadsafe and is currently being executed in a pre-fork model with one process per request.


Does something like this exist for Python/gRPC or are there any plans to support something like this in the future?

Best regards,
Stefan

Ken Payson

unread,
Jul 29, 2016, 1:11:13 PM7/29/16
to grpc.io, ssa...@atlassian.com
Hi Stefan,

Currently process pools are not supported.  There is definitely interest in supporting it, but the c-core extension code breaks with calls to fork(), so implementing it would be a non-trivial task.

Ken

ssa...@atlassian.com

unread,
Aug 1, 2016, 9:47:57 PM8/1/16
to grpc.io, ssa...@atlassian.com
Thanks Ken for the swift reply. Much appreciated.

scwin...@gmail.com

unread,
Jan 6, 2017, 9:38:32 AM1/6/17
to grpc.io
Just wanted to add another voice who is in need of process-based pooling, for the same reasons as Stefan mentions in his use case.

Thanks,
Steve

bols...@lnc.jp

unread,
Jul 20, 2017, 2:20:24 AM7/20/17
to grpc.io
Hello.
I need of process-based pooling.

My use case is preloading initialized large memory like zygote process.

In this case, process-based pooling has two merits
 - skip Initialization processing. 
 - do not want to have duplicate memory in process.

But I did not know where to patch.
As an alternative I'm thinking about forking from a thread but is it safe?

Best regards,


2017年1月6日金曜日 23時38分32秒 UTC+9 scwin...@gmail.com:

Ken Payson

unread,
Aug 1, 2017, 7:20:33 PM8/1/17
to grpc.io, bols...@lnc.jp
There is some work underway to support a prefork based process pool for Python.
I'd recommend avoiding using fork altogether with gRPC until it is available.

scwin...@gmail.com

unread,
Aug 14, 2017, 6:44:01 PM8/14/17
to grpc.io
Thanks Ken, do you know if/where we can details on that work?

ho...@danielvaldivia.com

unread,
Nov 28, 2017, 1:16:00 AM11/28/17
to grpc.io
Hi Ken,

Is there an issue to track the progress of this?

Ken Payson

unread,
Nov 28, 2017, 7:37:56 PM11/28/17
to grpc.io
Apologies, I missed the last response.

I've created an issue to track this.
Reply all
Reply to author
Forward
0 new messages