This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 2f722aaab98b3cb63eb1aa1221eae8f8ed2effd1 Author: Todd Lipcon <[email protected]> AuthorDate: Mon Jul 27 15:52:14 2020 -0700 rpc: Change InboundCall arena to 4kB by default This changes the initial block size of the protobuf::Arena used by InboundCall to 4kb instead of the 256 byte default. This reduces the number of allocations required per call significantly for larger requests/responses. 4kb was chosen as it's not so large that it would cause a lot of wasted memory (even with thousands of concurrent RPCs in the queue or being handled it's only <10MB total), but still large enough that it provided a substantial speedup. In the future we might try to keep a per-RPC estimate of how much arena size was actually used, and use that to pre-size the arena for future calls, but didn't seem worth the complexity for now. Benchmarked with: $ KUDU_ALLOW_SLOW_TESTS=1 ./build/latest/bin/table_locations-itest \ --gtest_filter=TableLocationsTest.GetTableLocationsBenchmark \ --rpc_num_service_threads=32 \ --benchmark_num_threads=48 Before: 59408 req/sec After: 74787 req/sec (1.25x) Alexey notes that there isn't any measurable speedup for smaller RPCs like in the GetTableSchema benchmark. Change-Id: Id20a3cbb5c2da1b6bfc519d852b90687297d4739 Reviewed-on: http://gerrit.cloudera.org:8080/16249 Reviewed-by: Alexey Serbin <[email protected]> Tested-by: Kudu Jenkins --- src/kudu/rpc/inbound_call.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kudu/rpc/inbound_call.cc b/src/kudu/rpc/inbound_call.cc index 1b4c82b..2e0e222 100644 --- a/src/kudu/rpc/inbound_call.cc +++ b/src/kudu/rpc/inbound_call.cc @@ -47,8 +47,8 @@ class FieldDescriptor; } } +using google::protobuf::ArenaOptions; using google::protobuf::FieldDescriptor; -using google::protobuf::Message; using google::protobuf::MessageLite; using std::string; using std::unique_ptr; @@ -58,11 +58,18 @@ using strings::Substitute; namespace kudu { namespace rpc { +static ArenaOptions MakeArenaOptions() { + ArenaOptions opts; + opts.start_block_size = 4096; + return opts; +} + InboundCall::InboundCall(Connection* conn) : conn_(conn), trace_(new Trace), method_info_(nullptr), - deadline_(MonoTime::Max()) { + deadline_(MonoTime::Max()), + arena_(MakeArenaOptions()) { RecordCallReceived(); }
