-
Notifications
You must be signed in to change notification settings - Fork 476
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
SPIRE has a lot of MySQL QPS #1351
Comments
Are all agents authorized for all workloads? |
Unfortunately, [1] is used a bunch (list registration entries) when figuring out what workloads are authorized for an agent. However, it looks like we can shave a bunch of load by using prepared statements (i.e. [2] and [4]). I'm working on PRs now that should reduce the counts for [3] and [5]. |
No, workloads are assigned to particular agents and if they are moved around then new registration entries are created (and old ones are removed). Also a small nit/clarification to your 2nd comment @azdagron when you say |
Yes, fixed them to not be links to issues :) |
I should have clarified that we have a number of daemon sets that run on all hosts, so a big portion of the 31k workloads comes from them ( |
I'm pretty confident we can halve the load shown above. I'll have PRs out shortly. |
#1355 indeed cut our MySQL QPS in half: The CPU usage drop is even more dramatic: |
We've noticed in our MySQL metrics that SPIRE is doing a lot of QPS.
I'm attaching our data to this ticket for reference. The source of this cluster has approximately 3500 SPIRE Agents and 31000 workloads
Here are the top queries (everything over 1% exec):
This is the top query:
select e.id as e_id, e.entry_id as entry_id, e.spiffe_id, e.parent_id, e.ttl as reg_ttl, e.admin, e.downstream, e.expiry, s.id as selector_id, s.type as selector_type, s.value as selector_value, b.trust_domain, d.id as dns_name_id, d.value as dns_name from registered_entries e left join (select ? as joinitem union select ? union select ?) as joinitems on true left join selectors s on joinitem=? and e.id=s.registered_entry_id left join dns_names d on joinitem=? and e.id=d.registered_entry_id left join (federated_registration_entries f inner join bundles b on f.bundle_id=b.id) on joinitem=? and e.id=f.registered_entry_id where e.id in(?+) order by e_id, selector_id, dns_name_id
MySQL says about that:
The stats on the query itself look OK, so I think it's mostly the number of times its being run.
The text was updated successfully, but these errors were encountered: