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

Very large increase in CPU consumption after migration from Keycloak 21.1.2 to 24.0.4 #108

Closed
nowyp opened this issue Jun 14, 2024 · 17 comments
Assignees

Comments

@nowyp
Copy link

nowyp commented Jun 14, 2024

Hi,

we noticed very large CPU increase after switch from Keycloak 21.1.2 to 24.0.4. Initially we assumed that the problem was related that we use older provider version (v0.17.0) but we upgraded to the latest v0.22.0 and it did not help.

Below is Grafana CPU usage chart and how is changed when we upgraded Keycloak:

image

Except the Keycloak upgrade we did not have in this specific release any other changes. We also do not observe any errors or anything like that in our logs for keycloak provider.

@Breee
Copy link
Collaborator

Breee commented Jun 14, 2024

Probably related to: #65

What kind of resources do you use?

@nowyp
Copy link
Author

nowyp commented Jun 14, 2024

  • ProtocolMapper
  • Client
  • Role

Chart with bandwidth:

image

@Breee
Copy link
Collaborator

Breee commented Jun 14, 2024

There is now also away to get prometheus metrics about resources: https://blog.crossplane.io/crossplane-v1-16/
I have to check out how to implement that, reference: https://github.com/crossplane-contrib/provider-upjet-aws/pull/1281/files

i'll track that in #109 and probably work on it tomorrow

@Breee
Copy link
Collaborator

Breee commented Jun 14, 2024

  • ProtocolMapper
  • Client
  • Role

Chart with bandwidth:

image

So maybe it's really the protocol mappers: #65 (comment) i have to check that out as well -> you can try that workaround

@nowyp
Copy link
Author

nowyp commented Jun 14, 2024

Ok - in our case it was just missing introspection.token.claim: "true" value which case terafform plan/apply loop with some default one in keycloak (so in order to make it correctly all expected values needs to be provided). We're verifiing solution right now.

@nowyp
Copy link
Author

nowyp commented Jun 17, 2024

@Breee the change helps in our case decrese the CPU usage from ~ 7 cores to stable 2-3 cores but it seems that there is some memory leak (maybe in Terraform - I see there is v.1.4.6 version used) which cause that provider over time take more and more meory:

image

@Breee
Copy link
Collaborator

Breee commented Jun 23, 2024

Can you test if the leaks go away with:

xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.23.0

?

@vladimirblahoz
Copy link

I will have to re-test it multiple times with different memory limits, but in our case after first trials it seems it is still leaking even in v 0.23

@nowyp
Copy link
Author

nowyp commented Jun 24, 2024

@Breee applied the change. Will let you know about the results.

@Breee
Copy link
Collaborator

Breee commented Jun 24, 2024

Tracking that in #118 -> will try to fix that asap

@Breee
Copy link
Collaborator

Breee commented Jun 29, 2024

please test out @nowyp @vladimirblahoz

xpkg.upbound.io/crossplane-contrib/provider-keycloak:v0.24.0-rc.2

it contains changes of pr #124

@Breee Breee self-assigned this Jun 29, 2024
@nowyp
Copy link
Author

nowyp commented Jul 1, 2024

@Breee thanks for update. Applied changes to our dev cluster - let you know later about the outcome

@nowyp
Copy link
Author

nowyp commented Jul 1, 2024

First tests looks promising:

keycloak-upgrade

@vladimirblahoz
Copy link

Our long term results don't look so promising.
image

Keycloak provider pod getting OOMKilled like every hour and a half overflowing its 512Mi memory limit very regularly (running on 0.24.0-rc.2).

Not sure if this can have something to do with broken built-in clients/roles resource constantly and unsuccessfully trying to sync...

@Breee
Copy link
Collaborator

Breee commented Jul 2, 2024

Our long term results don't look so promising. image

Keycloak provider pod getting OOMKilled like every hour and a half overflowing its 512Mi memory limit very regularly (running on 0.24.0-rc.2).

Not sure if this can have something to do with broken built-in clients/roles resource constantly and unsuccessfully trying to sync...

probably. i have to verify that myself

@nowyp
Copy link
Author

nowyp commented Jul 2, 2024

In our side still stable:

image

@Breee
Copy link
Collaborator

Breee commented Jul 2, 2024

let's consolidate further discussions into #118

@Breee Breee closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants