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

Better memory management with argon2 #1646

Open
shawkins opened this issue May 2, 2024 · 1 comment · May be fixed by #1647
Open

Better memory management with argon2 #1646

shawkins opened this issue May 2, 2024 · 1 comment · May be fixed by #1647

Comments

@shawkins
Copy link

shawkins commented May 2, 2024

The Keycloak project is needing to tweak garbage collection settings to deal the amount of garbage created by the Argon2BytesGenerator.

It would be good if there were a way to limit the amount of garbage created.

shawkins added a commit to shawkins/bc-java that referenced this issue May 2, 2024
closes: bcgit#1646

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
@ahus1
Copy link

ahus1 commented May 7, 2024

To add some context what the Keycloak project is doing: Keycloak is a Single Sign On and Identity and Access Management solution where people use among other credentials passwords to log in.

Depending on how many users log in, there might be hundreds of logins per second, and each would be hashing their password. The current algorithm with a setting of for example 7 MB would then allocate 700 000 MB of memory every second, which would then need to be cleared by the garbage collection.

With a throughput optimized setting using ParallelGC, we found that this would drive the GC to a lot of full GCs as it fails to optimize its memory pools correctly. Other GC algorithms like G1 perform a lot better. Still, re-using the buffers across hash calculations would prevent so much garbage to be produced in the first place.

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

Successfully merging a pull request may close this issue.

2 participants