Bug #13859
closedLoad all ncf files in one go (or two)
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
Updated by Nicolas CHARLES about 6 years 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)
Updated by Nicolas CHARLES about 6 years ago
- Status changed from New to In progress
- Assignee set to Nicolas CHARLES
Updated by Nicolas CHARLES about 6 years 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
Updated by Nicolas CHARLES about 6 years 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
Updated by Nicolas CHARLES about 6 years ago
Also, note that this code is functionnal in Rudder 4.3
Updated by Nicolas CHARLES about 6 years ago
- Target version changed from 6.0.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)
Updated by Nicolas CHARLES about 6 years ago
- Pull Request changed from https://github.com/Normation/rudder-techniques/pull/1371 to https://github.com/Normation/rudder-techniques/pull/1372
Updated by Nicolas CHARLES about 6 years ago
- Translation missing: en.field_tag_list set to Next minor release
Updated by Vincent MEMBRÉ almost 6 years ago
- Target version changed from 4.3.7 to 4.3.8
Updated by Rudder Quality Assistant almost 6 years ago
- Assignee changed from Alexis Mousset to Nicolas CHARLES
Updated by Nicolas CHARLES almost 6 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder-techniques|284f20a4c8b131b0a611a19b8480d5755979b61b.
Updated by Vincent MEMBRÉ almost 6 years ago
- Status changed from Pending release to Released