-
-
Notifications
You must be signed in to change notification settings - Fork 963
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
Performance issue in verification related queries #2278
Comments
Thank you for the report! I checked in our code base and we currently do not normalize the email address in the code itself. My proposal would be to add this transformation in the Go code here kratos/identity/extension_verify.go Line 33 in 567a3d7
kratos/identity/extension_recovery.go Line 32 in 567a3d7
add a migraiton along the lines of
and then remove the This would then be a solution all databases! By the way, would it possible for you to publish the benchmark you have done? It would be awesome to have some performance testing in Ory Kratos available. The community would for sure love it!! |
That sounds a reasonable approach. Not all databases have the same default behavior. For the benchmark, we are still in preparing phase actually, so no data yet. Once this is completed, we will see if we can publish it somewhere. Thx. |
Preflight checklist
Describe the bug
Description
We are planning to do a load test on kratos and the first step for that is to generate 4.1million test accounts. However once those accounts are generated, we found that kratos endpoint sometimes can not serve verification requests and shows time out.
Checking the query on database side, we identified two slow queries:
For these two queries, the optimizer is not able to fully use the underlying index, and as a result they both took ~40s to finish. You can check more information from
explain
.Why the index is not fully used
It's because there's a
lower
call in thewhere
conditionWhat is the fix
My proposal is to remove the
lower
call. This shouldn't affect the business logic since the column forvalue
has a case insensitive collation:utf8mb4_0900_ai_ci
. Even withoutlower
call, the internal comparison on the value will be case insensitive.Examples:
The following query also works because the collation ends in
ci
Now modify the column to use a case sensitive collation
Reproducing the bug
As explained above.
Relevant log output
No response
Relevant configuration
No response
Version
0.8.2
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Kubernetes
Additional Context
No response
The text was updated successfully, but these errors were encountered: