-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
background-sync: spread node updates over time. #32577
Merged
Merged
+65
−47
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maintainer-s-little-helper
bot
added
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
May 16, 2024
marseel
force-pushed
the
improve_background_sync
branch
3 times, most recently
from
May 17, 2024 09:50
2cd729a
to
959d5ee
Compare
marseel
changed the title
Improve background sync
background-sync: spread node updates over time.
May 17, 2024
marseel
added
the
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
label
May 17, 2024
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
May 17, 2024
marseel
force-pushed
the
improve_background_sync
branch
from
May 17, 2024 09:58
959d5ee
to
0388bf0
Compare
/test |
marseel
commented
May 17, 2024
Removing @danehans from reviews due to cilium/community#118 |
Before, depending on cluster-size we were triggering node update for each node at fixed intervals depending on cluster-size. This resulted in high cpu usage spike in agent. While the intent is to fix state that got stale and shouldn't be the primary source of updates, it makes sense to spread these updates over time to average out cpu usage. Also, reenable backgroundSync test. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
force-pushed
the
improve_background_sync
branch
from
May 17, 2024 10:35
0388bf0
to
0d4f591
Compare
/test |
tklauser
approved these changes
May 17, 2024
marseel
added a commit
that referenced
this pull request
May 17, 2024
Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
that referenced
this pull request
May 17, 2024
Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
that referenced
this pull request
May 17, 2024
Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
that referenced
this pull request
May 17, 2024
Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
sayboras
pushed a commit
that referenced
this pull request
Jun 4, 2024
Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
to marseel/cilium
that referenced
this pull request
Jun 4, 2024
[ upstream commit 2019ebe ] During bootrstrap, we don't know number of nodes and new implementation essentially was hot looping till fetched nodes. Also, in case of cluster with single node, rate-limiter was not rate-limiting. Fixes cilium#32577 Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
2 tasks
marseel
added a commit
to marseel/cilium
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - not enabled ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to cilium#32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
to marseel/cilium
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to cilium#32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
to marseel/cilium
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to cilium#32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added
the
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
label
Jun 4, 2024
marseel
added a commit
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests. Flags use Vp instead of vp. Minor conflicts with netlink.XfrmState* calls ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests. Flags use Vp instead of vp. Minor conflicts with netlink.XfrmState* calls. Switched from pkg/time to time ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
marseel
added a commit
that referenced
this pull request
Jun 4, 2024
[ upstream commit 2019ebe ] [ Backporter's notes: minor conflicts due to lack of context and closeChan instead. ] During bootrstrap, we don't know number of nodes and new implementation essentially was hot looping till fetched nodes. Also, in case of cluster with single node, rate-limiter was not rate-limiting. Fixes #32577 Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
2 tasks
marseel
added
the
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
label
Jun 4, 2024
marseel
added a commit
that referenced
this pull request
Jun 4, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests. Flags use Vp instead of vp. Minor conflicts with netlink.XfrmState* calls. Switched from pkg/time to time. Switch from checkmate to check.v1 ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
qmonnet
pushed a commit
that referenced
this pull request
Jun 5, 2024
[ upstream commit 2019ebe ] [ Backporter's notes: minor conflicts due to lack of context and closeChan instead. ] During bootrstrap, we don't know number of nodes and new implementation essentially was hot looping till fetched nodes. Also, in case of cluster with single node, rate-limiter was not rate-limiting. Fixes #32577 Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
github-actions
bot
added
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
and removed
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
labels
Jun 5, 2024
maintainer-s-little-helper
bot
moved this from Backport pending to v1.13
to Backport done to v1.13
in 1.13.17
Jun 5, 2024
qmonnet
pushed a commit
that referenced
this pull request
Jun 5, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests. Flags use Vp instead of vp. Minor conflicts with netlink.XfrmState* calls ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
qmonnet
pushed a commit
that referenced
this pull request
Jun 5, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
github-actions
bot
added
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
and removed
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
labels
Jun 5, 2024
michi-covalent
pushed a commit
that referenced
this pull request
Jun 5, 2024
[ upstream commit 3a4c57f ] [ Backporter's notes: switch default to false - so not enabled by default. Switch from testing package to checkmate in unit tests. Flags use Vp instead of vp. Minor conflicts with netlink.XfrmState* calls. Switched from pkg/time to time. Switch from checkmate to check.v1 ] Reduces GC CPU usage and memory allocations coming from XfrmStateList. To ensure we have up-to-date cache, wrap all XfrmState related functions inside cache, which is invalidated whenever XfrmState changes. This is follow-up to #32577 While that PR averages out CPU usage over time, in large cluster 100+ nodes amount of allocations coming from netlink.XfrmStateList() is high due to backgroundSync where we usually don't change any Xfrm states. This becomes more and more expensive as number of nodes increases. Added CI test to make sure that we accidentally don't add calls that modify XFRMState without going through cache. Also, added hidden option that allows to turn of caching. Signed-off-by: Marcel Zieba <marcel.zieba@isovalent.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
backport-done/1.15
The backport for Cilium 1.15.x for this PR is done.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before, depending on cluster-size we were triggering node update for
each node at fixed intervals depending on cluster-size. This resulted in
high cpu usage spike in agent. While the intent is to fix state that got
stale and shouldn't be the primary source of updates, it makes sense to
spread these updates over time to average out cpu usage.
Also, reenable backgroundSync test.
GC CPU usage on 100-node cluster with IPSec enabled before:
After: