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

CPU constantly spinning up and down #10

Closed
ericp-mrel opened this issue Dec 10, 2020 · 2 comments
Closed

CPU constantly spinning up and down #10

ericp-mrel opened this issue Dec 10, 2020 · 2 comments
Assignees

Comments

@ericp-mrel
Copy link

ericp-mrel commented Dec 10, 2020

I am using devilbox to run 15 local sites for development, and some of those sites have lots of little files (user uploads).
Whenever this script runs, I can hear my CPU fan spin up and down constantly as this script traverses every single directory and sub-directory.

Using the time command, it says it takes almost 2s for the find command to run. I have 807983 files and folders, at least that's the number I get back by counting the number of lines returned from the find command.

I would like to propose a change for the find command to use the -maxdepth 1 option so that it doesn't have to uselessly traverse every single sub-directly since we really only care about the direct folders underneath the /shared/httpd directory (specifically in devilbox). Using the maxdepth option reduces the time it takes to run the command down to just 0.022s which is a significant savings, and could also reduce the amount of disk I/O required as well.

I kind of suspect this script could reduce the lifespan of an SSD because of how much it is looping through all of my files and folders, every few seconds for 8+ hours a day.

And if we really want to optimize, we could also pass the -type d option so the find command only gets folders only instead of both files and folders by default. This could also replace the need for the two grep statements possibly since those seem like there really only used for getting the base folders from what I understand.

I can make a PR if you would like to implement this change.

@cytopia
Copy link
Member

cytopia commented Dec 13, 2020

@ericp-mrel it is now implemented upstream: cytopia/devilbox#765 in release v1.9.0

@jameswadsworth
Copy link

Great. The updated to v1.9.0 resolves the watcherd performance issue for me

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

No branches or pull requests

3 participants