how to set grpc serving options to improve performance (python)

1,130 views
Skip to first unread message

mouse

unread,
Jun 6, 2016, 10:35:06 PM6/6/16
to grpc.io

I make a backend service by using grpc, and the programing language is python.
how to choice network module, blocking or non-blocking. 
usually, we can set thread num to get more qps. how can i do something like this with grpc + python.

Guo Jing

unread,
Jun 8, 2016, 1:24:28 PM6/8/16
to grpc.io
The simplest way is to use thread pool.

from concurrent.futures import ThreadPoolExecutor

pool = ThreadPoolExecutor(max_workers=GRPC_POOL_MAX_WORKER)

server = server_pb2.beta_create_SomeService_server(
            Impl(), pool=pool, pool_size=GRPC_POOL_SIZE,
            default_timeout=5, maximum_timeout=30)

gRPC Python is based on gRPC C Core. You can't change much. The best way I think is to use multi process, I wrote a simple tool called grma. Hope this may help.

Nathaniel Manista

unread,
Jun 12, 2016, 4:34:33 PM6/12/16
to mouse, grpc.io
Among which network modules are you choosing?

Independent of steps that you can take, know that we've recently completed a large (10x) performance improvement effort for gRPC Python. It's available now at source control head and will be included in grpcio 0.15 (to be released in the next week or two) and later.
-Nathaniel

mouse

unread,
Jun 18, 2016, 8:00:05 PM6/18/16
to grpc.io
thank you very much.

在 2016年6月9日星期四 UTC+8上午1:24:28,Guo Jing写道:

mouse

unread,
Jun 18, 2016, 8:01:53 PM6/18/16
to grpc.io, runm...@gmail.com


在 2016年6月13日星期一 UTC+8上午4:34:33,Nathaniel Manista写道:
On Mon, Jun 6, 2016 at 7:35 PM, mouse <runm...@gmail.com> wrote:
I make a backend service by using grpc, and the programing language is python.
how to choice network module, blocking or non-blocking. 
usually, we can set thread num to get more qps. how can i do something like this with grpc + python.

Among which network modules are you choosing?
 
like thrift , there are simple, thread pool, and non blocking. 


Independent of steps that you can take, know that we've recently completed a large (10x) performance improvement effort for gRPC Python. It's available now at source control head and will be included in grpcio 0.15 (to be released in the next week or two) and later.
-Nathaniel

I expect it.  
Reply all
Reply to author
Forward
0 new messages