You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2016/05/03 20:56:37 UTC

[kudu-CR] service_queue: use futex for waking waiting rpc threads

Hello Binglin Chang, Henry Robinson, Mike Percy,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/2940

to review the following change.

Change subject: service_queue: use futex for waking waiting rpc threads
......................................................................

service_queue: use futex for waking waiting rpc threads

This switches to directly using futex() (via the spinlock_internal helper
functions) to sleep and wake the waiting RPC handler threads. This makes it
easier for a hot thread to spin for a bit before going to sleep, which reduces
context switches for high throughput RPC operations.

The request rate only improves marginally but there is a substantial decrease
in context switches.

Before:
  Mode:            Sync
  Client threads:   24
  Worker threads:   40
  Server reactors:  24
  ----------------------------------
  Reqs/sec:         373224
  User CPU per req: 27.2511us
  Sys CPU per req:  35.9059us
  Ctx Sw. per req:  5.50983

  Mode:            Async
  Client reactors:  24
  Call concurrency: 100
  Worker threads:   40
  Server reactors:  24
  ----------------------------------
  Reqs/sec:         768135
  User CPU per req: 21.6902us
  Sys CPU per req:  25.3586us
  Ctx Sw. per req:  1.34386

After:
  Mode:            Sync
  Client threads:   24
  Worker threads:   40
  Server reactors:  24
  ----------------------------------
  Reqs/sec:         388680
  User CPU per req: 29.8484us
  Sys CPU per req:  34.843us
  Ctx Sw. per req:  5.2058

  Mode:            Async
  Client reactors:  24
  Call concurrency: 100
  Worker threads:   40
  Server reactors:  24
  ----------------------------------
  Reqs/sec:         801922
  User CPU per req: 20.018us
  Sys CPU per req:  18.186us
  Ctx Sw. per req:  0.756598

Change-Id: Ice7bb703d643b722f732f4c4ebc391d25796d3df
---
M src/kudu/rpc/service_queue.cc
M src/kudu/rpc/service_queue.h
2 files changed, 40 insertions(+), 21 deletions(-)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice7bb703d643b722f732f4c4ebc391d25796d3df
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Binglin Chang <de...@gmail.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>