saltstack执行state.sls耗时长的坑
? ? ? 一直用的 jenkins + saltstack 自動(dòng)化構(gòu)建發(fā)布項(xiàng)目,一共也就不超過(guò)20臺(tái)服務(wù)器,奈何運(yùn)行時(shí)間越來(lái)越慢,并且負(fù)載越來(lái)越高(這里大部分都是使用state模塊),但是不用state模塊效率挺高的,所以初步鎖定坑應(yīng)該在 state配置以及運(yùn)行機(jī)制上.
查閱各種資料果不其然,需要注意幾點(diǎn).
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.
雖然我修改了minion配置里的?fileserver_limit_traversal 為true 但是效果還是不明顯,因?yàn)檫@個(gè)fileserver目錄里面太多文件了(node打包等一系列文件全在里面,文件數(shù)太多了(⊙﹏⊙)b),由上面的引文可見(jiàn)
默認(rèn)情況,每次執(zhí)行state文件,minion都會(huì)發(fā)出 “_file_list” 命令從master同步整個(gè)文件列表。當(dāng)fileserver(即master端配置文件中file_roots設(shè)置的目錄)中的文件比較多的情況下,會(huì)增大集群負(fù)載.
再github上也搜到類(lèi)似的問(wèn)題,提供思路
?
參考:? ?
http://vearne.cc/?p=88
https://github.com/saltstack/salt/issues/30498
?
轉(zhuǎn)載于:https://www.cnblogs.com/loveyouyou616/p/10831623.html
總結(jié)
以上是生活随笔為你收集整理的saltstack执行state.sls耗时长的坑的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 为什么阿里巴巴建议集合初始化时,指定集合
- 下一篇: Debian 安装docker