Ext pillar refresh interval
According to log file it looks like external pillar with gitfs backend is not refreshed with the same interval as states/formulas (loop_interval) but with every minion highstate. In small deploymonents it's not a problem but with 1200+ minions it's quite big overhead. Proccess list many times contains multiple git-remote-http entries. In my opinion it should be refreshed with the same interval as gitfs states.
My log file is full of:
2015-01-23 13:13:48,204 [root ][ERROR ] Unable to checkout branch master: 'git checkout origin/master' returned exit status 128: fatal: Unable to create '/var/cache/salt/master/pillar_gitfs/db7c3cf862a6464d5db742699e319e50/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. 2015-01-23 13:14:48,777 [root ][ERROR ] Unable to checkout branch master: 'git checkout origin/master' returned exit status 128: fatal: Unable to create '/var/cache/salt/master/pillar_gitfs/db7c3cf862a6464d5db742699e319e50/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. 2015-01-23 13:14:52,974 [root ][ERROR ] Unable to checkout branch master: 'git checkout origin/master' returned exit status 128: fatal: Unable to create '/var/cache/salt/master/pillar_gitfs/db7c3cf862a6464d5db742699e319e50/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. 2015-01-23 13:14:55,080 [root ][ERROR ] Unable to checkout branch master: 'git checkout origin/master' returned exit status 128: fatal: Unable to create '/var/cache/salt/master/pillar_gitfs/db7c3cf862a6464d5db742699e319e50/.git/index.lock': File exists.
My salt version is:
Salt: 2014.7.0
Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
Jinja2: unknown
M2Crypto: 0.20.2
msgpack-python: 0.1.13
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.4
Mako: Not Installed
How will increasing the frequency of updates fix the scaling issue? ext_pillar is only refreshed as often as pillar is refreshed, which is usually only on state calls.
Ohhhh, you're saying it's refreshing once per minion? That is an interesting problem, it would be nice to just keep it automatically up to date like gitfs rather than pulling on every pillar refresh. But that feels like it will require it to be decoupled from the pillar. Or perhaps even treated like a fileserver backend and refreshed with those. May be tricky to implement.
It would be nice if pillar could be defined the same way as states/formulas with gitfs and refresh with loop interval. As a workaround i've changed ext_pillar to pillar with local directory which is cloned from git by cron every 10 minutes.
Another thing that might make using ext_pillar more scalable is to just run one copy of the code and handle all the connections to the external data with that. As it stands now, if you run say 20 threads on the master, you will end up with 20 copies of the ext_pillar code running and you have to implement your own caching and locking in that code. This also makes using connection pooling much more difficult.
I'm waiting for improvements. Local pillar code updated with cron from gitfs works ok for now.
So, this is actually a fairly subtantial issue.
Since all the workers are blocking on these git pillar fetches, we're putting the master at risk of not having any available workers right when they're really needed. Not only is that bad from a performance perspective, it would also explain some of the transient missing returns issues that have been widely reported.
After talking this over with @thatch45, the proposal is to go with a change to external pillars to put their updates in the master maintanence process and let them update on the loop interval instead of during the state run.
UPDATE: Just looked and this is already in the maintenence process. Therefore, I am going to simply remove the call to update() in the git pillar ext_pillar function.
But we could still force a pillar update with 'saltutil.refresh_pillar' correct?
@cro Yes.
@msciciel Can you give the fix about a try and let us know if this is resolved for you?
After applying patch I can not see any traffic to git server during state.highstate.
@msciciel Awesome! Thanks for giving the patch a try. If it's alight with you, I'm going to close this issue. If this pops up again, do leave a comment and we will be happy to open this again. Thanks!