Todd Lipcon has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/15439 )

Change subject: client: micro-optimizations to reduce CPU and allocations
......................................................................

client: micro-optimizations to reduce CPU and allocations

Various small hot-spots I saw while profiling TSBS workloads which do a
high number of very short scans:

- replace vector<RemoteTabletServer> with boost's small_vector in spots
  in the client where we expect to usually have a very small number of
  qualifying servers.

- Optimize ResourceMetrics to use a dense_hash_map instead of a
  std::map, which is more CPU efficient. Additionally, key the map based
  on StringPieces instead of std::strings, since in our use case we are
  always using strings with eternal lifetime (coming from the protobuf
  Descriptor) here.

- Avoid creating a vector<FieldDescriptor*> when updating resource
  metrics. Instead iterate over the fields using index-based APIs that
  don't allocate.

- Add a KuduSchema constructor taking a Schema rvalue-reference. This is
  called once per scan in when setting up ScanConfiguration.

- Use make_shared for ColumnSchema shared_ptrs to avoid some atomic ops

This cuts cycles used in tcmalloc in kudu-tsdbd for one workload by about
11%.

Change-Id: I705aef9f2e57d44f387b58650279130ff329666d
Reviewed-on: http://gerrit.cloudera.org:8080/15439
Reviewed-by: Adar Dembo <[email protected]>
Tested-by: Todd Lipcon <[email protected]>
---
M src/kudu/client/client-internal.cc
M src/kudu/client/resource_metrics-internal.h
M src/kudu/client/resource_metrics.cc
M src/kudu/client/resource_metrics.h
M src/kudu/client/scanner-internal.cc
M src/kudu/client/schema.cc
M src/kudu/client/schema.h
M src/kudu/common/schema.h
8 files changed, 62 insertions(+), 12 deletions(-)

Approvals:
  Adar Dembo: Looks good to me, approved
  Todd Lipcon: Verified

--
To view, visit http://gerrit.cloudera.org:8080/15439
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I705aef9f2e57d44f387b58650279130ff329666d
Gerrit-Change-Number: 15439
Gerrit-PatchSet: 5
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <[email protected]>

Reply via email to