一直用的 jenkins + saltstack 自动化构建发布项目,一共也就不超过20台服务器,奈何运行时间愈来愈慢,而且负载愈来愈高(这里大部分都是使用state模块),可是不用state模块效率挺高的,因此初步锁定坑应该在 state配置以及运行机制上.node
查阅各类资料果不其然,须要注意几点.git
Minion 配置github
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),由上面的引文可见this
默认状况,每次执行state文件,minion都会发出 “_file_list” 命令从master同步整个文件列表。当fileserver(即master端配置文件中file_roots设置的目录)中的文件比较多的状况下,会增大集群负载.spa
再github上也搜到相似的问题,提供思路3d
参考: code
http://vearne.cc/?p=88orm
https://github.com/saltstack/salt/issues/30498server