Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(service): fix grpc server size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng committed Jul 15, 2019
1 parent dd09155 commit 09e68da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gnes/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ def set_grpc_frontend_parser(parser=None):
_set_grpc_parser(parser)
parser.add_argument('--max_concurrency', type=int, default=10,
help='maximum concurrent client allowed')
parser.add_argument('--max_send_size', type=int, default=100,
help='maximum send size for grpc server in (M)')
parser.add_argument('--max_receive_size', type=int, default=100,
help='maximum receive size for grpc server in (M)')
return parser


Expand Down
4 changes: 3 additions & 1 deletion gnes/service/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class GRPCFrontend:
def __init__(self, args):
self.logger = set_logger(self.__class__.__name__, args.verbose)
self.server = grpc.server(
futures.ThreadPoolExecutor(max_workers=args.max_concurrency))
futures.ThreadPoolExecutor(max_workers=args.max_concurrency),
options=[('grpc.max_send_message_length', args.max_send_size*1024*1024,
'grpc.max_receive_message_length', args.max_receive_size*1024*1024)])
self.logger.info('start a grpc server with %d workers' % args.max_concurrency)
gnes_pb2_grpc.add_GnesRPCServicer_to_server(GNESServicer(args), self.server)

Expand Down

0 comments on commit 09e68da

Please sign in to comment.