-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 systemd service state less slow #29008
Conversation
A stat is cheap and most units don't reside in /etc/systemd so the expensive operation of gathering all known units and iterating over them can be avoided.
@k00mi Additionally, it looks like this is causing a test to fail so if we were to merge this, we would need to have that fixed. Could you please take a look? Thanks. |
Instead of gathering and iterating over all known units we can just ask systemd about a given unit to check if it's available.
@cachedout Indeed parametrized units were not handled correctly. I think I fixed it now by asking The CentOS VMs don't even bootstrap properly and those tests that actually reach the systemd module fail with Looking at the definition of |
systemd module: new unit test for available
Make systemd service state less slow
As has been noted in #10710, execution of a systemd service state is quite slow. The suggested solution of using
systemctl is-enabled
only helps for the enable operation. Instead, these commits address the expensive function_untracked_custom_unit_found()
, which is used in several other places.Previously our highstate runs took about 45s to several minutes due to a bug in systemd/logind which leaks unit files. With these patches we are down to about 36s in all cases.