Forum: Cfengine Help
Subject: Adding large number of host classes slows down cfengine drastically
Author: Sal
Link to topic: https://cfengine.com/forum/read.php?3,19521,19521#msg-19521

I'm not sure if anyone else has already talked about this topic but here goes 
just in case.

I added several host classes to my cfengine configuration and when cf-execd 
runs it now takes several minutes (up to 8 minutes) to finish its run. I'm 
running cfengine 3.0.5p1 on centos 5.4.

Here is an example of the size of the bundle that has the definitions of the 
host classes:

bundle common prod_host_classes
{

vars:

        "prod_web_hosts" string => "www.*";
        "prod_cache_hosts" string => "cache.*";
        "prod_updater_hosts" string => "updater.*";
        "prod_db_hosts" string => "db.*";
        "prod_admin_hosts" string => "admin.*";
        "prod_sched_hosts" string => "scheduler.*";
        "prod_presales_hosts" slist => { "presales01", "sales_demo01", 
"sales_clean01" };
        "prod_data_hosts" slist => { "clean01", "ms.*" };
        "prod_nagios_hosts" slist => { "monitor01", "emonitor01" };
        "prod_backups_hosts" string => "backup01";
        
classes:

        "prod_web" or => { classmatch("$(prod_web_hosts)") };
        "prod_cache" or => { classmatch("$(prod_cache_hosts)") };
        "prod_updater" or => { classmatch("$(prod_updater_hosts)") };
        "prod_db" or => { classmatch("$(prod_db_hosts)") };
        "prod_admin" or => { classmatch("$(prod_admin_hosts)") };
        "prod_sched" or => { classmatch("$(prod_sched_hosts)") };
        "prod_presales" or => { classmatch("$(prod_presales_hosts)") };
        "prod_data" or => { classmatch("$(prod_data_hosts)") };
        "prod_nagios" or => { classmatch("$(prod_nagios_hosts)") };
        "prod_backups" or => { classmatch("$(prod_backups_hosts)") };
        "all_prod" or => 
                { 
                classmatch("$(prod_web_hosts)"), 
                classmatch("$(prod_cache_hosts)"), 
                classmatch("$(prod_updater_hosts)"), 
                classmatch("$(prod_db_hosts)"), 
                classmatch("$(prod_admin_hosts)"), 
                classmatch("$(prod_sched_hosts)"),  
                classmatch("$(prod_presales_hosts)"), 
                classmatch("$(prod_data_hosts)"), 
                classmatch("$(prod_nagios_hosts)"), 
                classmatch("$(prod_backups_hosts)")
                };

}

The actual bundle is even larger then that but you get the idea... Does anyone 
have an idea of how I can do this in a more efficient way? Every time it runs 
(every 20 minutes) cfengine has to evaluate the list of classes and it can take 
as long as 8 - 10 minutes on busy servers. I have other such bundles for 
smaller groups of host classes that have just added to the total time.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to