• saltstack执行state.sls耗时长的坑


          一直用的 jenkins + saltstack 自动化构建发布项目,一共也就不超过20台服务器,奈何运行时间越来越慢,并且负载越来越高(这里大部分都是使用state模块),但是不用state模块效率挺高的,所以初步锁定坑应该在 state配置以及运行机制上.

    查阅各种资料果不其然,需要注意几点.

    Minion 配置


    By default, the Salt fileserver recurses fully into all defined environments
    to attempt to find files. To limit this behavior so that the fileserver only
    traverses directories with SLS files and special Salt directories like _modules,
    enable the option below. This might be useful for installations where a file root
    has a very large number of files and performance is negatively impacted. Default
    is False.

    # 关闭软连接
    fileserver_followsymlinks: False
    # 忽略软连接
    fileserver_ignoresymlinks: True
    # 见上面的引文
    fileserver_limit_traversal: True

    虽然我修改了minion配置里的 fileserver_limit_traversal 为true 但是效果还是不明显,因为这个fileserver目录里面太多文件了(node打包等一系列文件全在里面,文件数太多了(⊙﹏⊙)b),由上面的引文可见

    默认情况,每次执行state文件,minion都会发出 “_file_list” 命令从master同步整个文件列表。当fileserver(即master端配置文件中file_roots设置的目录)中的文件比较多的情况下,会增大集群负载.

    再github上也搜到类似的问题,提供思路

    参考:   

    http://vearne.cc/?p=88

    https://github.com/saltstack/salt/issues/30498

  • 相关阅读:
    最大流基础
    转一篇写期望的日志
    poj3267The Cow Lexicon(dp)
    poj3026Borg Maze(bfs+MST)
    poj2226Muddy Fields(二分图的最小点覆盖)
    poj1035Spell checker(字符串模拟)
    poj1422Air Raid(最小路径覆盖)
    poj3020Antenna Placement(最小路径覆盖)
    [JSOI2009]火星藏宝图
    [SHOI2007]书柜的尺寸
  • 原文地址:https://www.cnblogs.com/loveyouyou616/p/10831623.html
Copyright © 2020-2023  润新知