Skip to content
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

Excessive database load retrieving users when using MySQL with millions of users #2856

Open
swalchemist opened this issue Apr 28, 2024 · 3 comments · Fixed by #2857
Open

Comments

@swalchemist
Copy link
Contributor

swalchemist commented Apr 28, 2024

What version of UAA are you running?

The problem was found after upgrading from 77.1.0 to 77.3.0.

How are you deploying the UAA?

I am deploying the UAA as part of a commercial Cloud Foundry distribution.

What did you do?

A customer has millions of users in a MySQL database in production. We're getting queries like this that are taking more than 10 minutes, and they're stacking up and bogging down the database, causing CF commands to time out. They originated from calls to cf's /v3/users endpoint.

select count(*) from users u join identity_provider idp on u.origin = idp.origin_key and u.identity_zone_id = idp.identity_zone_id where idp.active is true and (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((LOWER(u.id) = LOWER('...id here...') OR LOWER(u.id) [...]

This caused an outage, so they rolled UAA back to 77.1.0 and saw the database load return to normal. They don't have any issues in their testing environment that only has a few thousands of users.

We see that LOWER(u.id) is indexed for postgres, but we don't create an index for mysql.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187511412

The labels on this github issue will be updated when the story is started.

@strehle
Copy link
Member

strehle commented May 2, 2024

@swalchemist @bruce-ricard @Tallicia FYI, still you should think about the UAA option database.caseinsensitive.
If a MYSQL landscape has set database.caseinsensitive=false, then this still can happen because for MYSQL you dont have the needed indexes

For postgresql this parameter cannot be used , but for MYSQL it can be used.
See
database.caseinsensitive

@torsten-sap
Copy link
Contributor

@Tallicia Please decide whether you want to keep this open after PR #2859.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants