Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

illumos 7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object #4973

Closed
wants to merge 2 commits into from

Conversation

ahrens
Copy link
Member

@ahrens ahrens commented Aug 15, 2016

illumos 7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object

Note: this depends on #4972

Using a benchmark which has 32 threads creating 2 million files in the
same directory, on a machine with 16 CPU cores, I observed poor
performance. I noticed that dmu_tx_hold_zap() was using about 30% of
all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
object that is being held).

dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
dnode_t that we already have in hand, rather than repeatedly calling
dnode_hold(). To do this, we need to pass the dnode_t down through
all the intermediate calls that dmu_tx_hold_zap() makes, making these
routines take the dnode_t* rather than an objset_t* and a uint64_t
object number. In particular, the following routines will need to have
analogous *_by_dnode() variants created:

dmu_buf_hold_noread()
dmu_buf_hold()
zap_lookup()
zap_lookup_norm()
zap_count_write()
zap_lockdir()
zap_count_write()

This can improve performance on the benchmark described above by 100%,
from 30,000 file creations per second to 60,000. (This improvement is on
top of that provided by working around the object allocation issue. Peak
performance of ~90,000 creations per second was observed with 8 CPUs;
adding CPUs past that decreased performance due to lock contention.) The
CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
to 40 CPU-seconds.

Sponsored by: Intel Corp.

Closes #4641

ahrens added 2 commits August 15, 2016 13:51
zap_lockdir() / zap_unlockdir() should take a "void *tag" argument which
tags the hold on the zap. This will help diagnose programming errors
which misuse the hold on the ZAP.

Sponsored by: Intel Corp.
Using a benchmark which has 32 threads creating 2 million files in the
same directory, on a machine with 16 CPU cores, I observed poor
performance. I noticed that dmu_tx_hold_zap() was using about 30% of
all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
object that is being held).

dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
dnode_t that we already have in hand, rather than repeatedly calling
dnode_hold(). To do this, we need to pass the dnode_t down through
all the intermediate calls that dmu_tx_hold_zap() makes, making these
routines take the dnode_t* rather than an objset_t* and a uint64_t
object number. In particular, the following routines will need to have
analogous *_by_dnode() variants created:

dmu_buf_hold_noread()
dmu_buf_hold()
zap_lookup()
zap_lookup_norm()
zap_count_write()
zap_lockdir()
zap_count_write()

This can improve performance on the benchmark described above by 100%,
from 30,000 file creations per second to 60,000. (This improvement is on
top of that provided by working around the object allocation issue. Peak
performance of ~90,000 creations per second was observed with 8 CPUs;
adding CPUs past that decreased performance due to lock contention.) The
CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
to 40 CPU-seconds.

Sponsored by: Intel Corp.

Closes openzfs#4641
@kernelOfTruth
Copy link
Contributor

kernelOfTruth commented Aug 16, 2016

looks familiar: #4710

great improvement, btw ! 👍

thanks

@behlendorf
Copy link
Contributor

@kernelOfTruth yes, they're the same patches. We've been running these patches locally for a while and they work well.

I had been holding off merging them until they were also applies to OpenZFS, just to make sure both repositories applied the same version of the patch. But I'm OK applying them now as long as the expectation is that OpenZFS will also apply them. @ahrens do you have a guess when that might happen?

The CentOS 6.x failure here was an infrastructure failure and unrelated. And as I mentioned above we do already have a lot of run time on these patches.

@behlendorf behlendorf added this to the 0.7.0 milestone Aug 16, 2016
@ahrens
Copy link
Member Author

ahrens commented Aug 16, 2016

Whoops, sorry I didn't realize there was already a PR open for this. Let me see about merging the OpenZFS/illumos patches this week.

@behlendorf
Copy link
Contributor

Merged as:

2bce804 OpenZFS 7004 - dmu_tx_hold_zap() does dnode_hold() 7x on same object

@behlendorf behlendorf closed this Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants