Jump to content

Prefer find over chown


sscheib

Recommended Posts

sscheib

Dear developers,

 

I just noticed a massive load while updating the Emby server and trying to work simultaneously via SSH on the server.

Curious as I am I took a look at top and saw a running command, which caught my attention: chown -R emby:emby

Apparently this command is issued during the installation of the Emby server package (at least on Debian). 

 

You might want to consider using find with the exec flag. See below for the possible performance boost.

root@hostname:/tmp# time chown -R emby:emby /var/lib/emby

real    3m47.318s
user    0m0.632s
sys     0m1.816s
root@hostname:/tmp# touch /var/lib/emby/bla
root@hostname:/tmp# time find /var/lib/emby/ ! \( -uid 999 -o -gid 999 \) -exec chown emby:emby {} \;

real    1m19.791s
user    0m1.012s
sys     0m1.868s
root@hostname:/tmp# 

Roughly estimated 1/3 of time needed to perform the action with the same outcome by preferring find over chown. Of course I did not run find before (so no cache involved).

 

Cheers,

Steffen

Link to comment
Share on other sites

  • 3 weeks later...
sscheib

Just wanted to bump this one more time, as this issue is still persistent.

I have a large database (~80TB) and therefore a lot within the path /var/lib/emby (metadata), so the command will run a good while and increase the load of the server for no reason.

Link to comment
Share on other sites

Hi, thanks, it's on our internal issue tracker for issues related to build and packaging. It just has other things waiting in line ahead of it right now. Thanks.

Link to comment
Share on other sites

  • 3 months later...
Q-Droid

@@sscheib, We are looking into resolving this for the next release. Thanks.

Please make sure it's tested properly. Both commands would have to access the dir tree therefore it is possible for caching to be in play and skewing the results. Giving the false impression of better performance.

Link to comment
Share on other sites

  • 3 weeks later...
sscheib

Dear developers,

 

I just noticed a massive load while updating the Emby server and trying to work simultaneously via SSH on the server.

Curious as I am I took a look at top and saw a running command, which caught my attention: chown -R emby:emby

Apparently this command is issued during the installation of the Emby server package (at least on Debian). 

 

You might want to consider using find with the exec flag. See below for the possible performance boost.

root@hostname:/tmp# time chown -R emby:emby /var/lib/emby

real    3m47.318s
user    0m0.632s
sys     0m1.816s
root@hostname:/tmp# touch /var/lib/emby/bla
root@hostname:/tmp# time find /var/lib/emby/ ! \( -uid 999 -o -gid 999 \) -exec chown emby:emby {} \;

real    1m19.791s
user    0m1.012s
sys     0m1.868s
root@hostname:/tmp# 

Roughly estimated 1/3 of time needed to perform the action with the same outcome by preferring find over chown. Of course I did not run find before (so no cache involved).

 

Cheers,

Steffen

Link to comment
Share on other sites

Q-Droid

You ran a recursive chown on the same dir tree. Unless you rebooted in between and not a nas volume it is possible there was cache involved. I'm not saying that I'm 100% certain, just possible. I haven't tested it myself.

Link to comment
Share on other sites

  • 2 years later...
katbyte

I'm hitting this in 2021 - was a solution ever found/posted? it would be nice to have a flag to just skip this as its a 100TB network volume where chown would fail to update any permissions anyways....

this causes the server to often take 10+ min to start as the docker container sits there spinning on trying to verify permissions that are all, always, correct.

Edited by katbyte
Link to comment
Share on other sites

1 hour ago, katbyte said:

I'm hitting this in 2021 - was a solution ever found/posted? it would be nice to have a flag to just skip this as its a 100TB network volume where chown would fail to update any permissions anyways....

this causes the server to often take 10+ min to start as the docker container sits there spinning on trying to verify permissions that are all, always, correct.

We'll respond in your topic. Thanks.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...