Skip to content

Commit

Permalink
Clarify soft limit on number of facts
Browse files Browse the repository at this point in the history
Puppet warns when the total number of fact values exceeds a soft limit,
as PuppetDB performance can start to degrade as that number grows.

However, the language that Puppet currently uses to talk about this
limit can be ambiguous. We want to emphasize that the total number of
fact values--counting all children of all facts (every value in all
arrays, hashes, etc.)--is what is relevant to performance.

This commit adds more explicit language about what this number is
counting.
  • Loading branch information
mhashizume committed Aug 27, 2024
1 parent 267684a commit f7dfc72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/configurer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def convert_catalog(result, duration, facts, options = {})
end

def warn_number_of_facts(size, max_number)
Puppet.warning _("The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}") % { size: size, max_size: max_number }
Puppet.warning _("The current total number of fact values: %{size} exceeds the fact values limit: %{max_size}") % { size: size, max_size: max_number }
end

def warn_fact_name_length(name, max_length)
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,9 @@ def self.initialize_default_settings!(settings)
:number_of_facts_soft_limit => {
:default => 2048,
:type => :integer,
:desc => "The soft limit for the total number of facts.",
:desc => "The soft limit for the total number of fact values. This counts the
child elements of all facts (e.g. all items of an array or a hash), not just top
level facts.",
},
:payload_soft_limit => {
:default => 16 * 1024 * 1024,
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/configurer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
}
Puppet::Node::Facts.indirection.save(facts)

expect(Puppet).to receive(:warning).with(/The current total number of facts: [1-9]* exceeds the number of facts limit: [1-9]*/)
expect(Puppet).to receive(:warning).with(/The current total number of fact values: [1-9]* exceeds the fact values limit: [1-9]*/)
configurer.run
end

Expand Down

0 comments on commit f7dfc72

Please sign in to comment.