Project

General

Profile

Bug #13859

Load all ncf files in one go (or two)

Added by Nicolas CHARLES 10 months ago. Updated 8 months ago.

Status:
Released
Priority:
N/A
Category:
Performance and scalability
Target version:
Severity:
User visibility:
Effort required:
Priority:
0

Description

Now that the agent supports quite large list, we can revert the splitting of loading policy files from 11 call, to only one or two

Testing on a 4.3 Rudder, moving from the old

      "path_ncf_common_inputs_10" slist => splitstring(execresult("${compatible_inputs_cmd} common/10_ncf_internals", "${shell_type}"), "\n", 10000);
      "path_ncf_common_inputs_20" slist => splitstring(execresult("${compatible_inputs_cmd} common/20_cfe_basics", "${shell_type}"), "\n", 10000);
      "path_ncf_common_inputs_30" slist => splitstring(execresult("${compatible_inputs_cmd} common/30_generic_methods", "${shell_type}"), "\n", 10000);
      "path_ncf_common_inputs_40" slist => splitstring(execresult("${compatible_inputs_cmd} common/40_it_ops_knowledge", "${shell_type}"), "\n", 10000);
      "path_ncf_common_inputs_50" slist => splitstring(execresult("${compatible_inputs_cmd} common/50_techniques", "${shell_type}"), "\n", 10000);
      "path_ncf_common_inputs_60" slist => splitstring(execresult("${compatible_inputs_cmd} common/60_services", "${shell_type}"), "\n", 10000);

      "path_ncf_local_inputs_10" slist => splitstring(execresult("${compatible_inputs_cmd} local/10_ncf_internals", "${shell_type}"), "\n", 10000);
      "path_ncf_local_inputs_20" slist => splitstring(execresult("${compatible_inputs_cmd} local/20_cfe_basics", "${shell_type}"), "\n", 10000);
      "path_ncf_local_inputs_30" slist => splitstring(execresult("${compatible_inputs_cmd} local/30_generic_methods", "${shell_type}"), "\n", 10000);
      "path_ncf_local_inputs_40" slist => splitstring(execresult("${compatible_inputs_cmd} local/40_it_ops_knowledge", "${shell_type}"), "\n", 10000);
      # Files from 50_techniques are automatically included by Rudder's metadata.xml mechanism
      "path_ncf_local_inputs_60" slist => splitstring(execresult("${compatible_inputs_cmd} local/60_services", "${shell_type}"), "\n", 10000);

      # Must concatenate all lists + filter, as maplist on an empty element returns cf_null
      "raw_path_ncf_inputs" slist => { @{path_ncf_common_inputs_10}, @{path_ncf_local_inputs_10}, @{path_ncf_common_inputs_20}, @{path_ncf_local_inputs_20}, @{path_ncf_common_inputs_30}, @{path_ncf_local_inputs_30}, @{path_ncf_common_inputs_40}, @{path_ncf_local_inputs_40}, @{path_ncf_common_inputs_50}, @{path_ncf_common_inputs_60}, @{path_ncf_local_inputs_60}},
                           policy => "ifdefined" 

to

       "path_ncf_common_inputs" slist => splitstring(execresult("${compatible_inputs_cmd} common", "${shell_type}"), "\n", 10000);
       "raw_path_ncf_local_inputs" slist => splitstring(execresult("${compatible_inputs_cmd} local", "${shell_type}"), "\n", 10000);

       # filtering out 50_techniques from local list
      "path_ncf_local_inputs" slist  => filter("/var/rudder/ncf/local/50_techniques.*", "raw_path_ncf_local_inputs", "true", "false", 10000);

      "raw_path_ncf_inputs" slist => { @{path_ncf_common_inputs}, @{path_ncf_local_inputs}},
                           policy => "ifdefined";

improves the perf of the policy validation from 1.4s to 1s

Before

orchestrateur-3:~ # /usr/bin/time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 
real    0m1.440s
user    0m0.900s
sys    0m0.132s
orchestrateur-3:~ # /usr/bin/time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 
0.87user 0.15system 0:01.43elapsed 71%CPU (0avgtext+0avgdata 15604maxresident)k
0inputs+8outputs (0major+219905minor)pagefaults 0swaps

## Summary #####################################################################
   => 59 components in Enforce mode
      -> 51 compliant
      -> 2 repaired
      -> 6 not-applicable
Execution time: 7.65s

After

 time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 

real    0m0.947s
user    0m0.760s
sys    0m0.084s

# /usr/bin/time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 
0.85user 0.04system 0:01.00elapsed 90%CPU (0avgtext+0avgdata 15004maxresident)k
0inputs+0outputs (0major+50985minor)pagefaults 0swaps

We could also improve it again by changing the script that would load only once everything.

caution : i had to purge the cf files in /usr/share/ncf/tree


Files

list-compatible-inputs-ng (8.02 KB) list-compatible-inputs-ng Nicolas CHARLES, 2018-11-19 14:49

Associated revisions

Revision 284f20a4 (diff)
Added by Nicolas CHARLES 10 months ago

Fixes #13859: Load all ncf files in one go (or two)

History

#1

Updated by Nicolas CHARLES 10 months ago

Only doing one load result in

orchestrateur-3:/var/rudder/cfengine-community/inputs # /usr/bin/time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 
0.80user 0.05system 0:00.93elapsed 91%CPU (0avgtext+0avgdata 15580maxresident)k
0inputs+0outputs (0major+39257minor)pagefaults 0swaps
# time /var/rudder/cfengine-community/bin/cf-promises -f /var/rudder/cfengine-community/inputs/promises.cf 

real    0m0.937s
user    0m0.796s
sys    0m0.060s

and it requieres a big change in list-compatible-inputs (cc'ed)

#2

Updated by Nicolas CHARLES 10 months ago

  • Status changed from New to In progress
  • Assignee set to Nicolas CHARLES
#3

Updated by Nicolas CHARLES 10 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Nicolas CHARLES to Alexis MOUSSET
  • Pull Request set to https://github.com/Normation/rudder-techniques/pull/1371
#4

Updated by Nicolas CHARLES 10 months ago

tested with 4179 files in common/30 and 300 files in /local/30: success
the cf-promises times gets to 10.35s, but it doesn't crash

#5

Updated by Nicolas CHARLES 10 months ago

Also, note that this code is functionnal in Rudder 4.3

#6

Updated by Nicolas CHARLES 10 months ago

  • Target version changed from 5.1.0~beta1 to 4.3.7

targeting 4.3 as it offer massive perf boost for minimal risk (need a 4.1 agent to work)

#7

Updated by Nicolas CHARLES 10 months ago

  • Pull Request changed from https://github.com/Normation/rudder-techniques/pull/1371 to https://github.com/Normation/rudder-techniques/pull/1372
#8

Updated by Nicolas CHARLES 10 months ago

  • Tags set to Next minor release
#9

Updated by Vincent MEMBRÉ 10 months ago

  • Target version changed from 4.3.7 to 4.3.8
#10

Updated by Rudder Quality Assistant 9 months ago

  • Assignee changed from Alexis MOUSSET to Nicolas CHARLES
#11

Updated by Nicolas CHARLES 9 months ago

  • Status changed from Pending technical review to Pending release
#12

Updated by Vincent MEMBRÉ 8 months ago

  • Status changed from Pending release to Released
This bug has been fixed in Rudder 4.3.8 and 5.0.4 which were released today.
Changelog
Changelog

Also available in: Atom PDF