salt icon indicating copy to clipboard operation
salt copied to clipboard

Invoking Multiple Concurrent salt-call commands on minions results in SaltClientError

Open clusterfudge opened this issue 12 years ago • 30 comments

I'm running a deployment orchestration/metadata service on top of salt, using ssh'ing into minions and invoking salt-call locally. When executing on 30 hosts concurrently, I'm seeing high numbers of SaltClientErrors with the following stack trace:

An exception occurred in this state: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/salt/state.py", line 1315, in call _cdata['args'], *_cdata['kwargs']) File "/usr/lib/pymodules/python2.7/salt/states/file.py", line 1511, in recurse elif _src_path.strip('/') not in salt'cp.list_master_dirs': File "/usr/lib/pymodules/python2.7/salt/modules/cp.py", line 364, in list_master_dirs _mk_client() File "/usr/lib/pymodules/python2.7/salt/modules/cp.py", line 63, in _mk_client salt.fileclient.get_file_client(opts) File "/usr/lib/pymodules/python2.7/salt/fileclient.py", line 42, in get_file_client }.get(opts['file_client'], RemoteClient)(opts) File "/usr/lib/pymodules/python2.7/salt/fileclient.py", line 643, in init self.auth = salt.crypt.SAuth(opts) File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 502, in init self.crypticle = self.__authenticate() File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 514, in __authenticate self.opts.get('_safe_auth', True) File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 362, in sign_in raise SaltClientError SaltClientError

The kwarg timeout default for sign_in is 60s, so it's hard to imagine a legitimate situation in which auth is actually taking this long.

clusterfudge avatar Feb 06 '14 14:02 clusterfudge

Sorry, for a little bit more detail, this has been occurring since v0.15.*, but I've only had meaningful stack traces since upgrading to v0.17.5.

thanks!

clusterfudge avatar Feb 06 '14 15:02 clusterfudge

Interesting. Thanks for this report. When you say you're running salt-call locally, does that mean you're running it masterless with the --local flag or are these minions connecting back to a master? This looks like a master is involved but I just want to be certain before we continue.

cachedout avatar Feb 06 '14 17:02 cachedout

The minions are connecting back to the master on these calls. Let me know if there are any other holes in my story. Thanks!

clusterfudge avatar Feb 06 '14 17:02 clusterfudge

@clusterfudge OK, that's what I figured but it pays to ask up front. :] Now, can we take a peek at a --versions-report for both the minions in question as well as the master? Also, do you see any stack traces on the master side?

cachedout avatar Feb 06 '14 17:02 cachedout

No exceptions from the master logs during this time period. Here's versions report from the minion

$ sudo salt-call --versions-report Salt: 0.17.5 Python: 2.7.3 (default, Apr 10 2013, 06:20:15) Jinja2: 2.6 M2Crypto: 0.21.1 msgpack-python: 0.1.10 msgpack-pure: Not Installed pycrypto: 2.4.1 PyYAML: 3.10 PyZMQ: 13.1.0 ZMQ: 3.2.4

And from the master:

salt-call --versions-report Salt: 0.17.5 Python: 2.7.3 (default, Sep 26 2013, 20:03:06) Jinja2: 2.6 M2Crypto: 0.21.1 msgpack-python: 0.1.10 msgpack-pure: Not Installed pycrypto: 2.4.1 PyYAML: 3.10 PyZMQ: 13.1.0 ZMQ: 3.2.4

clusterfudge avatar Feb 06 '14 21:02 clusterfudge

@clusterfudge Have you tried adjusting the number of worker_threads on the master? http://docs.saltstack.com/ref/configuration/master.html#worker-threads

cachedout avatar Feb 07 '14 19:02 cachedout

I have not. Let me try that and get back to you.

On Fri, Feb 7, 2014 at 11:05 AM, Mike Place [email protected]:

@clusterfudge https://github.com/clusterfudge Have you tried adjusting the number of worker_threads on the master? http://docs.saltstack.com/ref/configuration/master.html#worker-threads

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10232#issuecomment-34488755 .

clusterfudge avatar Feb 07 '14 19:02 clusterfudge

Our master is currently running with 8 worker threads, on an 8-core vm. I'm seeing these issues primarily when 30 minions are communicating simultaneously (and I'd like to bump that number up significantly). What do you think is an acceptable worker_threads -> CPU cores ratio?

clusterfudge avatar Feb 07 '14 19:02 clusterfudge

@clusterfudge That's kind of a tricky question. I've heard of people running more than 15-20. I'd first like to see if you set it really high (let's say 30), if the problem goes away. That's not necessarily the best solution in production but I'm curious on its affect on this problem, if any.

cachedout avatar Feb 07 '14 19:02 cachedout

Ok, we'll try bumping it up. The only time I'm doing that level of concurrency is with a deploy of one of our larger services; there will probably be one on monday or tuesday. I'll follow up with results after that.

thanks!

On Fri, Feb 7, 2014 at 11:41 AM, Mike Place [email protected]:

@clusterfudge https://github.com/clusterfudge That's kind of a tricky question. I've heard of people running more than 15-20. I'd first like to see if you set it really high (let's say 30), if the problem goes away. That's not necessarily the best solution in production but I'm curious on its affect on this problem, if any.

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10232#issuecomment-34493166 .

clusterfudge avatar Feb 07 '14 19:02 clusterfudge

Ran a test yesterday morning that had the master configured to 30 max workers, and I only experienced 1 SaltClientError (same stack trace as above) out of 640 salt calls.

clusterfudge avatar Feb 11 '14 14:02 clusterfudge

How many errors would you have experienced previously? (I'm curious)

basepi avatar Feb 11 '14 21:02 basepi

~100 in a 20 minute period (including retries) On Feb 11, 2014 1:38 PM, "Colton Myers" [email protected] wrote:

How many errors would you have experienced previously? (I'm curious)

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10232#issuecomment-34810375 .

clusterfudge avatar Feb 11 '14 21:02 clusterfudge

So a marked improvement, then. Still, I would prefer there weren't any errors, it should be queueing these requests even if there aren't available worker threads, if I understand correctly.

basepi avatar Feb 11 '14 22:02 basepi

Definitely marked improvement, but I'd also like to bump my parallelism up to all hosts in a deployment (right now around 80 per datacenter, our usual unit of deployment). We were definitely struggling with worker threads set to 5, and if things aren't /completely/ clear at 30, I suspect jumping to 80 isn't going to work well either. I can always run another test, but this would be testing on prod (no bueno).

On Tue, Feb 11, 2014 at 2:34 PM, Colton Myers [email protected]:

So a marked improvement, then. Still, I would prefer there weren't any errors, it should be queueing these requests even if there aren't available worker threads, if I understand correctly.

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10232#issuecomment-34816888 .

clusterfudge avatar Feb 12 '14 15:02 clusterfudge

Is there any more info I can collect?

On Wed, Feb 12, 2014 at 7:30 AM, Sean Fitzgerald [email protected]:

Definitely marked improvement, but I'd also like to bump my parallelism up to all hosts in a deployment (right now around 80 per datacenter, our usual unit of deployment). We were definitely struggling with worker threads set to 5, and if things aren't /completely/ clear at 30, I suspect jumping to 80 isn't going to work well either. I can always run another test, but this would be testing on prod (no bueno).

On Tue, Feb 11, 2014 at 2:34 PM, Colton Myers [email protected]:

So a marked improvement, then. Still, I would prefer there weren't any errors, it should be queueing these requests even if there aren't available worker threads, if I understand correctly.

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10232#issuecomment-34816888 .

clusterfudge avatar Feb 12 '14 15:02 clusterfudge

I ran another test this morning with 75 concurrent minion connections. I saw two SaltClientErrors, and a new stack trace when using file.managed:

An exception occurred in this state: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/salt/state.py", line 1315, in call _cdata['args'], *_cdata['kwargs']) File "/usr/lib/pymodules/python2.7/salt/states/file.py", line 1157, in managed dir_mode) File "/usr/lib/pymodules/python2.7/salt/modules/file.py", line 1972, in manage_file if source and source_sum['hsum'] != name_sum: KeyError: 'hsum'

clusterfudge avatar Feb 13 '14 15:02 clusterfudge

The file.managed traceback looks like #8653.

dlindquist avatar Feb 13 '14 18:02 dlindquist

@basepi (or anyone else) what's the ceiling for the worker_threads configuration on the master? Should it be set based on the number of cores available, or is there any other resources that should be taken into account? I've done some googling, and can't find anything in the documentation about how high to set the configuration. If it helps, we have over 3,000 minions connecting to a multi-master setup.

dlindquist avatar Feb 18 '14 19:02 dlindquist

@dlindquist There's no real guidelines. I think in general a little bit of experimentation is in order. I asked Tom, and he says he would guess no more than 20 or 30 worker threads would be required for a setup like that. I think LinkedIn uses fewer than 20 for their 8000 minion master. (I haven't verified that number, though)

basepi avatar Feb 19 '14 21:02 basepi