rok commented on code in PR #13873: URL: https://github.com/apache/arrow/pull/13873#discussion_r950618527
########## docs/source/cpp/flight.rst: ########## @@ -172,6 +172,154 @@ request/response. On the server, they can inspect incoming headers and fail the request; hence, they can be used to implement custom authentication methods. +.. _flight-best-practices: + +Best practices +============== + +gRPC +---- + +When using default gRPC transport options can be passed to it via +:member:`arrow::flight::FlightClientOptions::generic_options`. For example: + +.. tab-set:: + + .. tab-item:: C++ + + .. code-block:: cpp + + auto options = FlightClientOptions::Defaults(); + // Set a very low limit at the gRPC layer to fail all calls + options.generic_options.emplace_back(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, 4); + + .. tab-item:: Python + + .. code-block:: cpp + + // Set a very low limit at the gRPC layer to fail all calls + generic_options = [("GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH", 4)] + client = pyarrow.flight.FlightClient(server_uri, generic_options=generic_options) + +Also see `best gRPC practices`_ and available `gRPC keys`_. + +Re-use clients whenever possible +-------------------------------- + +Closing clients causes gRPC to close and clean up connections which can take Review Comment: I'm not sure what's more costly time wise - creating a client or closing it. I don't know that somebody measured this. Either way it's remedied by re-using clients. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org