-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Improve initServiceaccount by calculating once per service and reducing the lock time #47817
Conversation
with new
Without this patch
|
/retest |
there seems to be no diff with benchmark? |
Sorry i copied wrong data |
@ramaraochavali updated in the above |
} | ||
sa := sets.SortedList(spiffe.ExpandWithTrustDomains(accounts, ps.Mesh.TrustDomainAliases)) | ||
key := serviceAccountKey{ | ||
hostname: svc.Hostname, | ||
namespace: svc.Attributes.Namespace, | ||
port: port.Port, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Canwe remove the entire loop over ports now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, can do it
pilot/pkg/model/push_context.go
Outdated
var accounts sets.String | ||
func() { | ||
// First get endpoint level service accounts | ||
shard, f := env.EndpointIndex.ShardsForService(string(svc.Hostname), svc.Attributes.Namespace) | ||
if f { | ||
shard.RLock() | ||
defer shard.RUnlock() | ||
accounts = shard.ServiceAccounts | ||
// copy here to reduce the lock time, the copy cost can be ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can it be ignored?
This seems less efficient; we always copy and before sometimes we avoided a copy. Benchmark shows this as well (its faster because of the port change)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because nornally there are very small number of sas, so i say that
/retest |
/test integ-security-multicluster |
/test all |
Please provide a description of this PR: