Is there any way to profile Puppet recipes? For example, here's a node
(hostname changed to protect the innocent) in our nodes.pp:

node host002 {
    include puppet_client_base
    include subversion::server    # sets up the system to be a subversion
server
    include motd                  # controls /etc/motd from a template
    include ntp                   # handles ntp client config
    include user::root            # ensures root user has correct uid, pw,
etc.
}

class puppet_client_base inherits base {
    include common::puppet_client
}

class base {
    include common::passwd     # validates perms and ownership of
/etc/passwd, group, etc.
    include dns::resolv_conf   # creates /etc/resolv.conf
    include ssh                # controls /etc/ssh/ssh_config from template
    include mcollective        # installs mcollective and activemq client
config
}

That's not a huge amount IMHO but it takes around 34 seconds on a system
that is otherwise doing nothing. I'm assuming that some package checks are
what is taking the longest but I can't really tell, even from debug output.
It would be nice if I could run something like "puppet agent -t --profile"
and get output that reports how long classes take to evaluate/apply
(perhaps with even deeper breakdowns depending on what is done in each
class).

I tried the following but couldn't figure out how to get the current
timestamp in puppet:

/tmp # cat test.pp
class test {
    notice("entering class $name")
    package { "vim-common": ensure => present }
    include foo
    notice("leaving class $name")
}
class foo {
    notice("entering class $name")
    file { "/tmp/foo": ensure => present }
    notice("leaving class $name")
}
include test
/tmp # puppet apply test.pp
notice: Scope(Class[Test]): entering class test
notice: Scope(Class[Foo]): entering class foo
notice: Scope(Class[Foo]): leaving class foo
notice: Scope(Class[Test]): leaving class test
notice: /Stage[main]/Foo/File[/tmp/foo]/ensure: created
notice: Finished catalog run in 0.67 seconds
/tmp #


Is any kind of profiling currently available, feasible, or even on the
roadmap?

Thanks,
Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to