]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
msg/async: Implement smarter worker thread selection 7843/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Fri, 26 Feb 2016 12:54:20 +0000 (13:54 +0100)
committerPiotr Dałek <git@predictor.org.pl>
Sun, 15 May 2016 19:42:32 +0000 (21:42 +0200)
commit3e80f8d74a535e14d4092b27ea5417bacff8394e
tree05121444a76f6994f164c2dace3c19704c31d713
parent62bd3fae3fb012a3d9c6951290654f5074825c6f
msg/async: Implement smarter worker thread selection

This changeset makes AsyncMessenger a bit smarter when it comes
to assigning worker threads to AsyncConnections. Each time a worker
is assigned, its reference count is increased. Next time when Async
Messenger needs to assign another worker to new AsyncConnection, it
picks the one with the lowest reference count. If it cannot find an
idle one, and number of currently instantiated workers is less than
specified with "ms async op max threads", the new worker is created
and returned.
Once AsyncConnection goes away, the reference count on assigned
worker is decreased.
This does not prevent, but greatly reduces chances of having a single
async worker thread doing most (or even all) of the ops, and also
removes the need to manually tune the "ms async op threads" option.

Signed-off-by: Piotr Dałek <git@predictor.org.pl>
src/common/config_opts.h
src/msg/async/AsyncConnection.cc
src/msg/async/AsyncConnection.h
src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h