On Tuesday, 5 November 2013 15:14:26 UTC, jcbollinger wrote: > > > > On Monday, November 4, 2013 10:38:00 AM UTC-6, james.e...@fasthosts.comwrote: >> >> Hi, >> >> I am having some issues with facter on a couple of servers which have a >> large number of ip addresses. >> >> Essentially, all my puppet runs time out because facter takes in excess >> of 25 seconds to populate the facts. >> >> Here is the list of interfaces - pretty much each one has an IP assigned. >> >> interfaces => >> eth0,eth1,eth1_1,eth1_2,eth1_3,eth1_4,eth1_5,eth1_6,eth1_7,eth1_8,eth1_9,eth1_10,eth1_11,eth1_12,eth1_13,eth1_14,eth1_15,eth1_16,eth1_17,eth1_18,eth1_19,eth1_20,eth1_21,eth1_22,eth1_23,eth1_24,eth1_25, >> >> eth1_26,eth1_27,eth1_28,eth1_29,eth1_30,eth1_31,eth1_32,eth1_33,eth1_34,eth1_35,eth1_36,eth1_37,eth1_38,eth1_39,eth1_40,eth1_41,eth1_42,eth1_43,eth1_44,eth1_45,eth1_46,eth1_47,eth1_48,eth1_49,eth1_50, >> >> eth1_51,eth1_52,eth1_53,eth1_54,eth1_55,eth1_56,eth1_57,eth1_58,eth1_59,eth1_60,eth1_61,eth1_62,eth1_63,eth1_64,eth1_65,eth1_66,eth1_67,eth1_68,eth1_69,eth1_70,eth1_71,eth1_72,eth1_73,eth1_74,eth1_75, >> >> eth1_76,eth1_77,eth1_78,eth1_79,eth1_80,eth1_81,eth1_82,eth1_83,eth1_84,eth1_85,eth1_86,eth1_87,eth1_88,eth1_89,eth1_90,eth1_91,eth1_92,eth1_93,eth1_94,eth1_95,eth1_96,eth1_97,eth1_98,eth1_99,eth1_100, >> >> eth1_101,eth1_102,eth1_103,eth1_104,eth1_105,eth1_106,eth1_107,eth1_108,eth1_109,eth1_110,eth1_111,eth1_112,eth1_113,eth1_114,eth1_115,eth1_116,eth1_117,eth1_118,eth1_119,eth1_120,eth1_121,eth1_122, >> >> eth1_123,eth1_124,eth1_125,eth1_126,eth1_127,eth1_128,eth1_129,eth1_130,eth1_131,eth1_132,eth1_133,eth1_134,eth1_135,eth1_136,eth1_137,eth1_138,eth1_139,eth1_140,eth1_141,eth1_142,eth1_143,eth1_144, >> >> eth1_145,eth1_146,eth1_147,eth1_148,eth1_149,eth1_150,eth1_151,eth1_152,eth1_153,eth1_154,eth1_155,eth1_156,eth1_157,eth1_158,eth1_159,eth1_160,eth1_161,eth1_162,eth1_163,eth1_164,eth1_165,eth1_166, >> >> eth1_167,eth1_168,eth1_169,eth1_170,eth1_171,eth1_172,eth1_173,eth1_174,eth1_175,eth1_176,eth1_177,eth1_178,eth1_179,eth1_180,eth1_181,eth1_182,eth1_183,eth1_184,eth1_185,eth1_186,eth1_187,eth1_188, >> >> eth1_189,eth1_190,eth1_191,eth1_192,eth1_193,eth1_194,eth1_195,eth1_196,eth1_197,eth1_198,eth1_199,eth1_200,eth1_201,eth1_202,eth1_203,eth1_204,eth1_205,eth1_206,eth1_207,eth1_208,eth1_209,eth1_210,eth1_211, >> >> eth1_212,eth1_213,eth1_214,eth1_215,eth1_216,eth1_217,eth1_218,eth1_219,eth1_220,eth1_221,eth1_222,eth1_223,eth1_224,eth1_225,eth1_226,eth1_227,eth1_228,eth1_229,eth1_230,eth1_231,eth1_232,eth1_233,eth1_234, >> >> eth1_235,eth1_236,eth1_237,eth1_238,eth1_239,eth1_240,eth1_241,eth1_242,eth1_243,eth1_244,eth1_245,eth1_246,eth1_247,eth1_248,eth1_249,eth1_250,eth1_251,eth1_252,eth1_253,eth1_254,eth1_255,eth1_256,eth1_257, >> >> eth1_258,eth1_259,eth1_260,eth1_261,eth1_262,eth1_263,eth1_264,eth1_265,eth1_266,eth1_267,eth1_268,eth1_269,eth1_270,eth1_271,eth1_272,eth1_273,eth1_274,eth1_275,eth1_276,eth1_277,eth1_278,eth1_279,eth1_280, >> >> eth1_281,eth1_282,eth1_283,eth1_284,eth1_285,eth1_286,eth1_287,eth1_288,eth1_289,eth1_290,eth1_291,eth1_292,eth1_293,eth1_294,eth1_295,eth1_296,eth1_297,eth1_298,eth1_299,eth1_300,eth1_301,eth1_302,eth1_303, >> >> eth1_304,eth1_305,eth1_306,eth1_307,eth1_308,eth1_309,eth1_310,eth1_311,eth1_312,eth1_313,eth1_314,eth1_315,eth1_316,eth1_317,eth1_318,eth1_319,eth1_320,eth1_321,eth1_322,eth1_323,eth1_324,eth1_325,eth1_326, >> >> eth1_327,eth1_328,eth1_329,eth1_330,eth1_331,eth1_332,eth1_333,eth1_334,eth1_335,eth1_336,eth1_337,eth1_338,eth1_339,eth1_340,eth1_341,eth1_342,eth1_343,eth1_344,eth1_345,eth1_346,eth1_347,eth1_348,eth1_349, >> >> eth1_350,eth1_351,eth1_352,eth1_353,eth1_354,eth1_355,eth1_356,eth1_357,eth1_358,eth1_359,eth1_360,eth1_361,eth1_362,eth1_363,eth1_364,eth1_365,eth1_366,eth1_367,eth1_368,eth1_369,eth1_370,eth1_371,eth1_372, >> >> eth1_373,eth1_374,eth1_375,eth1_376,eth1_377,eth1_378,eth1_379,eth1_380,eth1_381,eth1_382,eth1_383,eth1_384,eth1_385,eth1_386,eth1_387,eth1_388,eth1_389,eth1_390,eth1_391,eth1_392,eth1_393,eth1_394,eth1_395, >> >> eth1_396,eth1_397,eth1_398,eth1_399,eth1_400,eth1_401,eth1_402,eth1_403,eth1_404,eth1_405,eth1_406,eth1_407,eth1_408,eth1_409,eth1_410,eth1_411,eth1_412,eth1_413,eth1_414,eth1_415,eth1_416,eth1_417,eth1_418, >> >> eth1_419,eth1_420,eth1_421,eth1_422,eth1_423,eth1_424,eth1_425,eth1_426,eth1_427,eth1_428,eth1_429,eth1_430,eth1_431,eth1_432,eth1_433,eth1_434,eth1_435,eth1_436,eth1_437,eth1_438,eth1_439,eth1_440,eth1_441, >> >> eth1_442,eth1_443,eth1_444,eth1_445,eth1_446,eth1_447,eth1_448,eth1_449,eth1_450,eth1_451,eth1_452,eth1_453,eth1_454,eth1_455,eth1_456,eth1_457,eth1_458,eth1_459,eth1_460,eth1_461,eth1_462,eth1_463,eth1_464, >> >> eth1_465,eth1_466,eth1_467,eth1_468,eth1_469,eth1_470,eth1_471,eth1_472,eth1_473,eth1_474,eth1_475,eth1_476,eth1_477,eth1_478,eth1_479,eth1_480,eth1_481,eth1_482,eth1_483,eth1_484,eth1_485,eth1_486,eth1_487, >> >> eth1_488,eth1_489,eth1_490,eth1_491,eth1_492,eth1_493,eth1_494,eth1_495,eth1_496,eth1_497,eth1_498,eth1_499,eth1_500,eth1_501,eth1_502,eth1_503,eth1_504,eth1_505,eth1_506,eth1_507,eth1_508,eth2,eth3,lo,sit0 >> >> There are just over 500 entries. I also subsequently have >500 facts for >> ipaddress_eth1_xxx, netmask_eth1_xxx, network_eth1_xxx, >> macaddress_eth1_xxx, mtu_eth1_xxx, etc. >> >> So, its a very large number of facts, but 25 seconds does seem a little >> excessive imo. >> >> > > I agree that 25 seconds seems excessive, but so does 500 interfaces. > Clearly facter's implementation does not anticipate anything like that > many. From what I know of Facter's design, I think it likely that Facter > launches an external command (e.g. 'ifconfig') once for each interface, to > obtain the details of that interface. That's not too bad for a handful of > interfaces, but it doesn't scale well to so many. > > And indeed, a bit of analysis of the latest Facter code on github shows > that that's *exactly* what Facter does, at least by default (including on > Linux; facter/lib/facter/util/ip/base.rb, method > value_for_interface_and_label()). I haven't checked exactly which other > kernels rely on the default behavior, but the way the code is structured > leads me to guess that even those that override the default follow a > similar strategy. > > I suggest you file an RFE with PuppetLabs. Meanwhile, I think your best > workaround is to deploy a custom-modified version of Facter. If you don't > need the per-interface facts then a good quick-and-dirty approach might be > to ditch them altogether, or at least to give them dummy values instead of > values drawn from the output of an external command. Replacing the whole > method I pointed out with just > > def self.value_for_interface_and_label(interface, label, cmd = nil) > 'dummy' > end > > > might suffice (again, as long as you're not using the fact values). > > A real solution would probably require Facter to collect all the data via > a single external command, instead of running a separate command for each > interface. I'm not prepared to suggest a suitable modification to > implement that. > > > John > > > Hi John,
Thanks for the response :) I've noticed another bug regarding facter using ifconfig instead of "ip addr" as I think it's loosely related. Perhaps the ip command wouldn't cause the same timeouts. http://projects.puppetlabs.com/issues/1346 So I'll add some comments to that. Thanks also for the code example - I think I'll use that for now. Regards J -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/445ca9fe-daa6-4dd0-a045-87803da101ef%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.