On Oct 15, 2008, at 2:24 PM, Sean E. Millichamp wrote:
>
> This optimization reduces the runtime by more then half on SELinux-
> enabled
> systems in some informal performance testing I have been doing.
>
> It would be an even bigger win for anyone managing files on a
> filesystem where
> stat()s are particularly expensive (such as GFS).
>
> puppetd --test run before patch:
> real 1m56.197s
> user 1m8.780s
> sys 0m31.342s
>
> puppetd --test run after patch:
> real 0m58.404s
> user 0m23.165s
> sys 0m15.457s
>
> Same host, same configs, no changes occurring on either run.
>
> ---
> lib/puppet/util/selinux.rb | 59 ++++++++++++++++++++++++
> +------------------
> spec/unit/util/selinux.rb | 46 +++++++++++++++++++++++++++++----
> 2 files changed, 74 insertions(+), 31 deletions(-)
>
> diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
> index 0a4af3c..06f8dcb 100644
> --- a/lib/puppet/util/selinux.rb
> +++ b/lib/puppet/util/selinux.rb
> @@ -8,6 +8,9 @@
>
> module Puppet::Util::SELinux
>
> + @@selinux_actual_context = {}
> + @@selinux_default_context = {}
> +
If you're going to use class variables (or really, anything that gets
cached between transactions) you need to flush the variables between
transactions.
It might be as easy as setting a ttl on the cached values -- never
return values older than 0.5 of the runinterval, for instance.
You definitely don't want to just have a single value and stick with
it for the life of a process, though.
You probably also need some way to invalidate that cache when a file
gets changed.
You might want to look at util/cacher.rb in the master branch -- it'd
be straightforward to backport it.
--
When I die, I want go out just like my grandfather, in his sleep,
peaceful and quiet...not kicking and screaming like the other guys in
his car.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---