]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
osdc/Objecter: pg-mapping cache 28487/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 6 Jun 2019 08:12:27 +0000 (16:12 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 14 Jun 2019 06:42:31 +0000 (14:42 +0800)
commit8697db15c4ff59cd0c4dc021652576e72351dbaf
treee55b5a56fc1703e605aa741ae22256bdebe7c3b1
parent439ed8ba48af7d33de767107ec13c30c58372abc
osdc/Objecter: pg-mapping cache

The CRUSH-based addressing is some kind of CPU intensive task
and hence should be avoid whenever possible.

The patch introduces a per objecter pg-mapping cache, which as
a result can saved us 10%+ CPU (fio, 4k randow read, 24k IOPS):

Was:
$ top -Hp 415864
top - 14:45:39 up 6 days,  5:45,  3 users,  load average: 9.67, 8.66, 8.45
Threads:  23 total,   3 running,  20 sleeping,   0 stopped,   0 zombie
%Cpu(s): 21.6 us, 14.5 sy,  0.0 ni, 59.6 id,  1.4 wa,  0.0 hi,  3.0 si,  0.0 st
KiB Mem : 19616576+total, 12773412+free, 50964508 used, 17467128 buff/cache
KiB Swap:  4194300 total,  4194300 free,        0 used. 14352892+avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 415942 root      20   0 1957800 492820 123880 R 80.0  0.3   0:13.75 tp_librbd

Now:
$ top -Hp 475779
top - 10:22:05 up  1:18,  4 users,  load average: 2.65, 1.44, 1.60
Threads:  23 total,   2 running,  21 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.1 us,  2.2 sy,  0.0 ni, 91.4 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem : 19616576+total, 13919555+free, 27280820 used, 29689392 buff/cache
KiB Swap:  4194300 total,  4194300 free,        0 used. 16798102+avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 476231 root      20   0 1957808 491712 123836 S 71.1  0.3   0:41.47 tp_librbd

And below is a more detailed report from the perf tool:

Was:
$ perf report -g graph
  Children      Self  Command    Shared Object        Symbol
+   29.33%     0.03%  tp_librbd  librados.so.2.0.0    [.] Objecter::op_submit
+   28.83%     0.09%  tp_librbd  librados.so.2.0.0    [.] Objecter::_op_submit_with_budget
+   27.12%     0.17%  tp_librbd  librados.so.2.0.0    [.] Objecter::_op_submit
+   16.47%     0.26%  tp_librbd  librados.so.2.0.0    [.] Objecter::_calc_target
+   15.04%     0.10%  tp_librbd  libceph-common.so.0  [.] OSDMap::_pg_to_up_acting_osds
+   13.52%     0.16%  tp_librbd  libceph-common.so.0  [.] OSDMap::_pg_to_raw_osds

Now:
$ perf report -g graph
  Children      Self  Command    Shared Object        Symbol
+   17.84%     0.04%  tp_librbd  librados.so.2.0.0    [.] Objecter::op_submit
+   17.34%     0.06%  tp_librbd  librados.so.2.0.0    [.] Objecter::_op_submit_with_budget
+   15.80%     0.17%  tp_librbd  librados.so.2.0.0    [.] Objecter::_op_submit
+    6.11%     2.02%  tp_librbd  librados.so.2.0.0    [.] Objecter::_calc_target

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osdc/Objecter.cc
src/osdc/Objecter.h