Reputation: 11
Stress testing Keycloak with Jmeter resulted in 100% CPU usage.
I have a Keycloak server, and I need to test it with 1,000 people logging at the same time to get OAuth Tokens.
enter image description here enter image description here
However, after testing, it was found that as long as there are more than 70 users login in at the same time, the CPU usage of the server where the Keycloak is set up will reach 100%.
It resulting a long response time of the api of login Keycloak server get token. It can even reach 10-20 seconds when there are 1000 people.
I originally thought that OAuth Server would all like this, but when I testing with Identity Server did not have this problem.
Would anyone have a solution? Thanks a lot.
Upvotes: 1
Views: 2098
Reputation: 168147
If CPU is the bottleneck - buy more computing power. Alternatively you can use a profiler tool like JProfiler or YourKit to analyze what is causing high CPU usage and fix that function, Keycloak source code is available at Github
Also your "1000" people might not be fully true, I would recommend looking at i.e. Active Threads Over Time listener output, my expectation is that the actual concurrency is even less, try setting the number of iterations in Thread Group to -1
and let your test to run 10-20 minutes, see JMeter Test Results: Why the Actual Users Number is Lower than Expected article for more detailed explanation.
Upvotes: 1