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

make graphite do fewer recursive chowns when starting #24442

Merged
merged 2 commits into from Apr 27, 2017

Conversation

andrewthad
Copy link
Contributor

Motivation for this change

The carbonCache service is currently incapable of starting once there are more than 500,000 metrics in the database. This happens because every time before carbonCache starts, a recursive chown is run on the graphite data directory. Since each metric is a distinct file, this chown hits a lot of files. On our production environment, it has recently gotten so slow that systemd times whenever we start carbonCache.

Looking through the service definition, it appears that the recursive chown was only used as convenient way to change ownership of a few directories and files immediately after they are created. This PR makes the ownership changes more explicit. Instead of recursing over the entire data directory, it now targets only the files that were just created. There is still some recursive chowning but none that ends up doing a recursive traversal of whisper (the directory containing all the metrics).

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

chown graphite:graphite ${cfg.dataDir}
chown graphite:graphite ${cfg.dataDir}/db-created
chown graphite:graphite ${cfg.dataDir}/whisper
chown -R graphite:graphite ${cfg.dataDir}/log
Copy link
Member

@Mic92 Mic92 Mar 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does db-created really needs to be owned by graphite? I would also make the touch command the last command in case commands before that fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea what db-created even is. It was previously being set to have graphite as its owner, so I left it that way. Looking over it again, it seems like just a part of the way that nixos manages graphite and is in no way touched by graphite itself. So, I'll go ahead and change that and move touch to be last.

@Mic92 Mic92 added the 9.needs: port to stable A PR needs a backport to the stable release. label Mar 30, 2017
@andrewthad
Copy link
Contributor Author

Updated the db-created logic.

@grahamc
Copy link
Member

grahamc commented Apr 25, 2017

One problem preventing me merging this (in looking for easy things to merge,) is the commit messages don't follow the commit format: https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md#submitting-changes

@fpletz fpletz merged commit e289b94 into NixOS:master Apr 27, 2017
@fpletz
Copy link
Member

fpletz commented Apr 27, 2017

Squashed & fixed the commit message. Thanks!

@andrewthad andrewthad deleted the graphite_without_recursive_chown branch April 27, 2017 16:45
@andrewthad
Copy link
Contributor Author

Thanks for fixing that!

@samueldr samueldr removed the 9.needs: port to stable A PR needs a backport to the stable release. label Apr 17, 2019
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.

None yet

5 participants