Skip to contentSkip to conversation

RBD client wallclock profile during 4k random writes

DISCUSSION Mark Nelson 4 participants 6 messages May 10, 2017 – May 26, 2017

lore
Share & tools
lore
#0 lore raw

Ugh, trying this one more time. :(

I didn't see the original version of this message go out to ceph-devel (possibly due to the attachment). I'll use pastebin instead:

https://pastebin.com/6txSkM7r

While debugging a bluestore issue I grabbed a wall-clock profile of a client fio process while doing 4k random writes. This likely is not associated with the other issues I'm trying to track down, but I wanted to share since there's some locking going on that might be worth looking at. FWIW, this is a single client issuing 32 concurrent IOs to a 3x rep pool on a cluster with 16 OSDs on NVMe. The NVMe drives are nowhere near saturated and the OSDs are semi-idle waiting for work. Top was showing the fio process using about 300-320% CPU while the profiler wasn't running and fio was doing somewhere around 14-15k IOPS.

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is spent in ObjectCacher::writex with lots of nested stuff, but if you look all the way down on line 1293, another 11.8% of the time is spent in Locker() and 1.5% of the time spent in ~Locker().

Of note is that ~12% of the time in this thread was spent in Objecter::_calc_target. A bit less than half of that was crush.

2) 8 - fn-radosclient, line 1641

This thread is spending about half it's time in Context::complete, and half it's time just waiting around. On line 1651 in librbd::C_OrderedWrite::finish, we see a whopping 33.60% of the samples spent in Locker doing Mutex::Lock. On line 1819, 3.15% spent in ~Locker doing Mutex::Unlock.

Otherwise we see some of the usual suspects sprinkled around. bufferlist appends, encode/decode, fast_dispatch, etc.

Mark

#1 lore raw
Quoted 7 lines · Mark Nelson

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is spent in ObjectCacher::writex with lots of nested stuff, but if you look all the way down on line 1293, another 11.8% of the time is spent in Locker() and 1.5% of the time spent in ~Locker().

Yes -- the ObjectCacher is long overdue for a re-write since it's single threaded. It looks like you were essentially performing writethrough as well. I'd imagine you would just be better off disabling the rbd cache when doing high-performance random write workloads since you are going to get zero benefit from the cache with that workload -- at least that's what I usually recommend.

#2 lore raw
Quoted 9 lines · Jason Dillaman
Quoted 7 lines · Mark Nelson

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is spent in ObjectCacher::writex with lots of nested stuff, but if you look all the way down on line 1293, another 11.8% of the time is spent in Locker() and 1.5% of the time spent in ~Locker().

Quoted 7 lines

Yes -- the ObjectCacher is long overdue for a re-write since it's single threaded. It looks like you were essentially performing writethrough as well. I'd imagine you would just be better off disabling the rbd cache when doing high-performance random write workloads since you are going to get zero benefit from the cache with that workload -- at least that's what I usually recommend.

Often I do turn rbd cache off for bluestore testing. This was an older conf file where I inadvertently hadn't disabled it. Still, it's an unfortunate choice that has to be made, potentially by someone other than the user running the workload. :/

Mark

#3 lore raw
Quoted 23 lines · Mark Nelson
Quoted 12 lines · Jason Dillaman
Quoted 10 lines · Mark Nelson

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is
spent in ObjectCacher::writex with lots of nested stuff, but if you look all
the way down on line 1293, another 11.8% of the time is spent in Locker()
and 1.5% of the time spent in ~Locker().

Quoted 7 lines

Yes -- the ObjectCacher is long overdue for a re-write since it's single threaded. It looks like you were essentially performing writethrough as well. I'd imagine you would just be better off disabling the rbd cache when doing high-performance random write workloads since you are going to get zero benefit from the cache with that workload -- at least that's what I usually recommend.

Quoted 4 lines

Often I do turn rbd cache off for bluestore testing. This was an older conf file where I inadvertently hadn't disabled it. Still, it's an unfortunate choice that has to be made, potentially by someone other than the user running the workload. :/

Yep, disabling rbd cache bumped 4K write IOPS from ~14K to ~31K, and closer ~36-37K with a higher IO depth at around 410% CPU usage.

trace without rbd cache here:

https://pastebin.com/t8FFsWNb

looking a lot better, though thread 5 (tp_librbd) is still pegging. Still a little bit of locking in various places. a bit more time shifted into _calc_target.

async msgr is as expected a lot busier than it used to be.

Quoted 6 lines

Mark
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

2017-05-11 8:21 GMT+08:00 Mark Nelson <[email protected]>:

Quoted 41 lines · Mark Nelson
Quoted 27 lines · Jason Dillaman
Quoted 15 lines · Mark Nelson
Quoted 11 lines

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is
spent in ObjectCacher::writex with lots of nested stuff, but if you look all
the way down on line 1293, another 11.8% of the time is spent in Locker()
and 1.5% of the time spent in ~Locker().

Quoted 7 lines

Yes -- the ObjectCacher is long overdue for a re-write since it's single threaded. It looks like you were essentially performing writethrough as well. I'd imagine you would just be better off disabling the rbd cache when doing high-performance random write workloads since you are going to get zero benefit from the cache with that workload -- at least that's what I usually recommend.

Quoted 4 lines

Often I do turn rbd cache off for bluestore testing. This was an older conf file where I inadvertently hadn't disabled it. Still, it's an unfortunate choice that has to be made, potentially by someone other than the user running the workload. :/

Yep, disabling rbd cache bumped 4K write IOPS from ~14K to ~31K, and closer ~36-37K with a higher IO depth at around 410% CPU usage.

trace without rbd cache here:

Quoted 8 lines

https://pastebin.com/t8FFsWNb

looking a lot better, though thread 5 (tp_librbd) is still pegging. Still a little bit of locking in various places. a bit more time shifted into _calc_target.

async msgr is as expected a lot busier than it used to be.

So it seems calc pg mapping is an expensive operation. And furthermore, if we always need to retry the loop because of collision and rejection.

What about using a mapping cache table to look up the pg mapping directly once it is calculated? I think We can re-calucate the pg mapping until the osdmap epoch is changed, otherwise, pg mapping should be consistent during one osdmap.

Regards
Ning Yao

#5 lore raw

What's the tool that you use to trace those threads,as Mark Nelson shows in the link,i think it's pretty cool and useful.Thanks.

2017-05-19 0:33 GMT+08:00 Ning Yao <[email protected]>:

Quoted 66 lines

2017-05-11 8:21 GMT+08:00 Mark Nelson <[email protected]>:

Quoted 41 lines · Mark Nelson
Quoted 27 lines · Jason Dillaman
Quoted 15 lines · Mark Nelson
Quoted 11 lines

1) 7 - tp_librbd, line 82

Lots of stuff going on here, but the big thing is all the time spent in librbd::ImageCtx::write_to_cache. 70.2% of the total time in this thread is
spent in ObjectCacher::writex with lots of nested stuff, but if you look all
the way down on line 1293, another 11.8% of the time is spent in Locker()
and 1.5% of the time spent in ~Locker().

Quoted 7 lines

Yes -- the ObjectCacher is long overdue for a re-write since it's single threaded. It looks like you were essentially performing writethrough as well. I'd imagine you would just be better off disabling the rbd cache when doing high-performance random write workloads since you are going to get zero benefit from the cache with that workload -- at least that's what I usually recommend.

Quoted 4 lines

Often I do turn rbd cache off for bluestore testing. This was an older conf file where I inadvertently hadn't disabled it. Still, it's an unfortunate choice that has to be made, potentially by someone other than the user running the workload. :/

Yep, disabling rbd cache bumped 4K write IOPS from ~14K to ~31K, and closer ~36-37K with a higher IO depth at around 410% CPU usage.

trace without rbd cache here:

Quoted 8 lines

https://pastebin.com/t8FFsWNb

looking a lot better, though thread 5 (tp_librbd) is still pegging. Still a little bit of locking in various places. a bit more time shifted into _calc_target.

async msgr is as expected a lot busier than it used to be.

So it seems calc pg mapping is an expensive operation. And furthermore, if we always need to retry the loop because of collision and rejection.

What about using a mapping cache table to look up the pg mapping directly once it is calculated? I think We can re-calucate the pg mapping until the osdmap epoch is changed, otherwise, pg mapping should be consistent during one osdmap.

Regards
Ning Yao
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html