Hello Tidy Bot, Kudu Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/8895
to look at the new patch set (#2).
Change subject: KUDU-1865: Avoid some heap allocations in RPC paths
......................................................................
KUDU-1865: Avoid some heap allocations in RPC paths
As shown in KUDU-1865 and IMPALA-5528, KRPC tends to put a lot
of stress on the thread caches of TCMalloc. In particular, the
RPC code allocates quite a number of small objects (e.g.
InboundCall, RpcContext, Request PB, Response PB etc) per RPC.
Under high rate of RPC, the free list of the thread caches will
get exhausted during allocations and then overflow once all the
small objects are freed. This leads to frequent trips to the
central cache list in TCMalloc and causes spin lock contention.
This change relieves some of the pressure in the thread cache by:
- Recycle InboundCall objects with an ObjectPool
- Embed RpcContext into the InboundCall instead of having a separate object
- Introduce a new interface RpcContext::RespondSuccess(const Message& message)
which allows callers to pass the response PB directly as argument instead
of using the preallocated response PB owned by RpcContext. This allows callers
to allocate the response PB on the stack, thus avoiding the need to use the
heap.
- To complement the stack allocation of Response PB, we wrap the code which
allocates
the Response PB in a new function GeneratedServiceIf::AllocResponsePB() which
allows
derived classes to override it. If a service decides that all response PB
will be
allocated on the stack, the overridden function can always return a nullptr.
Change-Id: I407b4782c9f3cd39ad3c6e0d21fd9542be34b118
---
M src/kudu/rpc/connection.cc
M src/kudu/rpc/connection.h
M src/kudu/rpc/inbound_call.cc
M src/kudu/rpc/inbound_call.h
M src/kudu/rpc/result_tracker.cc
M src/kudu/rpc/result_tracker.h
M src/kudu/rpc/rpc-test-base.h
M src/kudu/rpc/rpc_context.cc
M src/kudu/rpc/rpc_context.h
M src/kudu/rpc/rpc_stub-test.cc
M src/kudu/rpc/rtest.proto
M src/kudu/rpc/service_if.cc
M src/kudu/rpc/service_if.h
13 files changed, 165 insertions(+), 85 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/95/8895/2
--
To view, visit http://gerrit.cloudera.org:8080/8895
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I407b4782c9f3cd39ad3c6e0d21fd9542be34b118
Gerrit-Change-Number: 8895
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Ho <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot