Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Cache Kubernetes ApiClient #111

Merged
merged 13 commits into from
Feb 2, 2024
Merged

Cache Kubernetes ApiClient #111

merged 13 commits into from
Feb 2, 2024

Conversation

kevingrismore
Copy link
Contributor

@kevingrismore kevingrismore commented Feb 2, 2024

Closes #102

Uses cached Kubernetes ApiClients to prevent the buildup of open sockets. Previously, one socket per flow run would remain in a CLOSE_WAIT state.

Example

Tracking open sockets
Before:

~$ cat /proc/net/tcp | wc -l
4

Run a deployment 5 times:

~$ cat /proc/net/tcp | wc -l
9

Run a deployment 4 more times:

~$ cat /proc/net/tcp | wc -l
13

After:

~$ cat /proc/net/tcp | wc -l
4

Run a deployment 5 times:

~$ cat /proc/net/tcp | wc -l
4

Run a deployment 4 more times:

~$ cat /proc/net/tcp | wc -l
4

Screenshots

Checklist

  • References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • Includes tests or only affects documentation.
  • Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • Summarizes PR's changes in CHANGELOG.md

@kevingrismore
Copy link
Contributor Author

Implementation isn't pretty and needs tests, but this solution seems effective in practice when comparing two workers running in an AKS cluster.

@kevingrismore kevingrismore marked this pull request as ready for review February 2, 2024 14:58
@kevingrismore kevingrismore requested a review from a team as a code owner February 2, 2024 14:58
@urimandujano urimandujano merged commit 43b2746 into main Feb 2, 2024
6 checks passed
@urimandujano urimandujano deleted the cache-kubernetes-client branch February 2, 2024 18:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubernetes Worker does not release sockets after Job completes
3 participants