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
make graphite do fewer recursive chowns when starting #24442
Conversation
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
… of database setup
Updated the |
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 |
Squashed & fixed the commit message. Thanks! |
Thanks for fixing that! |
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 beforecarbonCache
starts, a recursivechown
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 startcarbonCache
.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
chown
ing but none that ends up doing a recursive traversal ofwhisper
(the directory containing all the metrics).Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)