Alexey Serbin has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/18283


Change subject: [security] avoid allocating string in SimpleAcl::UserAllowed()
......................................................................

[security] avoid allocating string in SimpleAcl::UserAllowed()

While looking at diagnostic logs collected from a busy Kudu cluster,
I noticed traces like the following:

  tids=[1902541,1902525,1902599]
      0x7f0f825725d0 <unknown>
            0xa986dd tcmalloc::internal::SpinLockDelay()
            0xa985ef SpinLock::SlowLock()
            0xa8e198 tcmalloc::CentralFreeList::InsertRange()
            0xa977a1 tcmalloc::ThreadCache::ReleaseToCentralCache()
            0xa97a90 tcmalloc::ThreadCache::Scavenge()
           0x217ca04 kudu::security::SimpleAcl::UserAllowed()
            0xaace27 kudu::server::ServerBase::Authorize()
           0x215191c kudu::rpc::GeneratedServiceIf::Handle()
           0x2152619 kudu::rpc::ServicePool::RunThread()
           0x22d570f kudu::Thread::SuperviseThread()

The issue is a high contention in the libtcmalloc, but there is one more
point here: Scavenge() in tcmalloc's ThreadCache is called from the
inlined method ThreadCache::Deallocate(), so an instance of std::string
is allocated every time when ContainsKey(users_, "*") is called.

SimpleAcl::UserAllowed() is in the hot path since it's invoked upon
processing an RPC to any of existing Kudu services. This patch
introduces a static SimpleAcl::kWildcardAll member to use for the
lookup in SimpleAcl::UserAllowed() and in other places.

Change-Id: Ic9ed6140cbcf0487ec76b9f769cdf24f9de7b52c
---
M src/kudu/security/simple_acl.cc
M src/kudu/security/simple_acl.h
2 files changed, 10 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/83/18283/1
--
To view, visit http://gerrit.cloudera.org:8080/18283
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9ed6140cbcf0487ec76b9f769cdf24f9de7b52c
Gerrit-Change-Number: 18283
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <[email protected]>

Reply via email to