-
Notifications
You must be signed in to change notification settings - Fork 3.4k
background-sync: spread node updates over time. #32577
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
Merged
Merged
Conversation
This file contains hidden or 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
2cd729a
to
959d5ee
Compare
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>
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>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 3, 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>
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 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 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>
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>
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>
This was referenced Jun 8, 2024
sayboras
pushed a commit
that referenced
this pull request
Jun 10, 2024
[ upstream commit 598209e ] 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> (cherry picked from commit 2019ebe) Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
sayboras
pushed a commit
that referenced
this pull request
Jun 10, 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> (cherry picked from commit 56e580d) Signed-off-by: viktor-kurchenko <viktor.kurchenko@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.
kind/performance
There is a performance impact of this.
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: