On Wed, Apr 21, 2021 at 9:59 AM Kefu Chai <kchai(a)redhat.com> wrote:
hi folks,
while looking at
https://github.com/ceph/ceph/pull/32422, i think a probably safer
approach is to make the monitor more efficient. currently, monitor is sort of a
single-threaded application. quite a few critical code paths of monitor are protected by
Monitor::lock, among other things
- periodical task performed by tick() which is in turn called by SafeTimer. the
"safty" of the SafeTimer is ensured by Monitor::lock
- Monitor::_ms_dispatch is also called with the Monitor::lock acquired. in the case of
https://github.com/ceph/ceph/pull/32422, one or more kcephfs clients are even able to slow
down the whole cluster by asking for the latest osdmap with an ancient one in its hand, if
the cluster is able to rebalance/recover in speedy way and accumulate lots of osdmap in a
short time.
a typical scaring use case is:
1. an all-flash cluster just completes a rebalance/recover. the rebalance completed
quickly, and it leaves the cluster with a ton of osdmaps before some of the clients have a
chance to pick up these updated maps.
2. (kcephfs) clients with ancient osdmaps in their hands wake up randomly, and they want
the latest osdmap!
3. monitors are occupied with loading the maps from rocksdb and encoding them in very
large batches (when discussing with the author of
https://github.com/ceph/ceph/pull/32422,
he mentioned that the total size of inc osdmap could be up to 200~300 MiB).
4. and the cluster is basically unresponsive.
so, does it sound like a right way to improve its performance when serving the CPU
intensive workload by dissecting the data dependencies in the monitor and to explore the
possibility to make the monitor more multi-threaded?
Another thing to explore in addition to making the monitor more
efficient might be the concept of osdmap for clients as opposed to
a full osdmap. The osdmap already has a client section and an OSD
section (everything else, really), but there is no way to indicate
interest in just the client section so we always encode the entire
thing. The kernel client for example doesn't even decode the OSD
section so a good chunk of CPU cycles spent on encoding is wasted.
There are a couple of fields in the OSD section that can be of
interest to clients. One example is require_osd_release and the
features of the OSD -- used in Objecter::_calc_target() for an
optimization. If we identify these and move or duplicate them
in the client section, implementing client-section-only osdmap
subscription should be pretty easy and would save both CPU cycles
and network bandwidth.
Thanks,
Ilya