Project

General

Profile

« Previous | Next » 

Revision d0dad658

Added by Dominic Cleal over 7 years ago

fixes #16749 - improve NIC update performance during fact imports

- In get_facts_for_interface, replace regexes in hash key filtering
with simple String methods and simplify hash construction
- Change logger.debug to lazy evaluation for production performance,
especially when calling #inspect

Before:

PuppetFactParser 1      6.114k (±16.1%) i/s -     57.836k in   9.951523s
PuppetFactParser 50 15.127 (±26.4%) i/s - 135.000 in 10.036620s
PuppetFactParser 500 0.143 (± 0.0%) i/s - 2.000 in 14.027935s
Memory stats
Total objects allocated: 61005590
Total heap pages allocated: 4218

After:

PuppetFactParser 1      9.308k (±14.8%) i/s -     87.936k in   9.934396s
PuppetFactParser 50 213.821 (±16.4%) i/s - 2.018k in 10.007988s
PuppetFactParser 500 2.610 (± 0.0%) i/s - 27.000 in 10.357182s
Total objects allocated: 149652784
Total heap pages allocated: 4221

(approximately 15x faster, and sub-second for the ~400 interfaces in the
bug report)

In Host#set_interface, unchanged interfaces are no longer saved to avoid
creating an unnecessary validation and DB transactions in most imports.

(cherry picked from commit 4d0870ad2503d9e1489aa18ddc4e837675a0b8f6)

  • added
  • modified
  • copied
  • renamed
  • deleted