Skip to content

Use ss filter to match TCP connections on Linux#55501

Merged
dwoz merged 4 commits into
saltstack:masterfrom
cifvts:fix-53580-master
Dec 5, 2019
Merged

Use ss filter to match TCP connections on Linux#55501
dwoz merged 4 commits into
saltstack:masterfrom
cifvts:fix-53580-master

Conversation

@cifvts

@cifvts cifvts commented Dec 3, 2019

Copy link
Copy Markdown

What does this PR do?

The current implementation of _netlink_tool_remote_on cause high CPU usage and is slow if the number of TCP connection is high. This patch address the problem by using the filtering options available in ss to reduce the output returned to just the TCP connection we are interested in.

What issues does this PR fix or reference?

Fixes #53580

Previous Behavior

salt-minion or salt-call are slow and CPU intesive when using status.master

New Behavior

The response of the call is immediate, low CPU usage

Tests written?

A test was written for the function but was not correct. A parameter has been fixed.

Andrea Agosti added 4 commits December 3, 2019 13:55
Parsing the output of all TCP connections might be really slow for high
number of connections. This patch address the problem using the
filtering provided by `ss` to reduce the number of line returned by the
command.

Fixes saltstack#53580
Fix the wrong parameter passed to the function
Fix all the variables and other problems found during the CI Lint pass
Make codeclimate happy about not going too deep into indentation
@cifvts cifvts requested a review from a team as a code owner December 3, 2019 14:01
@ghost ghost requested a review from DmitryKuzmenko December 3, 2019 14:01
@cifvts cifvts changed the title Fix 53580 master Use ss filter to match TCP connections on Linux Dec 3, 2019
@dwoz dwoz merged commit a6cc0bd into saltstack:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

status.master is slow, CPU intensive with high number of TCP connections

2 participants