[keycloak-user] Performance tunning of Keycloak

Nick Su nicksu at m800.com
Wed Jun 12 03:15:40 EDT 2019


Hi There

I have done some load testing against Keycloak v5.0 since we are trying to use Keycloak as SSO for our project. However the performance is quite far lower than we expect, we run Keycloak in a 12c and 24g memory vm, and the highest rps is only around 70 rps,so I am wondering any tunning can help to increate the performance?

I have tested it with this command ab -T 'application/x-www-form-urlencoded' -n 100000 -c 10000 -p post.data http://192.168.135.92:8080/auth/realms/master/protocol/openid-connect/token

and also tested with locust, script as below:

from locust import HttpLocust, TaskSet
import requests
import json
import time

def get_token(l):
    l.client.post("http://192.168.135.92:8080/auth/realms/test/protocol/openid-connect/token", {"client_id": "admin-cli", "username": "test", "password": "password", "grant_type": "password"}, headers={"Connection": "close"})

def get_users(l):
    requests.adapters.DEFAULT_RETRIES = 5
    r =     requests.post("http://192.168.135.92:8080/auth/realms/master/protocol/openid-connect/token", data= {"client_id": "admin-cli", "username": "admin", "password": "password", "grant_type": "password"}, headers={"Connection": "close"}).text
    h =  {"Authorization": "Bearer "+json.loads(r)["access_token"], "Connection": "close"}
l.client.get("http://192.168.135.92:8080/auth/admin/realms/master/users", headers=h, verify=False)

class UserBehavior(TaskSet):
    tasks = {get_token: 1}

class WebsiteUser(HttpLocust):
    task_set = UserBehavior

Thank you


More information about the keycloak-user mailing list