Issue #4302 has been updated by Brice Figureau.

Priority changed from Normal to High

Brice Figureau wrote:
> My next step will be to rupy-prof to_resource in both version and compare the 
> outcome. This one looks easier to find the real issue.

I profiled Catalog#to_resource and found the culprit. I'm sure the other two 
are using the exact same code path.

So the issue is that we're constantly calling @LoadedFile#changed?@, even 
though we're not actively checking file stat, we still are calling this way too 
much.
For instance for a 2k resource catalog, we ended up calling 
@LoadedFile#changed?# 146429 times.

Why are we calling this? We certainly at this stage don't care if the source 
file changed or not, right?
Even in last compilation stage we certainly don't care.

We're calling this method through this method call chain:
# Puppet::Resource#initialize
# Puppet::Resource#resolve_type_and_title
# Puppet::Resource#resolve_type
# Puppet::Resource#find_resource_type
# Puppet::Resource#find_defined_resource_type
# Puppet::Resource::TypeCollectionHelper#known_resource_types
# Puppet::Node::Environment#known_resource_types
# Puppet::Resource::TypeCollection#stale?
# Puppet::Util::LoadedFile#changed?
 
So basically we might squeeze the stale? part after everything has been loaded, 
isn't it?
I didn't check but I think in 0.25.5 we were doing this stale checking only 
when we were creating the interpreter. The issue is that this functionality was 
pushed way too deep so now everybody is calling it without knowing.
In a word we need to re-introduce a barrier where the loaded types are 
immutable (and not checked for staleness) during the compilation. 

Does it make sense?

BTW, this adds an interesting question: what would happen if one file change 
_after_ the compilation but _before_ the transformation of the catalog through 
to_resources?
----------------------------------------
Bug #4302: compile performance on 2.6
http://projects.puppetlabs.com/issues/4302

Author: Peter Meier
Status: Accepted
Priority: High
Assigned to: 
Category: 
Target version: 
Affected version: 2.6.0
Keywords: 
Branch: 


Brice and I are observing 2.5 up to 6 times slower compile requests on 2.6 
compared to 0.25.5.

This ticket is about to document that issue and collecting further information 
about it.

Further investigations:

As a first thing we need to check, whether only the first compile request is 
slower or also subsequent compiles. According to Luke this would indicate that 
it is either a parsing or compiling issue.

Further ideas are welcome.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to